Sign in to follow this  
Followers 0
NegativeNrG

Hotkeyset help

6 posts in this topic

Im having problems with hotkeyset() function.

For example

$input = Inputbox("Assign a hotkey","Input your hotkey to be set")
if $input = "F1" Then
Hotkeyset("{F1}","click")
if $input = "F2" Then
Hotkeyset("{F2}","click")
If $input = "F3" Then
Hotkeyset("{F3}","click")

This script is jsut an example. my real script has GUIs and stuff.

now when i press button1 it opens up a inputbox and i enter F1 so then it assigns it to F1 as a hotkey.

now when i press button1 again to assign a new hotkey i enter F2. BUT F1 key still works.

and when i assign it to F3 F1 and F2 still works.

any solutions?


[size=20]My File Upload[/size]Register at my site and upload.

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

$Input = Inputbox("Assign a hotkey","Input your hotkey to be set")
If @Error = 0 Then 
   If IsDeclared('Buffer') <> 0 Then HotKeySet("{" & $Buffer & "}")
   HotKeySet("{" & $Input & "}", "Click")
   $Buffer = $Input
EndIf

First it tests is $Input box actually returned something and was not canceled. If it is, then It unbinds the previous hotkey as according to buffer, and binds a new one according to your input.

Edited by AutoIt Smith

Share this post


Link to post
Share on other sites

Thanks A bunch Smith, it does work nicely.


[size=20]My File Upload[/size]Register at my site and upload.

Share this post


Link to post
Share on other sites

argh, i have another problem,

i have:

2 buttons(set hotkey1 and set hotkey2)

when i assign a hotkey to Button1 and Button2 only Button2 works, but Button 1 doesnt and if i assign a hotkey to Button2 first, Then Button1, Button1 works but not Button2

Any Solutions?


[size=20]My File Upload[/size]Register at my site and upload.

Share this post


Link to post
Share on other sites

I don't understand, isn't that what you wanted?

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

maybe you should do 2 inputboxes

if $input <> "" then hotkeyset("{"&$input&"}", "")
$input = Inputbox("Assign a hotkey","Input your hotkey to be set")
if $input = "F1" Then Hotkeyset("{F1}","click")
if $input = "F2" Then Hotkeyset("{F2}","click")
if $input = "F3" Then Hotkeyset("{F3}","click")
if $secinput <> "" then hotkeyset("{"&$secinput&"}", "")
$secinput = Inputbox("Assign second hotkey","Input your hotkey to be set")
if $secinput = "F1" Then Hotkeyset("{F1}","click2")
if $secinput = "F2" Then Hotkeyset("{F2}","click2")
if $secinput = "F3" Then Hotkeyset("{F3}","click2")

maybe this is helping you

Edited by Nuffilein805

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