nbala75 Posted February 2, 2011 Posted February 2, 2011 I have couple of scripts running say A and B Now i want to run a new script named C. While running script C, i want to pause A and B. While after completing script C, scripts A and B shud resume. How do i do it? I cannot use ShellexecuteWAIT since Script C is not run from Script A or B. Script C is run independently. I Cannot use processwait etc from Script C, bcos, Script A and B are not .exe files, they are just script files with .au3 Plz guide me ASAP
Xenobiologist Posted February 2, 2011 Posted February 2, 2011 Create a lookup function which checks every x seconds whether the relevant process exists. If it exists then, loop (sleep) otherwise it goes on. Scripts & functions Organize Includes Let Scite organize the include files Yahtzee The game "Yahtzee" (Kniffel, DiceLion) LoginWrapper Secure scripts by adding a query (authentication) _RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...) Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc. MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times
heyhey Posted February 2, 2011 Posted February 2, 2011 I think it would be smarter to just turn them into .exe's? Or are you still working on them?
nbala75 Posted February 2, 2011 Author Posted February 2, 2011 I think it would be smarter to just turn them into .exe's? Or are you still working on them?yup....still working on them...may do so in near term as well
nbala75 Posted February 2, 2011 Author Posted February 2, 2011 (edited) Create a lookup function which checks every x seconds whether the relevant process exists.If it exists then, loop (sleep) otherwise it goes on.which process to check and where to write this loop?btw...all are .au3 scripts and how do u propose to check those whether running or not?And also...i tried this which never worked I have hotkeyset("^P") in Script A to Pause the scriptIf i want to run Script C, while pausing Script A, then at the beginning of Script C's code, i used Send keys ("^P"), thinking that this wud indeed pause Script A....it never worked...Any other ideas?? Edited February 2, 2011 by nbala75
JoHanatCent Posted February 3, 2011 Posted February 3, 2011 I have couple of scripts running say A and BNow i want to run a new script named C. While running script C, i want to pause A and B. While after completing script C, scripts A and B shud resume.How do i do it?Try and put all 3 into one script?
Xenobiologist Posted February 3, 2011 Posted February 3, 2011 Global $pid = 0, $pid1 = 0, $scriptPath = "loopTest.au3", $scriptPath1 = "loopTest1.au3" $pid = _runAU3($scriptPath) $pid1 = _runAU3($scriptPath1) ConsoleWrite('! The PID of ' & $scriptPath & ' is : ' & $pid & @CRLF) ConsoleWrite('! The PID of ' & $scriptPath1 & ' is : ' & $pid1 & @CRLF) ConsoleWrite(_checkAU3Run($pid) & "=== 0 = not running, 1 = running" & @CRLF) ConsoleWrite(_checkAU3Run($pid1) & "=== 0 = not running, 1 = running" & @CRLF) Func _checkAU3Run($pid) If ProcessExists($pid) Then Return 1 Return 0 EndFunc ;==>_checkAU3Run Func _runAU3($pathToAu3) Local $pid = Run('"' & @AutoItExe & '" ' & '/AutoIt3ExecuteScript "' & $pathToAu3 & '"', '', @SW_SHOW) Return $pid EndFunc ;==>_runAU3 Scripts & functions Organize Includes Let Scite organize the include files Yahtzee The game "Yahtzee" (Kniffel, DiceLion) LoginWrapper Secure scripts by adding a query (authentication) _RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...) Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc. MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times
Juvigy Posted February 3, 2011 Posted February 3, 2011 Create a function/s from the second script and in the first script just call that function. You can even #Include them .
nbala75 Posted February 3, 2011 Author Posted February 3, 2011 Global $pid = 0, $pid1 = 0, $scriptPath = "loopTest.au3", $scriptPath1 = "loopTest1.au3" $pid = _runAU3($scriptPath) $pid1 = _runAU3($scriptPath1) ConsoleWrite('! The PID of ' & $scriptPath & ' is : ' & $pid & @CRLF) ConsoleWrite('! The PID of ' & $scriptPath1 & ' is : ' & $pid1 & @CRLF) ConsoleWrite(_checkAU3Run($pid) & "=== 0 = not running, 1 = running" & @CRLF) ConsoleWrite(_checkAU3Run($pid1) & "=== 0 = not running, 1 = running" & @CRLF) Func _checkAU3Run($pid) If ProcessExists($pid) Then Return 1 Return 0 EndFunc ;==>_checkAU3Run Func _runAU3($pathToAu3) Local $pid = Run('"' & @AutoItExe & '" ' & '/AutoIt3ExecuteScript "' & $pathToAu3 & '"', '', @SW_SHOW) Return $pid EndFunc ;==>_runAU3 Does this run both simultaneously??
Xenobiologist Posted February 3, 2011 Posted February 3, 2011 Yes, I think so! Just change the loopTest.au3 to any of your scripts. Or create the to scripts loopTest.au3 and loopTest1.au3 with this content. While 1 Sleep(1000) WEnd Mega Scripts & functions Organize Includes Let Scite organize the include files Yahtzee The game "Yahtzee" (Kniffel, DiceLion) LoginWrapper Secure scripts by adding a query (authentication) _RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...) Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc. MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now