Sign in to follow this  
Followers 0
Hello Me You

A small problem

6 posts in this topic

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

Share this post


Link to post
Share on other sites



Hi,

make a GLOBAL variable to store the title otherwise .... :whistle:

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

Share this post


Link to post
Share on other sites

#3 ·  Posted (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 by t0ddie

Valik Note Added 19 October 2006 - 08:38 AMAdded to warn level I just plain don't like you.

Share this post


Link to post
Share on other sites

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 ...


Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

#5 ·  Posted (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 by t0ddie

Valik Note Added 19 October 2006 - 08:38 AMAdded to warn level I just plain don't like you.

Share this post


Link to post
Share on other sites

Thanks for all responses


Random

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0