AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

GUI edit/ .ini question

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
Logman



Joined: 19 Feb 2008
Posts: 55

PostPosted: Mon Jun 16, 2008 5:04 pm    Post subject: GUI edit/ .ini question Reply with quote

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
View user's profile Send private message
PurloinedHeart



Joined: 04 Apr 2008
Posts: 209
Location: Canada

PostPosted: Mon Jun 16, 2008 5:13 pm    Post subject: Reply with quote

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
View user's profile Send private message
Logman



Joined: 19 Feb 2008
Posts: 55

PostPosted: Tue Jun 17, 2008 5:10 am    Post subject: Reply with quote

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. Smile
Back to top
View user's profile Send private message
Logman



Joined: 19 Feb 2008
Posts: 55

PostPosted: Tue Jun 17, 2008 7:33 am    Post subject: Reply with quote

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 Wink
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group