Jump to content

Need help for the simplest script in the world


heyvern
 Share

Recommended Posts

First off don't hit me if I am asking a silly question. This must be the simplest request ever. Because it is so simple it is difficult to weed out a working solution from the forum through basic searches.

------

I use a commercial animation application that has built in lua scripting. I am creating a "recent document" list in that program using lua and sending the "start" command to the windows command prompt to open files. Works like a charm. Easy, no problems. It will launch recent files from paths stored in the programs preferences and listed in a pull down menu. Works great on the Mac version.

However the problem is that the Windows version of this animation program always launches a new instance when opening files or launching through the command prompt. There is no way around this.

-----------

All I need is a teeny weeny itsy bitys Autoit script that will receive the paths from this application through the command prompt and redirect that path to the "Open File..." dialog of the already running instance of the animation program. This must run through the command prompt because all I have access to with lua from the other app is os.execute and the "start" command.

Things that I've got working in Autoit:

Can open any app through the lua os.execute

I know the exact title of the of the window of the open app.

I can send the file path to the command prompt.

I can "send" CTRL+O to the animation application from Autoit.

After that... things get a bit fuzzy for me.

Info/help I need:

Getting the path string from the command prompt to my Autoit script so it can then send it BACK to the "Open File..." window in the animation application.

-----

This script can't possibly be more than a few lines long when it's done. Thanks for any advice... even just a link or a vague reference to some section of the help to look at first. I love code snippets and copy/paste. :mellow:

-vern

Link to comment
Share on other sites

Hi,

you have a DosBox and need a string out of it?

Mega

Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Link to comment
Share on other sites

Command Line Parameters

The special array $CmdLine is initialized with the command line parameters passed in to your AutoIt script. Note the scriptname is not classed as a parameter; get this information with @ScriptName instead. A parameter that contains spaces must be surrounded by "double quotes". Compiled scripts accept command line parameters in the same way.

$CmdLine[0] is number of parameters

$CmdLine[1] is param 1 (after the script name)

$CmdLine[2] is param 2 etc

...

$CmdLine[$CmdLine[0]] is one way to get the last parameter...

So if your script is run like this:

AutoIt3.exe myscript.au3 param1 "this is another param"

$CmdLine[0] equals... 2

$CmdLine[1] equals... param1

$CmdLine[2] equals... this is another param

@ScriptName equals... myscript.au3

In addition to $CmdLine there is a variable called $CmdLineRaw that contains the entire command line unsplit, so for the above example:

$CmdLineRaw equals... myscript.au3 param1 "this is another param"

If the script was compiled it would have been run like this:

myscript.exe param1 "this is another param"

$CmdLineRaw equals... param1 "this is another param"

Note that $CmdLineRaw just return the parameters.

Hope this helps.
Link to comment
Share on other sites

Thanks Juvigy. I think the "CmdLine" is what I am after. That will point me in the right direction. I just need to figure out how to enter the path into the Open File... dialog. Probably sending the tab key and then pasting should do it. I can experiment.

if it is 'the simplest script in the world' than try to figure it out yourself. :mellow:

I absolutely deserve and expected that response. :)

I know how annoying it is when a noobie asks for easy answers. I've slapped down a bunch of those myself on other forums where I'm more "committed" to the software. ;)

To elaborate, I not a Windows kind of guy. More of a Mac guy. I use a very few applications on Windows and that's it. Most times I use my PC to watch TV while working on the Mac ;). I don't expect to use Autoit beyond this one situation to be perfectly honest. It looks cool, it has some great potential... but I'm spread thin already. I write custom tools in lua for another application. The scripting and tools for this animation application are 100% cross platform. Usually the tools I create work fine on Mac, Windows, linux without complex modifications (line enders or paths).

This situation with multiple instances of the application was unique for the Windows version and required an alternate solution (if one even existed. Lord knows I spent enough time studying the command prompt options before I found out there WAS no solution). If I had to spend hours or days searching and learning Autoit, it wouldn't have been worth the effort to me. I could just use the Mac version and be done with it. This is a very short diversion for me. For all I know the next version of this animation program will have a recent document list. Didn't want to spend days or weeks working on it.

In looking for a solution, Autoit and several other programs popped up. I chose Autoit for the "exe" option which I can include with my tool script. Thought I would give a shot at a "fast easy" answer. I have given the "RTFM" to noobies myself... but <sigh> when in a good mood I sometimes give them the easy solution as well. :(

-vern

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...