SPONSORS:






User Tag List

Thanks Thanks:  0
Likes Likes:  0
Dislikes Dislikes:  0
Results 1 to 10 of 10
  1. #1
    Advanced Member
    Join Date
    Jul 2003
    Location
    Sudbury MA
    Posts
    532
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    How can you manually stop an OTA vbscript?


    I have several OTA vbscripts that run fine. They perform long batch processes that save QTP scripts to QC, or they run several test sets in QC.

    I've accidentally started the batch process to run several testsets in QC. The only way I can stop them is to frantically try to shut down QTP and/or QC and/or click the scheduler in the system tray and then close each run as it comes up.

    Is there some control sequence I can type at the keyboard to stop the vbscript? Can I kill a process in task manager? What is the name of the task?

  2. #2
    Advanced Member cgrzelka's Avatar
    Join Date
    Feb 2005
    Location
    Bordeaux, France
    Posts
    750
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: How can you manually stop an OTA vbscript?

    It depends on how you start the script : either cscript (if you start from batch file) or wscript (if, for instance, you double-click on the vbs file name).

  3. #3
    Moderator
    Join Date
    Sep 2001
    Location
    Doncaster, UK
    Posts
    5,788
    Post Thanks / Like
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: How can you manually stop an OTA vbscript?

    Would wrapping the code in a "are you sure you want to execute" Yes/No prompt be more efficient?


    Mark Smith.

  4. #4
    Advanced Member
    Join Date
    Jul 2003
    Location
    Sudbury MA
    Posts
    532
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: How can you manually stop an OTA vbscript?


    I double click the vbs file

  5. #5
    Advanced Member
    Join Date
    Jul 2003
    Location
    Sudbury MA
    Posts
    532
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: How can you manually stop an OTA vbscript?


    re: wrapping in a do you really want to prompt.

    Yes. Good idea. I should have thought of it, it's my kind of solution.

  6. #6
    Super Member Jonty's Avatar
    Join Date
    Jan 2007
    Location
    India
    Posts
    1,266
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: How can you manually stop an OTA vbscript?

    if you double click the vbs, you will have wscript.exe process in the task manager, which can be killed, but yes the confirmation to execute is a simple way of avoiding this
    Cheers
    Jonty..
    -- Here to Learn and share ---

  7. #7
    Advanced Member
    Join Date
    Jul 2003
    Location
    Sudbury MA
    Posts
    532
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: How can you manually stop an OTA vbscript?


    I finally got back to this. And quickly found out that there is no way to exit a vb script without making everything a subroutine and not calling them from your main program. Too much rewriting for me.

    So this is what I did, wshShl.Exit isn't supported for vb script, so it crashes the script, but I wanted to exit the script anyway.

    This is really ugly, but it works. If anyone has anything that isn't as ugly, please share. I couldn't find anything out on the web.

    intQuit = MsgBox( "This takes a few minutes. Are you sure you want to run this?" , vbYesNo, "Do you really want to?")
    If intQuit = vbNo Then
    MsgBox " This script will now error. Dismiss the error dialog without debugging ", vbOKonly, " Script terminated "
    wshShl.Exit
    End If

  8. #8
    SQA Knight
    Join Date
    Jun 2008
    Posts
    2,555
    Post Thanks / Like
    Mentioned
    3 Post(s)
    Tagged
    1 Thread(s)
    Total Downloaded
    0

    Re: How can you manually stop an OTA vbscript?

    Are you overthinking this? Sounds like you should just wrap the whole program in that if statement so if they hit no, it just goes to the end if which is the last line of the script.

  9. #9
    Advanced Member
    Join Date
    Jul 2003
    Location
    Sudbury MA
    Posts
    532
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: How can you manually stop an OTA vbscript?


    You're right, the simple if statement is the way to go.

    I was looking for an example of a exit statement on the web and it just so happens several hits said that the only way to exit was via subroutines.

    So not overthinking, just over naive.

  10. #10
    SQA Knight
    Join Date
    Jun 2008
    Posts
    2,555
    Post Thanks / Like
    Mentioned
    3 Post(s)
    Tagged
    1 Thread(s)
    Total Downloaded
    0

    Re: How can you manually stop an OTA vbscript?

    That's what I'd do. Though to answer the question, it looks like wscript.quit will accomplish the hard exit you were looking for.

    http://msdn.microsoft.com/en-us/libr...8VS.85%29.aspx

 

 

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Search Engine Optimisation provided by DragonByte SEO v2.0.36 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Resources saved on this page: MySQL 10.71%
vBulletin Optimisation provided by vB Optimise v2.6.4 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
User Alert System provided by Advanced User Tagging v3.2.8 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
vBNominate (Lite) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Feedback Buttons provided by Advanced Post Thanks / Like (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Username Changing provided by Username Change (Free) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
BetaSoft Inc.
Digital Point modules: Sphinx-based search
All times are GMT -8. The time now is 01:46 PM.

Copyright BetaSoft Inc.