Passing on Metadata as .txt in FullSwitch

Post Reply
Eivinde
Newbie
Posts: 1
Joined: Thu May 26, 2011 5:06 pm

Passing on Metadata as .txt in FullSwitch

Post by Eivinde »

I would like to pass off some metadata information for each PDF file that goes through a particular flow in FullSwitch.



In this case the client number and the number of pages in the document.



121_June15_qty600.pdf document as an example...



Using log job info configurator I can send the stats from client 121's PDF file using:



[Job.NameProper:Before=_] & then add text "pgs" & [Stats.NumberOfPages]



to result in 121pgs6



How do I get it to save out a .txt or .xml file with this same info to a specific folder?



121pgs6.txt
rzacherl
Member
Posts: 38
Joined: Mon Mar 21, 2011 3:29 pm

Passing on Metadata as .txt in FullSwitch

Post by rzacherl »

Hi,



as a FullSwitch user you can only use an "Execute command" flow element to make this working (a PowerSwitch user probably would use a small script package to solve this task).



Within a terminal session one would use the pipe mechanism to route the text into a newly created text file. Unfortunatelly this doesn't work directly in "Execute command" as the pipe symbol ">" is interpreted as a normal parameter. So you have to use a small shell script (Mac OS X) or Batch file (Win) which uses the pipe and which is feeded by two parameters handed over to it by" Execute command".



On Max OS X such a shell script could look like this:

#!/bin/bash

echo "$1" > "$2"



If you call this shell script (saved to executable file) within "Execute command" (Output: File in path, Output extension "txt") with this parameters



"Test" "%2"



you will find a new text file in its outgoing connection which contains the text "Test". Of course the static text "Test" can be replaced by any dynamic text information created with help of one or more Switch variables.



Regards,



Robert
rzacherl
Member
Posts: 38
Joined: Mon Mar 21, 2011 3:29 pm

Passing on Metadata as .txt in FullSwitch

Post by rzacherl »

Hi,



as a FullSwitch user you can only use an "Execute command" flow element to make this working (a PowerSwitch user probably would use a small script package to solve this task).



Within a terminal session one would use the pipe mechanism to route the text into a newly created text file. Unfortunatelly this doesn't work directly in "Execute command" as the pipe symbol ">" is interpreted as a normal parameter. So you have to use a small shell script (Mac OS X) or Batch file (Win) which uses the pipe and which is feeded by two parameters handed over to it by" Execute command".



On Max OS X such a shell script could look like this:

#!/bin/bash

echo "$1" > "$2"



If you call this shell script (saved to executable file) within "Execute command" (Output: File in path, Output extension "txt") with this parameters



"Test" "%2"



you will find a new text file in its outgoing connection which contains the text "Test". Of course the static text "Test" can be replaced by any dynamic text information created with help of one or more Switch variables.



Regards,



Robert
Post Reply