Jump to content
Sign in to follow this  
AlmarM

HotKeySet() Example for the beginners ^^

Recommended Posts

AlmarM

I made a HotKeySet() Example (I was bored ^^)

Source:

#comments-start
Made by: AlmarM

Example Script for:
            HotKeySet()

Hope u enjoy ^^
#comments-end

$Site_1 = InputBox("Site 1", "Witch site you want to bind on SHIFT + 1 ?")
$Site_2 = InputBox("Site 2", "Witch site you want to bind on SHIFT + 2 ?")
$Site_3 = InputBox("Site 3", "Witch site you want to bind on SHIFT + 3 ?")
$Site_4 = InputBox("Site 4", "Witch site you want to bind on SHIFT + 4 ?")
$Site_5 = InputBox("Site 5", "Witch site you want to bind on SHIFT + 5 ?")

HotKeySet("{ESC}", "_Exit") ;If you press ESC the script will stop
HotKeySet("+{F1}", "_ShowSite") ;If you press SHIFT + F1, the script will show witch sites you have on witch keys
HotKeySet("+1", "_Site1") ;If you press SHIFT + 1, the script activates _Site1()
HotKeySet("+2", "_Site2") ;If you press SHIFT + 2, the script activates _Site2()
HotKeySet("+3", "_Site3") ;If you press SHIFT + 3, the script activates _Site3()
HotKeySet("+4", "_Site4") ;If you press SHIFT + 4, the script activates _Site4()
HotKeySet("+5", "_Site5") ;If you press SHIFT + 5, the script activates _Site5()

While 1
Sleep(100)
WEnd

Func _Exit()
Sleep(100)
Exit
EndFunc ;==> _Exit()

Func _ShowSite()
TrayTip("Sites:", "SHIFT + 1: " & $Site_1 & @CRLF & "SHIFT + 2: " & $Site_2 & @CRLF & "SHIFT + 3: " & $Site_3 & @CRLF & "SHIFT + 4: " & $Site_4 & @CRLF & "SHIFT + 5: " & $Site_5, 5)
EndFunc ;==> _ShowSite()

Func _Site1()
Run("cmd /c start " & $Site_1, "", @SW_HIDE)
EndFunc ;==> _Site1

Func _Site2()
Run("cmd /c start " & $Site_2, "", @SW_HIDE)
EndFunc ;==> _Site2

Func _Site3()
Run("cmd /c start " & $Site_3, "", @SW_HIDE)
EndFunc ;==> _Site3

Func _Site4()
Run("cmd /c start " & $Site_4, "", @SW_HIDE)
EndFunc ;==> _Site4

Func _Site5()
Run("cmd /c start " & $Site_5, "", @SW_HIDE)
EndFunc ;==> _Site5

Minesweeper

A minesweeper game created in autoit, source available.

_Mouse_UDF

An UDF for registering functions to mouse events, made in pure autoit.

2D Hitbox Editor

A 2D hitbox editor for quick creation of 2D sphere and rectangle hitboxes.

Share this post


Link to post
Share on other sites
gseller

Sweet! That is a nice example...

Share this post


Link to post
Share on other sites
jvanegmond

The example is bad and redundant.

It's complexity does not weigh up to it's understandability. (Spell check did not gave me any errors here.. so..)

Edited by Manadar

Share this post


Link to post
Share on other sites
icadea

thanks for the script

Share this post


Link to post
Share on other sites
AlmarM

The example is bad and redundant.

It's complexity does not weigh up to it's understandability. (Spell check did not gave me any errors here.. so..)

Whats so bad about it ?

And thanks for saying its a "sweet" example :P


Minesweeper

A minesweeper game created in autoit, source available.

_Mouse_UDF

An UDF for registering functions to mouse events, made in pure autoit.

2D Hitbox Editor

A 2D hitbox editor for quick creation of 2D sphere and rectangle hitboxes.

Share this post


Link to post
Share on other sites
jvanegmond

Whats so bad about it ?

And thanks for saying its a "sweet" example :P

First of all, you can make an example that has just a few lines that also illustrates how HotkeySet() works exactly. This example is found in the help file:

Global $Paused
HotKeySet("{PAUSE}", "TogglePause")
HotKeySet("{ESC}", "Terminate")
HotKeySet("+!d", "ShowMessage")  ;Shift-Alt-d

