 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
Logman
Joined: 19 Feb 2008 Posts: 55
|
Posted: Mon Jun 16, 2008 5:04 pm Post subject: GUI edit/ .ini question |
|
|
Hi,
I have always used a hotkey by editing my script and changing keys like so-
NumpadMult::
if (Hotkeys)
FunctionName(getid())
return
But other people are going to use it so I made a GUI with an edit to enter the keys. I have got the script gathering the edit information and submitting the keys to an .ini once they are typed in by pressing a button on the GUI. But I can't work out how I get the script to read the keys (in the example NumpadMult) from the .ini when the NumpadMult button is pressed. Can I make a command along the lines of-
Key is hit(numpadmult)
.ini is read and key matches
if (Hotkeys)
FunctionName(getid())
return
Thanks. |
|
| Back to top |
|
 |
PurloinedHeart
Joined: 04 Apr 2008 Posts: 209 Location: Canada
|
Posted: Mon Jun 16, 2008 5:13 pm Post subject: |
|
|
| Get the key from the ini and give a variable it's value. When you press the key, compare the key you're pressing with the variable |
|
| Back to top |
|
 |
Logman
Joined: 19 Feb 2008 Posts: 55
|
Posted: Tue Jun 17, 2008 5:10 am Post subject: |
|
|
I keep getting some part of it wrong, can't work out which-
| Code: |
Gui, Add, CheckBox, x243 y10 w110 h20 vHotkeys gHotkeys, Enable Hotkeys
Gui, Add, Edit, x16 y100 w80 h20 vMyKey
Gui, Add, Button, x236 y103 w100 h20 gSubmitHotkeys, Submit Hotkeys
SubmitHotkeys:
Gui, Submit, NoHide
IniWrite, %MyKey% , MyFile.ini, Hotkeys, My Hotkey is
So the .ini is there and the key is in it, but then when I press the key I just get the doink, error sound.....
IniRead, MyKey, MyFile.ini, Hotkeys, %Key1%
;start process
if %Key1%
if (Hotkeys)
Process(getid())
return
|
[Moderator's Note: Please use code tags]
I guess that last part is wrong, can someone show me the correct way to do that please.  |
|
| Back to top |
|
 |
Logman
Joined: 19 Feb 2008 Posts: 55
|
Posted: Tue Jun 17, 2008 7:33 am Post subject: |
|
|
| PurloinedHeart wrote: | | Get the key from the ini and give a variable it's value. When you press the key, compare the key you're pressing with the variable |
Ok, worked it out, thanks for the help  |
|
| Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|