How to execute the two vb scripts Consecutively - Printable Version +- Micro Focus QTP (UFT) Forums (https://www.learnqtp.com/forums) +-- Forum: Micro Focus UFT (earlier known as QTP) (https://www.learnqtp.com/forums/Forum-Micro-Focus-UFT-earlier-known-as-QTP) +--- Forum: UFT / QTP Others (https://www.learnqtp.com/forums/Forum-UFT-QTP-Others) +--- Thread: How to execute the two vb scripts Consecutively (/Thread-How-to-execute-the-two-vb-scripts-Consecutively) |
How to execute the two vb scripts Consecutively - venkatbatchu - 10-09-2009 I have two vb scripts first.vbs and second.vbs i have scheduled first.vbs at 12.30am and second.vbs at 12.35am(both need the same browser and same pages) With the above scheduled scenarios, i am able to execute the scripts correctly if first script execution time is less than 5 mintues Some times because of network issues and Internet issues first script will take more than 5 minutes in such situations i am unable to execute the two scripts Consecutively Now i have decided that after completion of first script execution then second script has to trigger so here i am not getting any idea with the mentioned scenario So please let me know if we have any solution Thanks in advance, Venkat RE: How to execute the two vb scripts Consecutively - jsknight1969 - 10-12-2009 There might be a few ways to handle this one. My first thought would be to create a file test or something using FSO.. Something like.....Script 1 'start by deleting the file fso = CreateObject("file.scripting") fso.Delete("path\name") 'the rest of script 1 here...... 'When complete write a file someplace fso.open("path\name", ForAppend, True) 'True to create if missing fso.writeline "Completed" 'doesn't really matter unless you want to poll for results fso.close Script 2 'Start by checking if script 1 is complete. fso = CreateObject("file.scripting") while found = false on error resume next 'just incase FSO throws an error for doesn't exist found = fso.Exist("path\name") 'same path\file as script 1 wait(60) 'Sleep for 1 min loop on error goto 0 'Reset error trapping 'continue with the rest of the script This is not the exact code. I'm a little rusty on the FSO (File Scripting Object) capabilities, but I know it can check if a file exists. The loop in the second script will wait and continue to test for the file existence before continuing with the script. You could also use a database or even a registry key and poll the value before continuing, but I think the FSO will be easier especially with a non-monitored system script. Hope this helps. RE: How to execute the two vb scripts Consecutively - Saket - 10-14-2009 you can use 'Wscript' to call your vbs file see the example below Code: Dim oShell RE: How to execute the two vb scripts Consecutively - venkatbatchu - 10-14-2009 Thanks Saket, Its working good thanks alot |