Jump to content

Exiftool


tonse
 Share

Recommended Posts

I want to retrieve IPTC data from jpg files. I intend to use exiftool for that. My question is: How can i get the data into Autoit. Something Like:

$var = run(Exiftool -Tag IPTC:City)

Exiftool is an exe file. You can pass al lot of parameters to read or write properties to images

I know how to use exiftool, but i don't find a way to use it in autoit

Thanks Tonse

Link to comment
Share on other sites

Read about the function StdoutRead in the helpfile. There is an example too.

Or start your exe with comspec and >log.txt at the end, also

Run(@ComSpec & ' /c exiftool >log.txt', @ScriptDir)

Then you can read the data from log.txt.

PS

>>log.txt will append the text to the end

>log.txt will erase old text first

Edited by dwerf
Link to comment
Share on other sites

I want to retrieve IPTC data from jpg files. I intend to use exiftool for that. My question is: How can i get the data into Autoit. Something Like:

$var = run(Exiftool -Tag IPTC:City)

Exiftool is an exe file. You can pass al lot of parameters to read or write properties to images

I know how to use exiftool, but i don't find a way to use it in autoit

Thanks Tonse

Try like this ! Posted Image

#include <Constants.au3>

$_ExePath = @ScriptDir & '\exiftool.exe'
$_Run = '"' & $_ExePath & '"' & ' SpeedDial2.png'
ConsoleWrite ( '--------- $_Run : ' & $_Run & @Crlf )   
$_Pid = Run ( $_Run, '', @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD )
Dim $_StderrRead='', $_StdoutRead='', $_StdReadAll='', $_ProcessTimerInit = TimerInit ( )   

While ProcessExists ( $_Pid ) 
    $_StderrRead = StderrRead ( $_Pid )
    If Not @error And $_StderrRead <> '' Then 
        ;ConsoleWrite ( "STDERR read : " & $_StderrRead & @Crlf )   
        $_StdReadAll = $_StdReadAll & $_StderrRead & @CRLF
    EndIf
    $_StdoutRead = StdoutRead ( $_Pid )
    If Not @error And $_StdoutRead <> '' Then 
        ;ConsoleWrite ( "STDOUT read : " & $_StdoutRead & @Crlf )   
        $_StdReadAll = $_StdReadAll & $_StdoutRead & @CRLF
    EndIf   
    If Round ( TimerDiff ( $_ProcessTimerInit ) / 1000 ) > 3 And $_StdReadAll ='' Then 
        If ProcessExists ( $_Pid ) Then ProcessClose ( $_Pid )
        ExitLoop
    EndIf
    Sleep ( 10 )
Wend

ConsoleWrite ( '!>------- $_StdReadAll : ' & $_StdReadAll & @Crlf )

It gives output like :

!>------- $_StdReadAll : ExifTool Version Number : 8.33

File Name : SpeedDial2.png

Directory : .

File Size : 551 kB

File Modification Date/Time : 2010:10:04 10:01:13+02:00

File Permissions : rw-rw-rw-

File Type : PNG

MIME Type : image/png

Image Width : 1920

Image Height : 1080

Bit Depth : 8

Color Type : RGB

Compression : Deflate/Inflate

Filter : Adaptive

Interlace : Adam7 Interlace

Pixels Per Unit X : 2834

Pixels Per Unit Y : 2834

Pixel Units : Meters

Image Size : 1920x1080

+>23:19:08 AutoIT3.exe ended.rc:0

+>23:19:09 AutoIt3Wrapper Finished

>Exit code: 0 Time: 1.535

AutoIt 3.3.14.2 X86 - SciTE 3.6.0WIN 8.1 X64 - Other Example Scripts

Link to comment
Share on other sites

Thanks a lot so far.

I encounter a problem. If I add -IPTC:City to the Run command it returns only the IPTC City. But if i change that to anything else like: -IPTC:Location Then i don't get a value in return. ALthough i'm certain that IPTC Value is entered because i see it when i dont't add -IPTC to the Run command

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