Search found 35 matches
- Tue May 26, 2026 3:32 pm
- Forum: LEGACY scripting
- Topic: Setting up and using a global counter
- Replies: 2
- Views: 881
Re: Setting up and using a global counter
Hello and thank you! i wasn't using scope!
- Thu May 21, 2026 4:58 pm
- Forum: LEGACY scripting
- Topic: Setting up and using a global counter
- Replies: 2
- Views: 881
Setting up and using a global counter
Hello, I want to setup a global counter, so when the counter hits specific number, i want to send email (problems jobs for testing). But it keeps failing when it gets to the line to set the global data. It fails at the "s.setGlobalData("myCounter", counter.toString());" Anu ideas...
- Thu May 07, 2026 5:33 pm
- Forum: Switch
- Topic: How to stop a flow if file does not exist
- Replies: 5
- Views: 9731
Re: How to stop a flow if file does not exist
I tried it but i cannot get it to work with network path.
I wrote a script that is working.
But I want to stop the flow completely if the file does not exist.
I wrote a script that is working.
But I want to stop the flow completely if the file does not exist.
- Thu May 07, 2026 4:36 pm
- Forum: Switch
- Topic: How to stop a flow if file does not exist
- Replies: 5
- Views: 9731
How to stop a flow if file does not exist
Hello, I have a flow that processes hundreds of files. On activating the flow, I would like to check for a log file first, if it exists, process the many files, if it does not exist, do not process the many files and send an email. I do not know how to do this. Can anyone give me some suggestions? T...
- Mon Sep 29, 2025 1:24 pm
- Forum: Switch
- Topic: How to get date of file in script
- Replies: 10
- Views: 23267
Re: How to get date of file in script
Thank you all for your insights!
I appreciate the feedback
I appreciate the feedback
- Fri Sep 26, 2025 3:28 pm
- Forum: Switch
- Topic: How to get date of file in script
- Replies: 10
- Views: 23267
Re: How to get date of file in script
freddyp,
Yes it does have the files. I was thinking since it is an array, maybe theFiles variable would contain more info than just the name.
I was hoping for each file (2) I could maybe get the date last modified info for each file in variables.
Yes it does have the files. I was thinking since it is an array, maybe theFiles variable would contain more info than just the name.
I was hoping for each file (2) I could maybe get the date last modified info for each file in variables.
- Fri Sep 26, 2025 2:33 pm
- Forum: Switch
- Topic: How to get date of file in script
- Replies: 10
- Views: 23267
Re: How to get date of file in script
Thanks for the suggestions. I will find another way 
- Thu Sep 25, 2025 9:18 pm
- Forum: Switch
- Topic: How to get date of file in script
- Replies: 10
- Views: 23267
Re: How to get date of file in script
Hello,
I am using legacy scripting. I am a novice when it comes to scripting, especially Node.js and Typescript.
I have done lots of scripts in Powershell.
If i use node.js, i cannot create/edit in the SwitchScripter, correct?
I am using legacy scripting. I am a novice when it comes to scripting, especially Node.js and Typescript.
I have done lots of scripts in Powershell.
If i use node.js, i cannot create/edit in the SwitchScripter, correct?
- Thu Sep 25, 2025 8:50 pm
- Forum: Switch
- Topic: How to get date of file in script
- Replies: 10
- Views: 23267
Re: How to get date of file in script
i tried but not working:
const fs = require('node:fs');
var newVar = fs.stat("D:\\Testing\\scripting\\text.txt", stats);
job.log( -1, newVar);
Error in line 25 of script : 'require' undefined or not a function
const fs = require('node:fs');
var newVar = fs.stat("D:\\Testing\\scripting\\text.txt", stats);
job.log( -1, newVar);
Error in line 25 of script : 'require' undefined or not a function
- Thu Sep 25, 2025 7:54 pm
- Forum: Switch
- Topic: How to get date of file in script
- Replies: 10
- Views: 23267
How to get date of file in script
Hello, I am writing a script and want to get the creation or lastmod date of a file, but i am having problems. I am wanting to sort these 2 files by creation or lastmod date. Here is what i have in my script: var testDir = new Dir ( "D:\\Testing\\scripting" ); var theFiles = testDir.entryL...
- Wed Sep 10, 2025 2:21 pm
- Forum: Switch
- Topic: Assemble jobs using beginning and end of file names
- Replies: 1
- Views: 12318
Assemble jobs using beginning and end of file names
Hello, I want to assemble jobs, using single-line text with variables defined. The filenames are very long, about 40 characters. I would like to use a beginning segment and an end segment to match two files. Can this be done? I was thinking something like this: [Job.NameProper:Segment="1,23&quo...
- Tue Aug 05, 2025 6:34 pm
- Forum: Switch
- Topic: Execute command and exit codes
- Replies: 1
- Views: 12592
Execute command and exit codes
I am using the Execute command app to run a Powershell script. This works fine. But the trouble I am having is when the command fails and the exit code is 1, I would like the job sent to the problem jobs folder, but they are not going there. I see a message in the web portal. Currently I am testing ...
- Tue Aug 05, 2025 5:04 pm
- Forum: Switch
- Topic: Rename file based on contents
- Replies: 9
- Views: 29008
Re: Rename file based on contents
So i just ended up writing a script to append any dup filenames with a incremental number
Thanks for your help
Thanks for your help
- Tue Jul 08, 2025 1:21 pm
- Forum: Switch
- Topic: Rename file based on contents
- Replies: 9
- Views: 29008
Re: Rename file based on contents
Hello, Sorry if I confused you so let me try to explain. I need to run a few hundred files. The desired output i am expecting is a job folder with two files, one from Folder 1 and 1 from Folder 2. This flow will comparing a before file, ie Folder 1, and an after file, ie Folder 2. The files in eithe...
- Mon Jul 07, 2025 8:37 pm
- Forum: Switch
- Topic: Rename file based on contents
- Replies: 9
- Views: 29008
Re: Rename file based on contents
Thanks but I think I maybe explained my problem wrong. I am looking to assemble a job from 2 different incoming folders, Folder 1 and Folder 2. I assemble the job folder with 2 files, one from each incoming folder, based on a segment of the name, 1-23 positions. This works fine except for most files...