Search found 31 matches

by netaware
Mon Sep 29, 2025 1:24 pm
Forum: Switch
Topic: How to get date of file in script
Replies: 10
Views: 1327

Re: How to get date of file in script

Thank you all for your insights!

I appreciate the feedback :)
by netaware
Fri Sep 26, 2025 3:28 pm
Forum: Switch
Topic: How to get date of file in script
Replies: 10
Views: 1327

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.
by netaware
Fri Sep 26, 2025 2:33 pm
Forum: Switch
Topic: How to get date of file in script
Replies: 10
Views: 1327

Re: How to get date of file in script

Thanks for the suggestions. I will find another way :)
by netaware
Thu Sep 25, 2025 9:18 pm
Forum: Switch
Topic: How to get date of file in script
Replies: 10
Views: 1327

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?
by netaware
Thu Sep 25, 2025 8:50 pm
Forum: Switch
Topic: How to get date of file in script
Replies: 10
Views: 1327

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
by netaware
Thu Sep 25, 2025 7:54 pm
Forum: Switch
Topic: How to get date of file in script
Replies: 10
Views: 1327

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...
by netaware
Wed Sep 10, 2025 2:21 pm
Forum: Switch
Topic: Assemble jobs using beginning and end of file names
Replies: 1
Views: 4195

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...
by netaware
Tue Aug 05, 2025 6:34 pm
Forum: Switch
Topic: Execute command and exit codes
Replies: 1
Views: 4928

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 ...
by netaware
Tue Aug 05, 2025 5:04 pm
Forum: Switch
Topic: Rename file based on contents
Replies: 9
Views: 12683

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
by netaware
Tue Jul 08, 2025 1:21 pm
Forum: Switch
Topic: Rename file based on contents
Replies: 9
Views: 12683

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...
by netaware
Mon Jul 07, 2025 8:37 pm
Forum: Switch
Topic: Rename file based on contents
Replies: 9
Views: 12683

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...
by netaware
Wed Jul 02, 2025 7:07 pm
Forum: Switch
Topic: Rename file based on contents
Replies: 9
Views: 12683

Rename file based on contents

Hello,
Is it possible for Switch to rename a text file or add a suffix/prefix based on its size or contents?

Or do I need to write a script?

Thanks.
by netaware
Fri Jun 27, 2025 4:52 pm
Forum: Flows
Topic: Executing Windows Batch file (.bat)
Replies: 9
Views: 5892

Re: Executing Windows Batch file (.bat)

Hello, I got it working. Ended up using the app "Create File From Template" and built my batch file with it. First I make a copy of the job folder, then run the batch file, it send output to the BC4_temp folder. The "Run Command" sends the job folder on to "Folder 12", ...
by netaware
Tue Jun 17, 2025 4:04 pm
Forum: Flows
Topic: Executing Windows Batch file (.bat)
Replies: 9
Views: 5892

Re: Executing Windows Batch file (.bat)

Yes the order is important because you have to compare the original to the newer version of the file. But I did change things with the RUN command. I am trying to run the commandline without a batch file and had some success. This is the what i am doing with the RUN command: "C:\Program Files\B...
by netaware
Tue Jun 17, 2025 2:07 pm
Forum: Flows
Topic: Executing Windows Batch file (.bat)
Replies: 9
Views: 5892

Re: Executing Windows Batch file (.bat)

Hi and thank you for your help! This is my flow. I am creating a .bat for each job using the "Create file from template" app and private data and placing that .bat in the job folder Flow1.png Below is the .bat file that is needed to run Flow2.png What i am trying to do is use Beyond Compar...