Search found 27 matches

by DtM
Thu Apr 11, 2024 12:35 pm
Forum: Node.js scripting
Topic: Module Import For Script Expressions
Replies: 1
Views: 364

Module Import For Script Expressions

Hello, Like many others, we're looking at replacing all of our legacy Script Expressions with new, Node.JS Script Expressions. I have a question regarding Module Imports. The placeholder of new Script Expressions has the comment of // Your imports here Does this apply to only built in modules (path,...
by DtM
Mon May 15, 2023 2:31 pm
Forum: Node.js scripting
Topic: Unresolved Promises
Replies: 5
Views: 7071

Re: Unresolved Promises

Also it's worth noting that the file names won't always fit this example pattern - they could be anything.
by DtM
Mon May 15, 2023 2:26 pm
Forum: Node.js scripting
Topic: Unresolved Promises
Replies: 5
Views: 7071

Re: Unresolved Promises

Apart from the unresolved promise issue, what is missing in "Sort files in job" to accomplish what you need? Hi Freddy, I need the files to be returned using a "natural" sort. I.E if I have 10 files named File 1.pdf through File 10.pdf, I want them to be listed alphabetically an...
by DtM
Mon May 15, 2023 2:10 pm
Forum: Node.js scripting
Topic: Unresolved Promises
Replies: 5
Views: 7071

Re: Unresolved Promises

Hi Matthew,

Thank you for the quick response - that was indeed the issue.

Can't believe I missed that - definite case of snow blindness!

Thanks again,

Dan
by DtM
Mon May 15, 2023 12:32 pm
Forum: Node.js scripting
Topic: Unresolved Promises
Replies: 5
Views: 7071

Unresolved Promises

Hello, I'm trying to write a script which should sort files in a folder in a particular way. import fs from "fs"; import path from "path"; import tmp from 'tmp-promise'; function naturalSort(arr: String[]){ return arr.map(v => { let processedName = []; let str = v; for(let i = 0;...
by DtM
Tue Mar 07, 2023 5:42 pm
Forum: Flows
Topic: Keep job in Job Board while job is processing in external software?
Replies: 11
Views: 5415

Re: Keep job in Job Board while job is processing in external software?

The unique identifier isn’t stripped the issue is that the unique identifiers differs between the files that sent to Apogee with Archive hierachy and the file placed in the Generic application folder. I will try the temp file solution. I need to put it in a folder thats not the last folder in a flo...
by DtM
Fri Feb 03, 2023 3:33 pm
Forum: Node.js scripting
Topic: TypeScript Cannot Find Names
Replies: 1
Views: 5276

TypeScript Cannot Find Names

Hello, I've just tried making my first TypeScript file since having Switch Spring 2022. I used the follow SwitchScriptTool command to make the folder: "C:\Program Files\Enfocus\Enfocus Switch\SwitchScriptTool\SwitchScriptTool.exe" --create "SendOrdersToPrinter" .\ After opening m...
by DtM
Thu Sep 16, 2021 2:30 pm
Forum: Node.js scripting
Topic: Cannot Make New Job From Empty Folder
Replies: 4
Views: 9501

Re: Cannot Make New Job From Empty Folder

Hi Freddy, Apologies, my mistake for not clarifying - I am using tmp-promise which as the name would suggest is a wrapper for tmp that adds async await functionality. Another thing that this wrapper does, is change the .name variable to .path (this also caught me off guard the first time I installed...
by DtM
Thu Sep 16, 2021 11:27 am
Forum: Node.js scripting
Topic: Cannot Make New Job From Empty Folder
Replies: 4
Views: 9501

Cannot Make New Job From Empty Folder

Hello, I have a script where I am potentially producing multiple files, but want them to be contained in a single folder on output. Once I have ascertained that I will be producing multiple files, I try to create a new job based on a temporary folder as such: // If multiple files are possible, then ...
by DtM
Fri Aug 12, 2016 9:23 am
Forum: LEGACY scripting
Topic: SQL Injection
Replies: 8
Views: 12463

Re: SQL Injection

I've got an ODBC connection to the database now, if you're able to get something working that would be great! It's been added to v2 of the script here: https://github.com/open-automation/switch-sql-query Currently, it allows for 3 parameters. Just structure your SQL query with named placeholders pr...
by DtM
Thu Aug 11, 2016 9:00 am
Forum: LEGACY scripting
Topic: SQL Injection
Replies: 8
Views: 12463

Re: SQL Injection

Dominick, I'm actually using UPDATE's rather than SELECT's, is this still a viable option? Yep. But you'll need an ODBC connection to your database to use my script, so perhaps make sure that you can swing that before jumping ship on stored procedures. I've got an ODBC connection to the database no...
by DtM
Wed Aug 10, 2016 5:06 pm
Forum: LEGACY scripting
Topic: SQL Injection
Replies: 8
Views: 12463

Re: SQL Injection

Freddy, that looks like it might be the safest way to go, I'll have a look to see whether or not it's viable in my (antiquated) database setup.

Dominick, I'm actually using UPDATE's rather than SELECT's, is this still a viable option?
by DtM
Wed Aug 10, 2016 11:37 am
Forum: LEGACY scripting
Topic: SQL Injection
Replies: 8
Views: 12463

SQL Injection

Hello, I was planning on using the standard database connect flow element but concluded that it probably doesn't have any sort of SQL injection prevention built in...Does Switch JavaScript have any sort of SQL injection prevention or a way to sanitize database inputs? I've gone through the manual on...
by DtM
Tue Jul 26, 2016 9:02 am
Forum: LEGACY scripting
Topic: Regex Ignoring New Lines
Replies: 4
Views: 4922

Re: Regex Ignoring New Lines

What system produces files like that? Seems like having Switch parse through a file like this reliably would be very challenging and prone to error. Tell me about it. :lol: I've no idea what the system is, I believe it's something bespoke our client had built for them by a third party, but I've bee...
by DtM
Mon Jul 25, 2016 2:38 pm
Forum: LEGACY scripting
Topic: Regex Ignoring New Lines
Replies: 4
Views: 4922

Regex Ignoring New Lines

Hi guys, I have a windows formatted text file (\r\n) that I am reading into a switch script. Here is an example of the format: =======Section A======= Value 1: I need this value Value 2: I need this value Value 3: I need this value =======Section B======= Value 4: I need all of these values Value 5:...