Hello Me You Posted February 20, 2007 Share Posted February 20, 2007 My script has an inputbox, you type a window name in it and it hides the window. But when you press ctrl+alt+h (hotkey to the input box) and you press cancel, it hides the active window. How can I stop this? HotKeySet("^!h", "_hide") HotKeySet("^!u", "_unhide") HotKeySet("^!#x", "_exit") While 1 WEnd Func _hide() $in_hide = InputBox("Hide Window", "Enter window title:") WinSetState($in_hide, "", @SW_HIDE) EndFunc Func _unhide() $in_unhide = InputBox("Unhide Window", "Enter window title:") WinSetState($in_unhide, "", @SW_SHOW) EndFunc Func _exit() $msg = MsgBox(1, "Exit Script", "Are you sure?") If $msg = 1 Then Exit EndIf EndFunc Random Link to comment Share on other sites More sharing options...
Xenobiologist Posted February 20, 2007 Share Posted February 20, 2007 Hi, make a GLOBAL variable to store the title otherwise .... And put a sleep into your while wend. So long, 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 Link to comment Share on other sites More sharing options...
t0ddie Posted February 20, 2007 Share Posted February 20, 2007 (edited) not tested.. but it may work. HotKeySet("^!h", "_hide") HotKeySet("^!u", "_unhide") HotKeySet("^!#x", "_exit") While 1 WEnd Func _hide() $in_hide = InputBox("Hide Window", "Enter window title:") if $in_hide = "" then return else WinSetState($in_hide, "", @SW_HIDE) endif EndFunc Func _unhide() $in_unhide = InputBox("Unhide Window", "Enter window title:") WinSetState($in_unhide, "", @SW_SHOW) EndFunc Func _exit() $msg = MsgBox(1, "Exit Script", "Are you sure?") If $msg = 1 Then Exit EndIf EndFunc Edited February 20, 2007 by t0ddie Valik Note Added 19 October 2006 - 08:38 AMAdded to warn level I just plain don't like you. Link to comment Share on other sites More sharing options...
Developers Jos Posted February 20, 2007 Developers Share Posted February 20, 2007 My script has an inputbox, you type a window name in it and it hides the window. But when you press ctrl+alt+h (hotkey to the input box) and you press cancel, it hides the active window. How can I stop this?Test the returned @error for the inputbox ... SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
t0ddie Posted February 20, 2007 Share Posted February 20, 2007 (edited) Test the returned @error for the inputbox ... that would also work. it will give an error if blank. i just used code to check to see if the variable was blank... either way will work. jdeb method would actually be better theres a couple of words less to code. lol HotKeySet("^!h", "_hide") HotKeySet("^!u", "_unhide") HotKeySet("^!#x", "_exit") While 1 WEnd Func _hide() $in_hide = InputBox("Hide Window", "Enter window title:") if @error return WinSetState($in_hide, "", @SW_HIDE) EndFunc Func _unhide() $in_unhide = InputBox("Unhide Window", "Enter window title:") WinSetState($in_unhide, "", @SW_SHOW) EndFunc Func _exit() $msg = MsgBox(1, "Exit Script", "Are you sure?") If $msg = 1 Then Exit EndIf EndFunc Edited February 20, 2007 by t0ddie Valik Note Added 19 October 2006 - 08:38 AMAdded to warn level I just plain don't like you. Link to comment Share on other sites More sharing options...
Hello Me You Posted February 21, 2007 Author Share Posted February 21, 2007 Thanks for all responses Random 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