Jump to content

Hotkeyset help


Recommended Posts

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.

Link to comment
Share on other sites

$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
Link to comment
Share on other sites

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
Link to comment
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
 Share

  • Recently Browsing   0 members

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