Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to execute the two vb scripts Consecutively
#1
Solved: 11 Years, 4 Months, 2 Weeks ago
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
Reply
#2
Solved: 11 Years, 4 Months, 2 Weeks ago
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.
Reply
#3
Solved: 11 Years, 4 Months, 2 Weeks ago
you can use 'Wscript' to call your vbs file
see the example below
Code:
Dim oShell
Set oShell = CreateObject("Wscript.Shell")
oShell.run "C:\test1.vbs", , True
oShell.run "C:\test2.vbs", , True
specifying waitonreturn argument for Run as true will enable the script to wait until your first vbs executes.

Reply
#4
Solved: 11 Years, 4 Months, 2 Weeks ago
Thanks Saket,
Its working good
thanks alot
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Is it possible to execute Remote Agent witout ALM? CharlieMadrid 0 1,245 05-12-2020, 01:26 PM
Last Post: CharlieMadrid
  How to execute a UFT script when computer is in locked state akilamurugesh 4 13,117 08-25-2014, 07:41 PM
Last Post: akilamurugesh
  Execute the QTp scripts when i lock my computer balreddy 4 21,990 10-19-2012, 04:45 AM
Last Post: sujoysen1
  How to execute batch file from command prompt using QTP sachindhote 2 18,457 08-13-2012, 04:47 PM
Last Post: sneha2409
  4GB RAM= number of QTP scripts can execute chaithanya84 1 2,685 07-23-2012, 06:08 PM
Last Post: Tarik Sheth

Forum Jump:


Users browsing this thread: 2 Guest(s)