AutoHotkey Community

It is currently May 26th, 2012, 10:15 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 2 posts ] 
Author Message
PostPosted: October 24th, 2008, 6:08 am 
Offline

Joined: October 24th, 2008, 5:59 am
Posts: 2
I have been writing a few AHK scripts which automate tasks within a GUI, and they work wonderfully. However, I need to launch the scripts from a python controller. For the life of me, I can't figure out how to get the two programs to communicate with each other beyond writing to a temporary file and reading out the contents. Obviously, this is less than ideal- has anyone else built something like this that works?


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 24th, 2008, 6:40 am 
Offline

Joined: October 24th, 2008, 5:59 am
Posts: 2
I'll answer my own question in case anyone else needs to do the same thing-

Its possible to write to stdout in AHK using the scheme:

FileAppend, text, *

On the python side, the AHK script should be called using the subprocess module like so:

p=subprocess.Popen(r'"C:\program files\AutoHotkey\AutoHotkey.exe" "your_script.ahk"', stdout=subprocess.PIPE)

then, you can access stdout via
p.stdout.read()

Don't forgot to close it too to clean everything up p.stdout.close() :)


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

All times are UTC [ DST ]


Who is online

Users browsing this forum: Bing [Bot], xXDarknessXx and 9 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