Sign in to follow this  
Followers 0
Guest kimbers

Call an AutoIT script with Parameters

5 posts in this topic

I am running an FTP script which contains values that are different for each machine the script runs on. I am trying to set up an INI file to hold these values, and in my FTP script call an AutoIt script to read in these values. How do I call the AutoIt script with parameters so that these values can then be used in my FTP script?!

I am not a particularly familiar batch programmer (I am an RPG programmer) so simple answers please!

thanks

Share this post


Link to post
Share on other sites



yourscript.exe "D:\A long pathname" var2

then in your script the vars will be:

%1% would equal D:\A long pathname

%2% would equal var2

see helpfile for more detail on subject:

Running AUTOIT which contains subject: Using Command Line Parameters at the bottom of the page.


Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

Thanks for reply...

Trouble is I am trying to get the AutIT script to get information from an INI file and then pass this information back to my Batch pgm in the parameters - unfortunately due to my lack of experience in this area I cant seem to get the info back to my batch pgm

my simple test script is:

Batch pgm:

c:\epos\up_value.exe var1 var2 var3 var4

echo off

echo var1 >c:\epos\log.txt

echo on

Pause

:endpgm

And my AutoIt script (up_value.exe) is:

IniRead, 1, c:\\epos\\values.ini, Company, Number

IniRead, 2, c:\\epos\\values.ini, Location, Store

IniRead, 3, c:\\epos\\values.ini, Location, Till

IniRead, 4, c:\\epos\\values.ini, CRM, Till_id

IniRead, 5, c:\\epos\\values.ini, Logon, Logdtl

MsgBox, 0, Example, Filename selected was %1%

I know it is getting the correct info from the ini file as the message box displays it correctly, but when control goes back to my batch pgm the info is not written out to the txt file. This must be the most simple of problems but we have not batch programming experience here!!!!

any suggestions?

Share this post


Link to post
Share on other sites

The ver3 helpfile states:

A environment variable set in this way will only be accessible to programs that AutoIt spawns (Run, RunWait).  Once AutoIt closes the variables will cease to exist.

So i guess its the same for Ver2.

Couldn't you have the up_value.exe script write the value to c:\epos\log.txt after reading it from the INI file ?


Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

If you are using Windows2000 or XP you can try it this way:

(Using CMD.EXE and not COMMAND.COM as shell => The batch programs must be named *.CMD and not *.BAT)

FOR /F " usebackq tokens=1,5 delims=; " %%i IN (`up_values.exe`) DO @echo %%i %%j %%k %%l %%m

:: and do what you want with the variables i to m

Your up_values.exe only has to printout the wanted values, delimited by an unique character (e.g. a semicolon).

Share this post


Link to post
Share on other sites
Sign in to follow this  
Followers 0