Send python command

Get help with using AutoHotkey and its commands and hotkeys
Joefango
Posts: 21
Joined: 05 Mar 2016, 07:36

Send python command

10 Jun 2016, 11:57

Hello,

I'm using blender a lot and I would like to know if it will be possible to send command/script to it with autohotkey. Blender use python and this is the command I would like to send to:

Code: Select all

bpy.context.object.show_x_ray = True
User avatar
waetherman
Posts: 112
Joined: 05 Feb 2016, 17:00

Re: Send python command

11 Jun 2016, 12:03

Can't you open a console or something in Blender?
http://blenderartists.org/forum/archive ... 53236.html

Once you have the shortcut, you can simulate it in AHK. You could also make AHK script to click on the menu elements to open the console, or to press ALT key to highlight menu shortcuts and then press appropriate letters.

Once the console is open you can type the code there, also using AHK.
Image
Joefango
Posts: 21
Joined: 05 Mar 2016, 07:36

Re: Send python command

11 Jun 2016, 13:54

That's an idea but I find it not very convevient, I would like something more powerful like dll call or COM Oject or anything else that don't need to open the console, send text, active previous window,etc... thanks for reply

Any other suggestion ?
User avatar
tidbit
Posts: 1181
Joined: 29 Sep 2013, 17:15
Location: USA

Re: Send python command

11 Jun 2016, 14:53

that would only work if blender has implemented COM support or some dll/cmd parameter stuff for other programs to use. for the years I've used blender, I don't think I've seen or heard of any such thing.
rawr. fear me.
*poke*
Is it December 21, 2012 yet?
lexikos
Posts: 7085
Joined: 30 Sep 2013, 04:07
GitHub: Lexikos

Re: Send python command

11 Jun 2016, 22:51

I don't know about Blender, but if it runs Python scripts, I suppose that you could create a COM server in Python and access it from AutoHotkey. For example, pythoncom.RegisterActiveObject + ComObjActive. (I suppose that you would need to create a class extending PyIUnknown, but that's just an educated guess. I don't use Python.)

Another option might be AutoHotkey.dll. I'm pretty sure there are examples on the forums for using it from Python.

Return to “Ask For Help”

Who is online

Users browsing this forum: Dante, Lem2001, mikeyww, nestea2k, pgarza, songdg and 50 guests