Ices Posted May 25, 2009 Share Posted May 25, 2009 I'm looking for a way to close a script when a hotkey is pressed in another script. The only way I know how is with processclose, but if my scripts aren't compiled, I can't use processclose. Is there any way to set a unique ID to a script when starting it, then using that ID to close it with another script? Any help would be appreciated. Thanks in Advance, Ices Link to comment Share on other sites More sharing options...
Juvigy Posted May 25, 2009 Share Posted May 25, 2009 You can make something like a loop in the first script to check .ini file for a specific value every 5 secs for example and if the value is matched to exit the first script. And in the second script youcan set that value in the ini file whenever you want to exit the first script. Link to comment Share on other sites More sharing options...
Authenticity Posted May 25, 2009 Share Posted May 25, 2009 Script 1: #include <WinAPI.au3> Global $iUniqueMSg Global $hGUI $iUniqueMSg = _WinAPI_RegisterWindowMessage('SomeUniqueLiteralMessageString') $hGUI = GUICreate('Test', 100, 100) GUIRegisterMsg($iUniqueMSg, '_QuitScript') ToolTip('Script1 is running...', @DesktopWidth-150, 0) While 1 Sleep(20) WEnd Func _QuitScript($hwnd, $iMsg, $iwParam, $ilParam) GUIDelete() Exit EndFuncoÝ÷ Ù'+vjëh×6#include <WinAPI.au3> HotKeySet('{ESC}', '_CloseScripts') Global Const $HWND_BROADCAST = 0xFFFF Global $iUniqueMsg $iUniqueMsg = _WinAPI_RegisterWindowMessage('SomeUniqueLiteralMessageString') ToolTip('Script2 is running...', @DesktopWidth-150, 25) While 1 Sleep(20) WEnd Func _CloseScripts() DllCall('user32.dll', 'int', 'PostMessage', 'hwnd', $HWND_BROADCAST, 'uint', $iUniqueMsg, _ 'wparam', 0, 'lparam', 0) Exit EndFunc Link to comment Share on other sites More sharing options...
Ices Posted May 25, 2009 Author Share Posted May 25, 2009 Ahh, I didn't think of that. That will work great, thanks. 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