Sign in to follow this  
Followers 0
Hello Me You

Can I make this shorter?

4 posts in this topic

#1 ·  Posted (edited)

Can I make this script shorter?

; ===================================================================

HotKeySet("^!h", "_hide")
HotKeySet("^!u", "_unhide")
HotKeySet("^!#x", "_exit")

; ===================================================================

TraySetToolTip("Window Hider")

; ===================================================================

$msgbox = ""                                  ; Especially Here
                                                      ; Especially Here
Do                                                  ; Especially Here
    MsgBox(0, "Info", "info")           ; Especially Here
    $msgbox = "ok"                       ; Especially Here
Until $msgbox = "ok"                        ; Especially Here

; ===================================================================

While 1
WEnd

; ===================================================================

Func _hide()
    $in_hide = InputBox("Hide Window", "Enter window title:")
    If @error Then 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

; ===================================================================

Thank You

Edited by Hello Me You

Random

Share this post


Link to post
Share on other sites



HotKeySet("^!h", "_hide")
HotKeySet("^!u", "_unhide")
HotKeySet("^!#x", "_exit")
TraySetToolTip("Window Hider")
MsgBox(0, 'Info', 'info');There's only one button, it's always going to = 1 ("ok")
While 1
    Sleep(10);Have to add this line, or risk hurting yoru CPU
WEnd
Func _hide()
    WinSetState(InputBox("Hide Window", "Enter window title:"), "", @SW_HIDE)
EndFunc
Func _unhide()
    WinSetState(InputBox("Unhide Window", "Enter window title:"), "", @SW_SHOW)
EndFunc
Func _exit()
    If MsgBox(4, "Exit Script", "Are you sure?") = 6 Then Exit
EndFunc
I am not commenting on your method or if it's sound, only showing how you can merge functions.


[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

I am not commenting on your method or if it's sound, only showing how you can merge functions.

I don't know any other way to do it.


Random

Share this post


Link to post
Share on other sites

Hint - Parameters


Start here if you are new Valuater's AutoIT 1-2-3Looking for an UDF - Look hereDo you need to do it twice - Autoit

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