Search found 1131 matches

by freddyp
Tue Jul 27, 2021 8:31 am
Forum: LEGACY scripting
Topic: How to parse XML Response from Chili Publish API in Switch Legacy Scripter
Replies: 2
Views: 8235

Re: How to parse XML Response from Chili Publish API in Switch Legacy Scripter

There is not. You have to place the output in a temporary file and then load that: var response = new ByteArray( "it is a ByteArray when coming in as an HTTP response"); var tempPath = job.createPathWithName( "response.xml"); File.writeByteArray( tempPath, response); var xml = ne...
by freddyp
Thu Jul 22, 2021 8:56 am
Forum: Applications
Topic: Curl Execute Command
Replies: 4
Views: 8088

Re: Curl Execute Command

For longer and more complex commands it is recommended to use a .bat file. Place the command in a .bat file and in "Command or path" point to that file. In order to get the JSON output into a file you must specify an output file and the path to the output file has to come from Switch as a ...
by freddyp
Tue Jul 20, 2021 9:17 am
Forum: LEGACY scripting
Topic: HTTP Script help
Replies: 1
Views: 6477

Re: HTTP Script help

I do not think you have to script it. Create a JSON file with the app "Make JSON" and post that with the "HTTP request" element. The attached file is [Job.Path] and the two headers go into the "Headers" property of course. When you attach the return JSON as a dataset yo...
by freddyp
Tue Jul 13, 2021 9:02 am
Forum: Node.js scripting
Topic: Create and move file
Replies: 1
Views: 3846

Re: Create and move file

You are missing some insights in the fundamentals of Switch scripting and especially the part about how to create temporary files and send those to the outgoing connection. Have a look at https://github.com/EnfocusSW/HotFolderMonitor . At the end of that sample script you will see how to do that. An...
by freddyp
Thu Jul 01, 2021 11:31 am
Forum: Flows
Topic: Add data to the description metadata of a pdf
Replies: 22
Views: 36454

Re: Add data to the description metadata of a pdf

Erik's reply is spot on.

The only thing I want to contribute here is to point out that "XMP inject" is a somewhat misleading name. Yes, it can inject an entirely new XMP into a PDF, but it can also just update the XMP: it is a choice on the "Action" property of the element.
by freddyp
Thu Jul 01, 2021 10:34 am
Forum: Node.js scripting
Topic: NodeJs Skips Sqlite query
Replies: 4
Views: 6458

Re: NodeJs Skips Sqlite query

It is the case, you do use a callback function! The third parameter of db.run, starting at function(err) { up until the closing curly bracket before ); is a callback function. If this is not clear have a look at the webinar or read about the differences between using callbacks and promises. And also...
by freddyp
Wed Jun 30, 2021 9:15 am
Forum: Node.js scripting
Topic: NodeJs Skips Sqlite query
Replies: 4
Views: 6458

Re: NodeJs Skips Sqlite query

It is definitely not a case of Switch blocking anything! This sounds a lot like the use of a callback versus a promise that is awaited. https://forum.enfocus.com/viewtopic.php?f=26&t=3835&p=12034&hilit=use+promises#p12034 And if you are interested in watching the webinar Laurent and I ga...
by freddyp
Wed Jun 30, 2021 8:58 am
Forum: Node.js scripting
Topic: flowElement.getJobs() and invalid job ID
Replies: 2
Views: 3940

Re: flowElement.getJobs() and invalid job ID

I did not think of a user deleting a file behind your back because then indeed you will have an id in global data, but not in getJobs(). I tested it with the code from the documentation. The only thing I did was to reduce the timer interval to 5 seconds and the time-out period to 30 seconds and I ad...
by freddyp
Fri Jun 25, 2021 12:56 pm
Forum: Applications
Topic: Create InDesign Package
Replies: 6
Views: 19498

Re: Create InDesign Package

If you use $infile you get the name without the prefix.

Code: Select all

var fileName = $filename.replace(".indd",".idml");
$doc.exportFile("InDesign Markup (IDML)",$outfolder+"/"+fileName);
$outfiles = [];
$outfiles.push($outfolder+"/"+fileName);
by freddyp
Tue Jun 22, 2021 8:33 am
Forum: Applications
Topic: Warning level connection for Illustrator element for missing fonts
Replies: 3
Views: 6714

Re: Warning level connection for Illustrator element for missing fonts

You should not separate the log from the AI file, I just had not thought of the fact that the AI configurator has a "Data with Log" output. That is of course better. Your solution is perfectly fine.
by freddyp
Mon Jun 21, 2021 8:50 am
Forum: Flows
Topic: Name "job folder name" in "Assemble Job" from one of the files?
Replies: 1
Views: 3743

Re: Name "job folder name" in "Assemble Job" from one of the files?

Have a look at what the variable [Job.NestedName] can do for you. Perhaps you can get hold of that particular filename by using a certain "Action-Index". If you can, store it in private data and then add two other pieces of private data, one "Before - _C_" of that first private d...
by freddyp
Mon Jun 21, 2021 8:40 am
Forum: Flows
Topic: Sort folder based on filename inside the folder?
Replies: 1
Views: 3815

Re: Sort folder based on filename inside the folder?

Have a look at what the variable [Job.NestedName] can do for you in a condition with variables so you can separate the job folders with a file containing _Lex_ inside and the ones without. [Job.NestedName] returns all the filenames in the job folder so you can check whether there is a filename that ...
by freddyp
Thu Jun 17, 2021 8:25 am
Forum: Flows
Topic: Count value of PDFs on top level of job folder
Replies: 2
Views: 3893

Re: Count value of PDFs on top level of job folder

Using the app Filetypes Counter is the correct approach: it has a property "Subfolder levels". The default is "All", but it has the option "Root level only". There is even a "Custom" option that allows you to specify from what level to what level you want to c...
by freddyp
Wed Jun 16, 2021 4:34 pm
Forum: Applications
Topic: Warning level connection for Illustrator element for missing fonts
Replies: 3
Views: 6714

Re: Warning level connection for Illustrator element for missing fonts

You have 2 outgoing connections, one for Data (Success and Error) and one for Log (Success and Error). Make sure that both the Success and Error connections go to the same output connection (if the Error one is missing the job ends up in Problem jobs, you do not want that). The Data folder will have...
by freddyp
Tue Jun 15, 2021 10:59 am
Forum: Applications
Topic: Validating mailing data
Replies: 1
Views: 3988

Re: Validating mailing data

There are two address validation tools for which there is a configurator in Switch: Accuzip and Firstlogic. Filter the flow elements with the keyword "mail" and you will find them. Right-click on the configurators in the Flow Elements pane and open the documentation. There you will find mo...