Jump to content

How to parse commandline parameter to autoit script


 Share

Recommended Posts

Hi,

I am new here. Just started to use AutoIT a week ago.

I want to write a script that query a DNG raw file and output its IPTC tag.

My script currently goes like this:

Global $DOS

$DOS = Run(@ComSpec & " /c exiftool -T -Headline d:\photo1.dng", @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD)

ProcessWaitClose($DOS)

$Message &= StdoutRead($DOS)

MsgBox(0, "Exif Data of Photo", $Message)

This works well.

But how do i make the script recognized the commandline parameter call d:\photo1.dng?

So ideally my script will be compiled to an executable say "exif.exe".

I want to run in command line window as "exif.exe d:\photo1.dng".

How do i make the script recognized that d:\photo1.dng is the parameter?

I have tried to integrate the variable $cmdline[1] into the equation but it is not working.

Appreciate some help please.

Thank you

Joseph

Link to comment
Share on other sites

Welcome to the Forum. This may help you - Command Line Parameters. So, $DOS = Run(@ComSpec & " /c exiftool -T -Headline d:\photo1.dng", @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD), would probably be $DOS = Run(@ComSpec & " /c exiftool -T -Headline " & $CmdLine[1], @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD)

Good luck!

- Bruce /*somdcomputerguy */  If you change the way you look at things, the things you look at change.

Link to comment
Share on other sites

Thanks Bruce. That solves it good.

I now need to introduce a -CSV parameter to the exiftool command and the output is something like this:

SourceFile,FileName,Headline,Description,Copyright

photo1.dng,photo1.dng,This is the Headline,This is the Description,John Doe

I am wondering if there is a way for stdout to skip the first output line and only read the 2nd line?

If that is doable, i will be able to use the StringSplit command to split the second lines into variables.

Thanks again.

Joseph

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