Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • Sep 26 09:23
    joyd-lab9 commented #26
  • Sep 26 09:12
    joyd-lab9 commented #26
  • Sep 17 12:56
    DeschampsThomasSobook commented #26
  • Sep 17 12:55
    DeschampsThomasSobook commented #26
  • Sep 17 12:55
    DeschampsThomasSobook commented #26
  • Sep 17 12:54
    DeschampsThomasSobook commented #26
  • Sep 17 12:39
    DeschampsThomasSobook synchronize #28
  • Sep 04 14:50
    Dominick-Peluso-Bose commented #26
  • Sep 04 14:50
    Dominick-Peluso-Bose opened #28
  • Sep 04 11:56
    DeschampsThomasSobook commented #26
  • Sep 04 07:29
    joyd42 commented #26
  • Sep 04 07:07
    joyd42 commented #26
  • Sep 03 15:22
    joyd42 commented #26
  • Sep 03 11:13
    DeschampsThomasSobook commented #26
  • Sep 03 11:05
    DeschampsThomasSobook commented #26
  • Sep 02 17:03
    joyd42 commented #26
  • Aug 30 13:48
    Dominick-Peluso-Bose commented #26
  • Aug 30 12:31
    DeschampsThomasSobook commented #26
  • Aug 30 12:27
    DeschampsThomasSobook commented #26
  • Aug 27 10:54
    joyd42 commented #26
