Sign in to follow this  
Followers 0
Xichael

Toggle between two functions with one hotkey...

4 posts in this topic

I'd like to write a script that will run one function upon pressing an assigned hotkey, then run a different function upon a second pressing. How would I achieve this?

Share this post


Link to post
Share on other sites



Global $det
HotKeySet('a', '_Function') 

While 1 
    Sleep(200)
WEnd 

Func _Function() 
    If $det then 
        _FuncOne()
    Else 
        _FuncTwo()
    EndIf 
    
    $det = Not $det 
EndFunc 

Func _FuncOne()
    Msgbox(0, '', 'Hello!')
EndFunc 

Func _FuncTwo() 
    Msgbox(0, '', 'Goodbye!')
EndFunc


My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list]

Share this post


Link to post
Share on other sites

Looks like im too late to post but well here it is....

HotKeySet("+!d", "multifunc")  ;Shift-Alt-d

Global $lastfunc = 0


While 1
    Sleep(25) ;take some off the cpu load...
WEnd


Func multifunc()
    If $lastfunc = 0  Or $lastfunc = 1 Then 
        func_2()
        $lastfunc = 2
    Else
        func_1()
        $lastfunc = 1
    EndIf
EndFunc

Func func_1()
    ConsoleWrite("Func 1..." & @CRLF)
EndFunc

Func func_2()
    ConsoleWrite("Func 2..." & @CRLF)
EndFunc

UDF:Crypter a file encrypt / decrypt tool with no need to remember a password again. Based on Caesar cipher using entire ASCII Table.Script's: PixelSearch Helper, quick and simple way to create a PixelSeach.Chatserver - simplified, not so complicated multi-socket server.AutoIT - Firewall, simple example on howto create a firewall with 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