lua script for documents manger

General Moho topics.

Moderators: Víctor Paredes, Belgarath, slowtiger

User avatar
morteza
Posts: 8
Joined: Fri Jan 07, 2022 5:34 pm

Re: lua script for documents manger

Post by morteza »

Thank you so much. :D
User avatar
hayasidist
Posts: 3857
Joined: Wed Feb 16, 2011 8:12 pm
Location: Kent, England

Re: lua script for documents manger

Post by hayasidist »

synthsin75 wrote: Sat Jan 15, 2022 8:51 pm
1. Have the Lua script open all the files in Moho and launch the AHK script.
I know slightly less than diddly squat about what AHK can do ... but ... is it possible for AHK to run moho and open the files?

one "advantage" of Moho is that it opens a new tab (and doesn't start a new instance in a new window) when run many times from (e.g.) CMD>

so a loop in AHK of "run moho file<n>" will open tabs

===

or just an AHK loop of

(runwait) open the next file, run the LUA script, save the file, quit moho ??
User avatar
synthsin75
Posts: 10280
Joined: Mon Jan 14, 2008 11:20 pm
Location: Oklahoma
Contact:

Re: lua script for documents manger

Post by synthsin75 »

hayasidist wrote: Sun Jan 16, 2022 12:27 pm
synthsin75 wrote: Sat Jan 15, 2022 8:51 pm
1. Have the Lua script open all the files in Moho and launch the AHK script.
I know slightly less than diddly squat about what AHK can do ... but ... is it possible for AHK to run moho and open the files?

one "advantage" of Moho is that it opens a new tab (and doesn't start a new instance in a new window) when run many times from (e.g.) CMD>

so a loop in AHK of "run moho file<n>" will open tabs

===

or just an AHK loop of

(runwait) open the next file, run the LUA script, save the file, quit moho ??
Yes, AHK could open Moho and all the files. Then you'd just have it send the shortcut for the Lua script that adds the comp, saves, and closes the active tab for each file.
You'd either have to add enough wait time, between AHK sending the next Lua shortcut to account for the CPU being slow or busy, or you just have the Lua script invoke the AHK script again, once it's done with each file.

And to be fair, you could probably do the same with Python as you can with AHK.
User avatar
hayasidist
Posts: 3857
Joined: Wed Feb 16, 2011 8:12 pm
Location: Kent, England

Re: lua script for documents manger

Post by hayasidist »

synthsin75 wrote: Sun Jan 16, 2022 8:23 pm
Yes, AHK could open Moho and all the files. Then you'd just have it send the shortcut for the Lua script that adds the comp, saves, and closes the active tab for each file.
You'd either have to add enough wait time, between AHK sending the next Lua shortcut to account for the CPU being slow or busy, or you just have the Lua script invoke the AHK script again, once it's done with each file.

And to be fair, you could probably do the same with Python as you can with AHK.
Can AHK call another AHK script?
If so, could it use a "run and wait" to fire off the LUA?
Or maybe the LUA can set a "Done" flag that the AHK script can poll?
User avatar
synthsin75
Posts: 10280
Joined: Mon Jan 14, 2008 11:20 pm
Location: Oklahoma
Contact:

Re: lua script for documents manger

Post by synthsin75 »

hayasidist wrote: Mon Jan 17, 2022 1:56 pm Can AHK call another AHK script?
If so, could it use a "run and wait" to fire off the LUA?
Or maybe the LUA can set a "Done" flag that the AHK script can poll?
Yeah, AHK can call another AHK script, even passing arguments. You can even invoke an AHK script from Lua, passing arguments.
The problem with having an AHK script wait is that the wait time is guesswork. AHK can wait for a particular window to exist, close, etc., but not be able to tell that a program is done doing a particular task.

Lua can probably set a flag for AHK, but that's something I haven't got around to experimenting with yet. I'm already familiar with Lua starting an AHK script with arguments.


EDIT: But AHK can tell when the Moho window title changes. So as soon as the Lua script closes a file, AHK would know and could invoke the script again, on the next file in the list.
User avatar
hayasidist
Posts: 3857
Joined: Wed Feb 16, 2011 8:12 pm
Location: Kent, England

Re: lua script for documents manger

Post by hayasidist »

thanks Wes. all useful stuff for me and anyone else trying to gain an understanding of AHK
Post Reply