[working] Button for Stacking

Discuss and share scripts and script files...
Post Reply
Nando
Posts: 9
Joined: 15 Jun 2014 17:52

[working] Button for Stacking

Post by Nando »

Hello,
under linux I have a script (below).
I would like to get it under Windows with the help of XYplorer. It should be possible with right click or button.
Can someone help me?

what the script does:
- move selected files in folder with new name (eg IMG_7532-7539)
- stack files in the folder with combinezp
- move created file with date in filename in the parent directory (eg 2014-05-18_IMG_7532-7539.jpg)

bye,
Nando

script (right click)

Code: Select all

#!/bin/bash
# set -x
# PictoDir (CZP)

FULLNAME=$1
PATHNAME="${FULLNAME%/*}"
cd "$PATHNAME"
TMP_DIR="tmpdir"
rm -rf $TMP_DIR
mkdir $TMP_DIR

NEWNAME=""
LASTNAME=""
FILENAME=""
METAINFO=""

METAINFO="$(exiv2 "$FULLNAME" | grep 'Zeitstempel' | awk '{print substr($4,1,10)}' | sed -e s/:/-/g)"
FILENAMEWINE=$(winepath -w "$PATHNAME")
env WINEPREFIX="/home/vdr/.wine" wine "C:\Programme\CombineZP\CombineZP.exe" "${FILENAMEWINE}" "Align Do Stack" "${METAINFO}.jpg" -q +j100 -k


while [ "$1" != "" ] ; do
    FULLNAME=$1
    PATHNAME="${FULLNAME%/*}"
    FILENAME="${FULLNAME##*/}"

    if [ -f "$FULLNAME" ] ; then
       [ "$NEWNAME" = "" ] && NEWNAME="${FULLNAME%.*}"
       mv "$FULLNAME" "${TMP_DIR}/"
       #mkdir ${PATHNAME}/${TMP_DIR}
       #mv "$FULLNAME" "${PATHNAME}/${TMP_DIR}/"
       LASTNAME="${FILENAME%.*}"
    fi
    shift
done
[ "$LASTNAME" != "" ] && mv "$TMP_DIR" "${NEWNAME}-${LASTNAME#*_}"



FILENAME="${NEWNAME}-${LASTNAME#*_}"
FILENAME=$(echo "$FILENAME" | sed 's/.*\///')

mv "${FILENAME}" "${METAINFO}_${FILENAME}"
mv ${METAINFO}.jpg ${METAINFO}_${FILENAME}.jpg
exiftool -overwrite_original -DocumentName="${METAINFO}_${FILENAME}" "${METAINFO}_${FILENAME}"                                                                                                                                       
rm -r output
#qdbus org.kde.klipper /klipper setClipboardContents "${METAINFO}_${FILENAME}.jpg"
Last edited by Nando on 18 Nov 2014 22:04, edited 1 time in total.

Nando
Posts: 9
Joined: 15 Jun 2014 17:52

Re: [working] Button for Stacking

Post by Nando »

Hello,
I've tried it ... I succeeded.

It create a folder and move selected files to this folder (for example CRW_8277-8281).
Than it create the stacking picture with name of included pictures (for example CRW_8277-8281.jpg).

stack

Code: Select all

$SelectedItems = get("SelectedItemsNames", ",");
      $ITEMS = get("SelectedItemsPathNames", "|");
      $filename = regexreplace($SelectedItems, ".jpg([^;]*)_", "-");
      $foldername = regexreplace($filename, ".jpg", "");
      new ("$foldername", "dir"); 
      moveto "$foldername", "$ITEMS";

// Align Do Stack 
    $a = "D:\Programme\CombineZP\CombineZP.exe";
    $b = "<curpath>\$foldername";
    $c = "$filename";
    $d = "-q +j100 -k";
    run ( $a "$b" "Align Do Stack" "$c" $d);
This give more Information in the name of the Picture (creationtime, 2014-10-26_IMG_1002-1005.jpg, optionally the recording camera).

rename

Code: Select all

// selected list items
  foreach($token,<get SelectedItemsPathNames |>) {
//      $CamMod = property("CameraModel", $token);
      //trim space and tabs around the reported property:
//      $CamMod = regexreplace($CamMod, "\s*|\t*(.*)\s*|\t*", "$1");
      //echo $CamMod
        rename b, '<dateexif yyyy-mm-dd>_*', , $token;
     }
It needs CombineZP and an included macro (attachment).
If someone wants to use these scripts, I can describe it better.


best regards,
Nando
To see the attached files, you need to log into the forum.

Post Reply