How to port powershell script to XYplorer?

Discuss and share scripts and script files...
Post Reply
zBernie
Posts: 179
Joined: 08 Dec 2016 17:20

How to port powershell script to XYplorer?

Post by zBernie »

To make a long story short, I've gotten into two lengthy discussions in these forums regarding passing arguments to powershell scripts. I've received numerous answers, none of which work. But I do appreciate the help. The powershell script below runs fine from the command line. Can someone show me how to accomplish the same task using an XYplorer script?

-Thanks

Code: Select all

$jpgfiles = dir "C:\Users\bernie\Photo Staging\Date Stamp\*.jpg"
 
foreach ($jpgfile in $jpgfiles) {

    $file = Get-Item $jpgfile  # notice we do not use or want quotes in PowerShell
    $lwt = $File.LastWriteTIme

    convert "$jpgfile" -font Arial -pointsize 60 -fill lightblue -quality 100  -gravity southeast -auto-orient -annotate +80+50 %[exif:DateTimeOriginal] "$jpgfile"

    #Write-Host $jpgfile

    $file = Get-Item $jpgfile  # notice we do not use or want quotes in PowerShell
    $file.LastWriteTime = $lwt

}

highend
Posts: 13309
Joined: 06 Feb 2011 00:33

Re: How to port powershell script to XYplorer?

Post by highend »

Code: Select all

    $jpgFiles = quicksearch("*.jpg /n", "C:\Users\bernie\Photo Staging\Date Stamp", , "s");
    foreach($jpgFile, $jpgFiles, <crlf>, "e") {
        $lastModified = property("#date.modified", $jpgFile);
        $exifDate = get("exif", 0x0132, $jpgFile);
        status "Processing: " . gpc($jpgFile, "file") . "...";
        runret("""C:\Program Files\ImageMagick-7.0.8-Q16\convert.exe"" ""$jpgFile"" -font Arial -pointsize 60 -fill lightblue -quality 100 -gravity southeast -auto-orient -annotate +80+50 ""$exifDate"" ""$jpgFile""", "%TEMP%");
        timestamp "m", $lastModified, $jpgFile;
    }
One of my scripts helped you out? Please donate via Paypal

Post Reply