Jump to content

Recommended Posts

Posted

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
Posted

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

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.

  • Developers
Posted

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

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.

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...