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 

hotsring to call function

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



Joined: 30 Oct 2007
Posts: 13

PostPosted: Mon Nov 05, 2007 8:46 pm    Post subject: hotsring to call function Reply with quote

Is it possible to have a hotstring call an autohotkey function?
(how would this be coded?)

Thank you.
Back to top
View user's profile Send private message
engunneer



Joined: 30 Aug 2005
Posts: 6847
Location: Pacific Northwest, US

PostPosted: Mon Nov 05, 2007 8:59 pm    Post subject: Reply with quote

in general, yes - what do you want it to call?
_________________
Unless otherwise noted, all code is untested.
Common Answers: 1.(Loops, Viruses, etc.) 2. Search 3.RTFM
Back to top
View user's profile Send private message Visit poster's website
ManaUser



Joined: 24 May 2007
Posts: 906

PostPosted: Mon Nov 05, 2007 9:17 pm    Post subject: Reply with quote

Here's a simple example:
Code:
:*:test::
DoMsg("This is a test.")
return

DoMsg(Input)
{
   MsgBox %Input%
}

Or maybe you didn't really mean a function in the technical sense. In that case you just put whatever code you want in place of DoMsg("This is a test.") and omit the second part.
Back to top
View user's profile Send private message
Mountie



Joined: 30 Oct 2007
Posts: 13

PostPosted: Tue Nov 06, 2007 2:28 am    Post subject: Reply with quote

Thank you. I have it working now. I was trying to call a user defined function. My string was being expanded, but the UDF not being called. I believe it was because the call was on the same line as the hotstring.
Back to top
View user's profile Send private message
engunneer



Joined: 30 Aug 2005
Posts: 6847
Location: Pacific Northwest, US

PostPosted: Tue Nov 06, 2007 7:31 pm    Post subject: Reply with quote

Mountie wrote:
I believe it was because the call was on the same line as the hotstring.


That is correct, you can't have an autoreplace hotstring AND a function called.
_________________
Unless otherwise noted, all code is untested.
Common Answers: 1.(Loops, Viruses, etc.) 2. Search 3.RTFM
Back to top
View user's profile Send private message Visit poster's website
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