AutoHotkey Community

It is currently May 27th, 2012, 2:45 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 9 posts ] 
Author Message
PostPosted: November 24th, 2009, 6:26 am 
Offline

Joined: November 24th, 2009, 6:20 am
Posts: 10
I believe this is a very simple question (but obviously something difficult enough for me to ask for help since I'm new at all this).

I have in my AHK file something defined like this:

i1: SendInput, {Numpad7}
return

+^q::
SendInput {enter}top ms{enter}
return

i1 is defined as a variable somewhere else to be "t".

The problem comes because t is defined to send 7, the resultant text sent becomes 7op ms

Any help would be appreciated.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 24th, 2009, 6:40 am 
if i1 is a function, it should be
Code:
i1:
SendInput, {Numpad7}
return 

and u can use modifier symbol $ in front of the hotkey


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: November 24th, 2009, 6:43 am 
Offline

Joined: November 24th, 2009, 6:20 am
Posts: 10
Yup it is actually written as such, I forgotten to add the CR.

Are you telling me that I can just set it to:

Code:
$i1:
SendInput, {Numpad7}
return 


Because I did try that and the rest of the script failed for some reason or other. I think i1 is a variable defined somewhere else (I didn't write the script).

Anonymous wrote:
if i1 is a function, it should be
Code:
i1:
SendInput, {Numpad7}
return 

and u can use modifier symbol $ in front of the hotkey


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 24th, 2009, 6:45 am 
i1 is a function
u should be adding that to a hotkey, like
Code:
Hotkey, $a, i1
 


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: November 24th, 2009, 7:08 am 
Offline

Joined: November 24th, 2009, 6:20 am
Posts: 10
Hmm, I'm not really sure if I understand you, but the original script can be found at http://www.autohotkey.net/paste/1nn06xf - maybe you can decipher it better than me.

This script relies on reading a particular file, the relevant portion of which is set out below as well:

Code:
////////////////////////////////////////////////////
//                   Inventory                    //
////////////////////////////////////////////////////
// [item1]=t
// [item2]=y
// [item3]=g
// [item4]=h
// [item5]=b
// [item6]=n




Anonymous wrote:
i1 is a function
u should be adding that to a hotkey, like
Code:
Hotkey, $a, i1
 
[/code]


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 24th, 2009, 7:36 am 
which is this line:
Code:
Hotkey, %hotkey%, i%A_Index%, ON
 

u can change it to:
Code:
this_hotkey = $%hotkey%
Hotkey, %this_hotkey%, i%A_Index%, ON
 


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: November 24th, 2009, 7:48 am 
Anonymous wrote:
if i1 is a function, it should be
Code:
i1:
SendInput, {Numpad7}
return 

and u can use modifier symbol $ in front of the hotkey


PLEASE use the proper nomenclature. The above code is NOT A FUNCTION, it is a subroutine (also refered to as a "label"). A "Function" is a very different thing!
Calling a subroutine/label a function will only lead to confusing noobs. :roll:


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: November 24th, 2009, 8:06 am 
Offline

Joined: November 24th, 2009, 6:20 am
Posts: 10
Ah so basically we add an intermediary variable to add the $ inside? That seems to work :)

Anonymous wrote:
which is this line:
Code:
Hotkey, %hotkey%, i%A_Index%, ON
 

u can change it to:
Code:
this_hotkey = $%hotkey%
Hotkey, %this_hotkey%, i%A_Index%, ON
 


Thanks!!


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 24th, 2009, 8:07 am 
Offline

Joined: November 24th, 2009, 6:20 am
Posts: 10
As a noob, I was confused either way haha; but what I was more confused about is how come eeryone seems to show up as "Guest" rahter than with user accounts?

Can't quite follow who's saying what :P


Anonymous wrote:
Anonymous wrote:
if i1 is a function, it should be
Code:
i1:
SendInput, {Numpad7}
return 

and u can use modifier symbol $ in front of the hotkey


PLEASE use the proper nomenclature. The above code is NOT A FUNCTION, it is a subroutine (also refered to as a "label"). A "Function" is a very different thing!
Calling a subroutine/label a function will only lead to confusing noobs. :roll:


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 9 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: rbrtryn, XstatyK, Yahoo [Bot] and 21 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group