dorkbrains Posted May 21, 2009 Share Posted May 21, 2009 Hello, i am trying to make a "master script" that basically runs a bunch of other scripts so i dont have to search every time i want a new one. The problem i am having however is that my scripts are basically confused. I pretty much use the hotkey "home" for all my scripts and therefore when i tell this script to open another and then i press home...instead of starting the function in the new script...it activates the function for home in the master script.. im just wondering if there is some way to like 'disable' the master script until the script opened is closed? or something like that here is the master script: Global $folder = True HotKeySet("!w","dfwatch") HotKeySet("!i","idler") HotKeySet("{HOME}","help") HotKeySet("{END}","stop") MsgBox(0,"WATCH OUT!!!","This Master Script depends on the fact that all your files are in a certain directory and are named appropiatly. Please make sure that all your scripts have the following names. FILES ARE CASE-SENSITIVE!" & @CRLF & "" & @CRLF & "Debris Field Watcher = DF Watcher v1.2.exe" & @CRLF & "Idler = Idler.exe") $folder = FileSelectFolder("Select the folder containing your OGame Scripts.","") MsgBox(0,"Commands","The following are the commands to activate their respective functions." & @CRLF & "" & @CRLF & "ALT + w = DF Watcher v1.2" & @CRLF & "ALT + i = Idler" & @CRLF & "This window = Home") While 1 Sleep(100) WEnd Func dfwatch() Run("" & $folder & "\DF Watcher v1.2.exe") EndFunc Func idler() Run("" & $folder & "\Idler.exe") EndFunc Func help() MsgBox(0,"Commands","The following are the commands to activate their respective functions." & @CRLF & "" & @CRLF & "ALT + w = DF Watcher v1.2" & @CRLF & "ALT + i = Idler" & @CRLF & "This window = Home") EndFunc Func stop() Exit 0 EndFunc if you need something else, or i didnt make any sense. let me know thanks Link to comment Share on other sites More sharing options...
Coolw Posted May 21, 2009 Share Posted May 21, 2009 You could try RunWait(). That way the script is paused until the run window is closed? My ProgramsMy WIP'sSteam Server Restarter Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted May 21, 2009 Moderators Share Posted May 21, 2009 dorkbrains,From the HotKeySet Help file: Remarks - "If two AutoIt scripts set the same HotKeys, you should avoid running those scripts simultaneously. (The second script cannot capture the hotkey unless the first script terminates or unregisters the key prior to the second script setting the hotkey."So you need to deregister the "Home" key in the master script just before calling the child script - that way your child can use the key. If the child script terminates, then it automatically frees the key for the main script to reregister it. If the child remains active, you will have to perform a similar "swap" as you return to the main script.And before you ask: "function - [optional] The name of the function to call when the key is pressed. Not specifying this parameter will unset a previous hotkey" - from the same page. ;-)M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
dorkbrains Posted May 21, 2009 Author Share Posted May 21, 2009 alright i did what you said melba but now im running into an issue where once i press end to stop the child script...i cant go back to the master and use its functions...this is what the new master looks like. Global $folder = True HotKeySet("!w","dfwatch") HotKeySet("!i","idler") HotKeySet("{HOME}","help") HotKeySet("{END}","stop") MsgBox(0,"WATCH OUT!!!","This Master Script depends on the fact that all your files are in a certain directory and are named appropiatly. Please make sure that all your scripts have the following names. FILES ARE CASE-SENSITIVE!" & @CRLF & "" & @CRLF & "Debris Field Watcher = DF Watcher v1.2.exe" & @CRLF & "Idler = Idler.exe") $folder = FileSelectFolder("Select the folder containing your OGame Scripts.","") MsgBox(0,"Commands","The following are the commands to activate their respective functions." & @CRLF & "" & @CRLF & "ALT + w = DF Watcher v1.2" & @CRLF & "ALT + i = Idler" & @CRLF & "This window = Home") While 1 Sleep(100) WEnd Func dfwatch() HotKeySet("{HOME}") HotKeySet("{END}") Run("" & $folder & "\DF Watcher v1.2.exe") EndFunc Func idler() HotKeySet("{HOME}") HotKeySet("{END}") Run("" & $folder & "\Idler.exe") EndFunc Func help() MsgBox(0,"Commands","The following are the commands to activate their respective functions." & @CRLF & "" & @CRLF & "ALT + w = DF Watcher v1.2" & @CRLF & "ALT + i = Idler" & @CRLF & "This window = Home") EndFunc Func stop() Exit 0 EndFunc Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted May 21, 2009 Moderators Share Posted May 21, 2009 dorkbrains,As I mentioned in my first post above, if you want your master to regain use of the HotKeys, you need to reregister them once the child script returns. An example:Func dfwatch() ; Cancel HotKeys in the master script HotKeySet("{HOME}") HotKeySet("{END}") ; Run child script Run("" & $folder & "\DF Watcher v1.2.exe") ; Reregister HotKeys for use in the master script HotKeySet("{HOME}","help") HotKeySet("{END}","stop") EndFuncAs long as only one script is using a HotKey at a time, all should be well.M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
dorkbrains Posted May 21, 2009 Author Share Posted May 21, 2009 wow i feel like an idiot thanks for the help melba 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