Jump to content

Newbie Question


Recommended Posts

I have never had a call to use windows automation scripting programs before but I now do, and I am wondering if it is possible to pass parameters to AutoIT.exe files? In particular, I need to pass URL, user name, password that change and will be stored in a Filemaker database for logon to a secure web site. I must also navagate through the site a bit, enter some search criteria (constant) and download files to the hard drive, move them around and rename. That all appears simple enough with AutoIT but I'm not sure about passing the variable parameters.

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"

Link to comment
Share on other sites

Thank you for the reply. Please forgive my ignorance, but where does the command line data come from? How would I get that info from the DB table or field into the command line (if thats even what happens?)?

Link to comment
Share on other sites

If you are attempting to pull the data from filemaker, use a COM object from filemaker to open the table and search for the data.

You can also write a "script" in filemaker that gets the information then launches an external program ( your autoit program ) with the parameters

"yourprogram.exe url id pw"

Link to comment
Share on other sites

One way you could accomplish this is use a little tool called sqlcmd.exe and write one script to query the database for the needed information and then to run the other script with those options.

I dont really see the need for 2 scripts. If you are going to query the database may as well just use the same script to keep going.

EDIT: Yes if you get the latest AutoIt Beta version you can use COM objects to also get what you want from filemaker. It is up to you. The COM objects would eventually write the same SQL you would, but just using an interface. Using the SQL you would never have to really 'open' the database.

JS

Edited by JSThePatriot

AutoIt Links

File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out.

ComputerGetInfo UDF's Updated! 11-23-2006

External Links

Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)

Link to comment
Share on other sites

OK, thank you. If I understand correctly the command line is the message I will send to the AutoIT script to initialize. It would be pretty easy to script the parameters into the message from FM. Probably easier than using SQL. With a few logical statements in the AutoIT script, it should be possible to create one script.exe that will perform multiple tasks depending on the command line data. Is this correct? Something like-

'IF param 1 = 1; insert param 2 here; param 3 here; then do task 1' else

'IF param 1 = 2; insert param 2 here; param 3 here; then do task 2' etc.

I know this is not the proper language but I still have to learn that. Am I at least on the right track?

Link to comment
Share on other sites

Yes that is the basic reason for your application being able to recieve input. You have a basic idea of what is supposed to happen. Just start in the helpfile. It is the most extensive helpfile I have ever seen so if you cant find something in there or cant figure it out ask :(

JS

AutoIt Links

File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out.

ComputerGetInfo UDF's Updated! 11-23-2006

External Links

Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)

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...