noobieautolearn Posted October 31, 2014 Share Posted October 31, 2014 I compiled an autoit script and the way it is setup is if it doesn't see the window it's looking for it will stay opened. If you run another instance and then the window it's looking for shows up both instances of the script will enter data which screws things up. Is there a way to set it so that if you open up another instance of the .exe it will close all the other ones already running? Link to comment Share on other sites More sharing options...
jchd Posted October 31, 2014 Share Posted October 31, 2014 _Singleton() This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe hereRegExp tutorial: enough to get startedPCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta. SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt) Link to comment Share on other sites More sharing options...
Exit Posted November 1, 2014 Share Posted November 1, 2014 (edited) I compiled an autoit script and the way it is setup is if it doesn't see the window it's looking for it will stay opened. If you run another instance and then the window it's looking for shows up both instances of the script will enter data which screws things up. Is there a way to set it so that if you open up another instance of the .exe it will close all the other ones already running? Use _SingleScript() function. May be found >here. Edited November 2, 2014 by Exit App: Au3toCmd UDF: _SingleScript() Link to comment Share on other sites More sharing options...
232showtime Posted November 1, 2014 Share Posted November 1, 2014 Exit, Could you show us an example??? thanks... ill get to that... i still need to learn and understand a lot of codes Correct answer, learn to walk before you take on that marathon. Link to comment Share on other sites More sharing options...
Exit Posted November 1, 2014 Share Posted November 1, 2014 (edited) On 11/1/2014 at 3:35 PM, 232showtime said: Exit, Could you show us an example??? thanks... Here is a example: #include <_SingleScript.au3> If $cmdline[0] = 0 Then ; submit all scripts TraySetToolTip("No Case") _SingleScript() ; Kill other scripts, if others are executing For $i = 0 To 7 Sleep(100) ShellExecute(@ScriptFullPath, $i) Next Exit MsgBox(64 + 262144, Default, "All scripts submitted. See icons in system tray. Case 1 already disappeared.", 0) EndIf TraySetToolTip("Case " & $cmdline[1]) Switch $cmdline[1] Case 0 $rc = _SingleScript(3) ; Check, if others are executing MsgBox(64 + 262144, Default, "Case " & $cmdline[1] & " executing. " & ($rc ? "Some" : "No") & " other scripts executing.", 0) Case 1 _SingleScript(2) ; Kill this scropt, if others are executing Beep(440, 3000) ; you will NOT hear the long beep. Case 2, 3, 4, 6, 7 _SingleScript(1) ; Wait for predecessors completed MsgBox(64 + 262144, Default, "Case " & $cmdline[1] & " executing.", 0) Case 5 _SingleScript(1) ; Wait for predecessors completed (case 1-4) MsgBox(64 + 262144, Default, "Case " & $cmdline[1] & " executing." & @CRLF & "Now killing other scripts. See icons in system tray.", 0) _SingleScript() ; Now kill other scripts. Should be case 6 and 7 _SingleScript(3) ; Check, if others are executing MsgBox(64 + 262144, Default, "Case " & $cmdline[1] & " executing. " & (@extended ? "Some" : "No") & " other scripts executing.", 0) EndSwitch Hope this example is selfexplaining. If not, --> please ask again. UDF _SingleScript() can be found here Edit: 2014.11.02 New version of _SingleScript() function and example. Edited March 9, 2019 by Exit point to new #include location App: Au3toCmd UDF: _SingleScript() Link to comment Share on other sites More sharing options...
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