bbertolani
@bbertolani
@Dominick-Peluso-Bose Hi, so I just install the antfarm and tried run one example.
D:\Projects\NODE.JS\antfarm_test\node_modules\antfarm\lib\environment\logger.js:82
level: this.options.log_out_level || "info",
^
TypeError: Cannot read property 'log_out_level' of undefined
at Logger.createLogger (D:\Projects\NODE.JS\antfarm_test\node_modules\antfarm\lib\environment\logger.js:82:45)
Dominick Peluso
@Dominick-Peluso-Bose
That is a bug -- it should set a default there.
When you construct antfarm, pass in that option.
af = new Antfarm({ log_out_level: "error" });
And it should go away
bbertolani
@bbertolani
Thank you, works. I changed to "info" to get the logs
bbertolani
@bbertolani
@Dominick-Peluso-Bose all I have to say is "AWESOME" job you did with Antfarm...
Dominick Peluso
@Dominick-Peluso-Bose
@bbertolani thanks man. I think there is potential there and it works well for small stuff but I never really got chaining of multiple workflows working seamlessly. I'd love to spend more time on it.
bbertolani
@bbertolani
@Dominick-Peluso-Bose also do you know a free library that I can manipulate a PDF? I'm trying mPDF but has some limitations.
Dominick Peluso
@Dominick-Peluso-Bose
None that I'm familiar with. I know apago has some tools to do this but there must be some open source tools somewhere.
Matthew Kay
@matthewkayy
Hi! does anybody know if there is any free CLI tools for imposing booklet PDFs into reader's spreads?
bbertolani
@bbertolani
@matthewkayy Hello! I don't know any free solution, if you found something please share with us.
Matthew Kay
@matthewkayy
@bbertolani After doing some googling I've found HummusJS which I think might be able to do it: https://github.com/galkahana/HummusJS/wiki/Embedding-pdf#merging-a-page-content-to-another-page-content
Need to do some testing with it at some point
auz-tbg
@auz-tbg
I am trying to use the SWITCH API, does anyone know how to set user permissions
Screen Shot 2018-10-15 at 8.52.54 AM.png
I am trying to get access to Client
auz-tbg
@auz-tbg
In the Switch Users the Administrator account has full permissions
Dominick Peluso
@Dominick-Peluso-Bose
No idea auz
auz-tbg
@auz-tbg
It was cause I was using Legacy Version of SWITCH client, that disables Web Services
bbertolani
@bbertolani
hello, @Dominick-Peluso-Bose can you help me about Portals, I'm running the Auto Backup Flows with success in 3 servers, but I'm my dev environment, I can't figure out why is not working. It is a Portal error the "Failed to remove directory structure", but Portal nor tries to create the folder temp/{id} folder.
Error in line 337 of script : Error. Failed to remove directory structure: 'C:/Users/Administrator/AppData/Roaming/Enfocus/Switch Server/ScriptData/SwitchPortalsEther/Portals_C-GetFlowFunction/temp/01IBD'
Dominick Peluso
@Dominick-Peluso-Bose
Hey @bbertolani sounds like a permissions error
Try to go to "C:/Users/Administrator/AppData/Roaming/Enfocus/Switch Server/ScriptData/SwitchPortalsEther/Portals_C-GetFlowFunction" and delete the "/temp" folder and its contents
or change the channel name
After doing that, does the problem arise again?
bbertolani
@bbertolani
Thank you for your reply, unfortunately, this trick doesn't solve. Also, I tried changing the SwitchPortalsEther, folders permissions, but without success. Anyway, I will try to debug next week.
Dominick Peluso
@Dominick-Peluso-Bose
David Gasperoni
@mcdado
hey there everyone! Quick question… in Switch we're trying to match a case insensitive regexp inside the conditions in the "define condition with variables: include these jobs" pane… there seems to be now way of doing that… /abc/i doesn't seem to work
Matthew Kay
@matthewkayy
@mcdado /abc/i will work if you're the job is a folder, for files you will need to match against the file extension too so /abc.pdf/i
if you wanted an expression that matched against either folders or jobs you could do something like this /^(abc)(\.[\w]+)*$/i.
David Gasperoni
@mcdado
well we tried /.*WHITE.*/i and it didn't match aything that should have matched
if anywhere in the job name there is "white"
annotazione_2019-04-18_091733.jpg
Matthew Kay
@matthewkayy
ah sorry i was using define regular expression instead of define condition with variables
Matthew Kay
@matthewkayy
For define condition with variables remove the / /i anchors around the regex and to then make it case insensitive it will need to be like this .*[Ww][Hh][Ii][Tt][Ee].* I think that should work
Matthew Kay
@matthewkayy
Or you could change the job variable to [Job.Name:Case="upper"] and just use your original regex .*WHITE.*
David Gasperoni
@mcdado
Thank you! I think the conversion to either upper or lower case first is the best solution
Matthew Kay
@matthewkayy
No worries! Yeah that makes more sense
patej
@patej
Hi everyone! Has anyone created a script that connects with HTTP to a service using OAuth 1.0? We would need to connect to a Bynder instance and we’ve received permanent customer_key, customer_secret, access_token and token_secret, but I can’t find a way to authenticate correctly… Bynder docs (https://bynder.docs.apiary.io/#reference/consumers-and-access-tokens) doesn’t give much, but I tried to follow https://tools.ietf.org/html/rfc5849#section-3 and create the required base strings and keys for the signature, but I couldn’t find a way to generate the signature. The Switch’s getSignature() requires path to a private key, which I don’t have so it seems that there is no way to generate a HMAC-SHA1 signature required by OAuth 1.0? There are javascript libraries for generating signatures, but you cannot include external libraries to Switch scripts... Any suggestions?
patej
@patej
^^I solved it by creating the whole process in an external js file and ran it with Process.execute() and Node JS… I really hope SwitchScript will be updated to modern times from EcmaScript 4.0, which has been abandoned for ten years...
David Gasperoni
@mcdado
Good that you solved it… now you can leverage npm!
Zoran
@Zoranj666
Hi everyone! Can someone let me know how can I split multiline text into individual text files for each line in Javascript? I can do it in Powershell, but I prefer to have same thing in Javascript. I used Gabriel's script that does the same thing but sends information about each line into log, I think I am missing last portion to write individual txt files for each line, rather than just log. Thanks
e.g. text file has 10 lines of text, I want to output 10 text files with one line of text, text.txt -> text_01.txt, text_02.txt, etc...
Matthew Kay
@matthewkayy
@Zoranj666 This script should do the trick
function jobArrived( s : Switch, job : Job ) {
    // Construct file object from path of incoming job
    var inFile = new File(job.getPath());

    // Open the file and read contents into array
    inFile.open(File.ReadOnly);
    var lines = inFile.readLines();
    inFile.close();

    for (var i = 0; i < lines.length; i += 1) {
        // Create temp path 
        var lineFileName = job.getNameProper() + "_" + (i + 1 < 10 ? "0" + (i + 1) : i + 1) + ".txt";
        var lineFile = job.createPathWithName(lineFileName);

        // Write contents of current line to temporary file
        File.write(lineFile, lines[i], "UTF-8");

        // Send temporary file to outgoing connection
        job.sendToSingle(lineFile);
    }    

    // Send incoming job to null
    job.sendToNull(job.getPath());
}
Zoran
@Zoranj666
Matthew, this is just awesome. I hope I would not be pushing it but would you mind adding function to remove/not process blank lines.
I have Gabriels script that removes blank lines but I am too dumb to adjust your script to add this function.

'function jobArrived( s : Switch, job : Job ) {

var debugLevel = s.getPropertyValue( "debugLevel" );

// create the file handler
var fileList = new File(job.getPath());

// open the file for reading
fileList.open(File.ReadOnly);

// read each line into an array
var lines = fileList.readLines();

var theSourcePath;

for(i = 0; i < lines.length; i++) {

    sourcePath = lines[i];

    // don't process blank lines
    if (sourcePath == '') {
        continue;
    }

    // create a file handle for the file to be moved
    sourceFile = new File(sourcePath);

    if (!File.exists(sourcePath)) {
        s.log(3, sourcePath + " does not exist");
        continue;
    }


    // get the name of the file (without the path information)
    fileName = sourceFile.name;

    // create a new job using the name of the file to copy
    newJob = s.createNewJob(fileName);
    jobPath = newJob.createPathWithName(fileName, true);

    // copy the file to the new job.
    s.copy( sourcePath, jobPath );
    if(debugLevel == 1){
        s.log(2, "Copy " + sourcePath + " to job");
    }

    // trim hierarchy segments
    var jobPathArray = sourcePath.split("/");
    jobPathArray.splice(0, s.getPropertyValue("Trim_Hierarchy"));
    jobPathArray.shift();
    jobPathArray.pop();

    // set hierarchy information
    newJob.setHierarchyPath(jobPathArray);

    // send the file along to a single connection
    newJob.sendToSingle( jobPath );
    if(debugLevel == 1){
        s.log(2, "Send to single: " + jobPath);
    }        
}
if(debugLevel == 1){
    s.log(2, "Done processing");
}
// cleanup
job.sendToNull( job.getPath() );

fileList.close();

}'

Matthew Kay
@matthewkayy
Sure the below script will ignore empty lines:
// Is invoked each time a new job arrives in one of the input folders for the flow element.
// The newly arrived job is passed as the second parameter.
function jobArrived( s : Switch, job : Job ) {
    // Construct file object from path of incoming job
    var inFile = new File(job.getPath());

    // Open the file and read contents into array
    inFile.open(File.ReadOnly);
    var lines = inFile.readLines();
    inFile.close();

    // Create a counter variable for file name suffix
    var counter = 1;
    for (var i = 0; i < lines.length; i += 1) {
        // Check that current line isn't blank
        if (lines[i] !== "") {
            // Create temp path 
            var lineFileName = job.getNameProper() + "_" + (counter < 10 ? "0" + counter : counter) + ".txt";
            var lineFile = job.createPathWithName(lineFileName);

            // Write contents of current line to temporary file
            File.write(lineFile, lines[i], "UTF-8");

            // Send temporary file to outgoing connection
            job.sendToSingle(lineFile);

            // Add one to counter
            counter += 1;
        }
    }    

    // Send incoming job to null
    job.sendToNull(job.getPath());
}
Zoran
@Zoranj666
Thanks Mathew
Matthew Kay
@matthewkayy
No problem! Glad I could help