;;;; Body of program would go here ;;;;
While 1
    Sleep(100)
WEnd
;;;;;;;;

Func TogglePause()
    $Paused = NOT $Paused
    While $Paused
        sleep(100)
        ToolTip('Script is "Paused"',0,0)
    WEnd
    ToolTip("")
EndFunc

Func Terminate()
    Exit 0
EndFunc

Func ShowMessage()
    MsgBox(4096,"","This is a message.")
EndFuncoÝ÷ Ù8b±ìZ^z÷§«Á¬­¢®±è§Ü!Èb±ª®zËb¢z^¢^¡û^«${axg§z¶¥éijwRºh®Ñh®éÊ2¢êÞÅ©©è¬m§[yÆ®±ëaÇhzËazƦzØb®¶­sdFÒb33c¶ÒÂb33cµ6FU³UФf÷"b33c¶ÒFò@ b33cµ6FU²b33c¶ÒÒçWD&÷gV÷Cµ6FRgV÷C²fײb33c¶³ÂgV÷Cµv66FRFò÷RvçB÷B&æBöâ4eB²gV÷C²fײb33c¶³fײgV÷C²ògV÷C² bW'&÷"FVâWDÆö÷¤æW@ ¤÷D¶W6WBgV÷C·´U47ÒgV÷C²ÂgV÷CµôWBgV÷C²´b÷R&W72U42FR67&BvÆÂ7F÷¤÷D¶W6WBgV÷C²·´cÒgV÷C²ÂgV÷Cµõ6÷u6FRgV÷C²´b÷R&W724eB²cÂFR67&BvÆÂ6÷rvF66FW2÷RfRöâvF6¶W0¤f÷"b33c¶ÒFò@ ÷D¶W6WBgV÷C²²gV÷C²fײb33c¶³ÂgV÷Cµõ6FRgV÷C²¤æW@ ¥vÆR 6ÆVW¥tVæ@ ¤gVæ2ôWB W@¤VæDgVæ2³ÓÒfwC²ôWB ¤gVæ2õ6÷u6FR Æö6Âb33c·5&WGW&à f÷"b33c¶ÒFò@ b33c·5&WGW&âf׳ÒgV÷Cµ4eB²gV÷C²fײb33c¶²fײgV÷C³¢gV÷C²fײb33cµ6FU²b33c¶Òfײ5$Ä` æW@ G&FgV÷Cµ6FW2gV÷C²Âb33c·5&WGW&âÃR¤VæDgVæ2³ÓÒfwC²õ6÷u6FR ¤gVæ2õ6FR 'VâgV÷C¶6ÖBö27F'BgV÷C²fײb33cµ6FUµ7G&æuG&ÔÆVgB÷D¶W&W76VBÃÓÒÂgV÷C²gV÷C²Â5uôDR¤VæDgVæ2³ÓÒfwC²õ6F

Now, THAT is an example. ;)

Share this post


Link to post
Share on other sites
FreeFry

First of all, you can make an example that has just a few lines that also illustrates how HotkeySet() works exactly. This example is found in the help file:

...

Nice examples. I liked the OP's example too, it demonstrates the less complicated way to HotKeySet. muttley

But what's with the "witch" keys? :)

Edited by FreeFry

Share this post


Link to post
Share on other sites
jvanegmond

Nice examples. I liked the OP's example too, it demonstrates the less complicated way to HotKeySet. muttley

But what's with the "witch" keys? :)

ROFL. xD

Must be my dyslexia playing up again.

Share this post


Link to post
Share on other sites
FreeFry

Ow, damn. muttley

Share this post


Link to post
Share on other sites
AlmarM

Nice examples. I liked the OP's example too, it demonstrates the less complicated way to HotKeySet. muttley

But what's with the "witch" keys? :)

Haha, I was bad in english when I wrote that :(

Now I know its which :P

-AlmarM-


Minesweeper

A minesweeper game created in autoit, source available.

_Mouse_UDF

An UDF for registering functions to mouse events, made in pure autoit.

2D Hitbox Editor

A 2D hitbox editor for quick creation of 2D sphere and rectangle hitboxes.

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  

×