Search found 1024 matches

by freddyp
Fri Oct 11, 2019 10:36 am
Forum: LEGACY scripting
Topic: Using JS To Add Email Addresses
Replies: 6
Views: 13265

Re: Using JS To Add Email Addresses

You are on the right track. The only thing you still have to do is to send the job to the output folder. In your case a single output connection will be enough, so in the properties of the script you define it as having just one output connection and the end of the jobArrived function you add: job.s...
by freddyp
Mon Oct 07, 2019 8:59 am
Forum: Flows
Topic: Encode a jpg file -> Base64
Replies: 3
Views: 5634

Re: Encode a jpg file -> Base64

It is a bit safer (because there is no encoding involving) and certainly more efficient to use

Code: Select all

var imgContents = File.readByteArray( job.getPath());
than to do it in two steps by reading the file as a string and then convert that to a ByteArray.
by freddyp
Sun Oct 06, 2019 9:00 pm
Forum: LEGACY scripting
Topic: Delete sub-folders and ignore all files except jpegs
Replies: 4
Views: 6120

Re: Delete sub-folders and ignore all files except jpegs

Use the "Delete files" app that is part of the bundle "Folder apps". With this app you can easily keep all the jpg files you want and with the "Rename job" element you can flatten the folder hierarchy of the job folder.
by freddyp
Mon Sep 16, 2019 10:20 am
Forum: Flows
Topic: Review Module - Original PDF input file
Replies: 4
Views: 4751

Re: Review Module - Original PDF input file

I do not quite understand the original question. It suggests that the output of the review process is a report, but it is not: the output of the review process is the input file, possibly enriched with comments that have been added. And why would you preflight a file after it has been approved and n...
by freddyp
Mon Sep 16, 2019 9:05 am
Forum: LEGACY scripting
Topic: send request to get API Token
Replies: 3
Views: 5313

Re: send request to get API Token

There are many things that could be wrong: is the endpoint correct, do not you have to add the authorization string to a special header, does not the content-type have to be application/json, ...? Without the documentation of the API it is impossible to help.
by freddyp
Tue Aug 13, 2019 9:30 am
Forum: Flows
Topic: metadata for preflight to disable/enable check
Replies: 2
Views: 3627

Re: metadata for preflight to disable/enable check

The principle is the following. Create a variable set and add a variable that reads the value from metadata, and add a variable that is rule based and that evaluates to true or false depending on the value of the first variable (if Taip then true, else if Ne then false). Create a preflight profile a...
by freddyp
Tue Aug 13, 2019 9:20 am
Forum: Flows
Topic: XML string to PDF File
Replies: 11
Views: 29876

Re: XML string to PDF File

It is not difficult to do with a script. Here is a code snippet that shows how to decode from base64 and save the result to a file: var xml = new Document( somePathToTheXMLfile); var base64String = xml.evalToString( "/xpath/to/the/InvoiceFile"); var decodedResult = new ByteArray( base64Str...
by freddyp
Thu Jul 25, 2019 3:54 pm
Forum: LEGACY scripting
Topic: setGlobalData issue
Replies: 6
Views: 7592

Re: setGlobalData issue

I take everything back. it is a coding mistake. On line 13 you log currentValue instead of newValue.
by freddyp
Thu Jul 25, 2019 3:51 pm
Forum: LEGACY scripting
Topic: setGlobalData issue
Replies: 6
Views: 7592

Re: setGlobalData issue

I found a workaround but it is weird: newValue = readGlobalData(s, testScope, testTag); job.log( -1, "New value 1: " + currentValue); job.log( -1, "New value 2: " + s.getGlobalData(testScope, testTag)); and you will see that the second log does give you the expected global data v...
by freddyp
Thu Jul 25, 2019 9:54 am
Forum: LEGACY scripting
Topic: setGlobalData issue
Replies: 6
Views: 7592

Re: setGlobalData issue

I have never had any problems with global data. Are you using variables for the scope and key? If so, then my first idea would be that there is a discrepancy between the values at set time and get time. You store the result of an API request. Assuming that it is a REST API call and you store the ser...
by freddyp
Thu Jul 25, 2019 8:52 am
Forum: LEGACY scripting
Topic: Get job count for entire flow
Replies: 8
Views: 9820

Re: Get job count for entire flow

You can use the Switch REST API to query active jobs with a certain flow stage in a certain flow. Look at the GraphQL section of: https://www.enfocus.com/manuals/DeveloperGuide/WebServices/19/index.html#api-Reporting-dashboardGraphQL . To query live jobs you do not need the Reporting Module. When th...
by freddyp
Wed Jul 10, 2019 5:47 pm
Forum: Flows
Topic: Rename job issue
Replies: 3
Views: 4477

Re: Rename job issue

You do not explain what you do to get rid of the Nordic characters. The easiest method is to use the action "Reduce character set - Portable ASCII". That gets rid of everything that looks "weird" and you need just 1 rename, and not multiple as I can see in the screenshot of the f...
by freddyp
Tue Jun 11, 2019 4:25 pm
Forum: LEGACY scripting
Topic: Web Services API
Replies: 3
Views: 5789

Re: Web Services API

Indeed, Jan, the new 2019 submit point functionality allows to submit only metadata, but behind the scenes there is still a file. As Mostafa plans to integrate an external system into Switch using the REST API he will not be using Switch Client, but he will still have to create a file too. To expand...
by freddyp
Tue Jun 11, 2019 2:26 pm
Forum: LEGACY scripting
Topic: Web Services API
Replies: 3
Views: 5789

Re: Web Services API

Submitting a file to a submit point obviously requires a file. What you want to submit is not data, but metadata! You can easily do this by putting the URL in some XML structure and submit that XML file into the flow. The first thing you do in the flow is "XML pickup - Metadata is asset", ...