job.getName issue
Posted: Thu May 22, 2025 11:59 am
I'm trying to get started on converting my old legacy scripts to Node.js.
I have watch the Enfocus tutorials on Switch Scripting with Node.js Beginner and Advanced and I've also done some training at Codecademy. That being said I'm still mostly clueless on how to do this, so it's a trial and error project, well mostly error...
Anywho...I'm trying to get the name of the file without the file extension, which as far as I can see should be:
but I get a wave underneath the includeExtension part and if I hover over that part I get a popup window saying "Cannot find name 'includeExtension'. ts(2304)
I have checked the SwitchScripter help and it says:
getName(includeExtension: boolean = true): string
Returns the file or folder name for the job, but excluding the unique filename prefix (job ID). By default the returned name includes the file extension. The user can exclude the file extension by setting the includeExtension argument to false.
Transpiling the script throws this error:
Error: Failed to transpile the code: TypeScript failed with exit code 2
Error: TypeScript standard output: D:/Switch/Node-scripts/AddRandomNumberAtEndOfFileName/main.ts(4,58): error TS1005: ',' expected.
I guess that 4, 58 means row 4 character 58, which is where the includeExtension is in the script.
Thanks in advance
Lasse
I have watch the Enfocus tutorials on Switch Scripting with Node.js Beginner and Advanced and I've also done some training at Codecademy. That being said I'm still mostly clueless on how to do this, so it's a trial and error project, well mostly error...

Anywho...I'm trying to get the name of the file without the file extension, which as far as I can see should be:
Code: Select all
let theFileName:string = job.getName(includeExtension = false);
I have checked the SwitchScripter help and it says:
getName(includeExtension: boolean = true): string
Returns the file or folder name for the job, but excluding the unique filename prefix (job ID). By default the returned name includes the file extension. The user can exclude the file extension by setting the includeExtension argument to false.
Transpiling the script throws this error:
Error: Failed to transpile the code: TypeScript failed with exit code 2
Error: TypeScript standard output: D:/Switch/Node-scripts/AddRandomNumberAtEndOfFileName/main.ts(4,58): error TS1005: ',' expected.
I guess that 4, 58 means row 4 character 58, which is where the includeExtension is in the script.
Thanks in advance
Lasse