job.getName issue

Post Reply
LasseThid
Advanced member
Posts: 365
Joined: Tue Mar 03, 2015 2:30 pm
Location: Molndal, Sweden

job.getName issue

Post by LasseThid »

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... :lol:

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);
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
Enfocus Switch, Enfocus PitStop Server, Enfocus PDF Review, HP SmartStream& Kodak Prinergy with RBA
Offset 72x102, Offset Large Format, Digital Large Format and Digital print.
patej
Member
Posts: 101
Joined: Sun Nov 25, 2012 12:15 pm
Location: Helsinki, Finland

Re: job.getName issue

Post by patej »

it's only job.getName(false) that's needed. "includeExtension = true" is only the way the documentation tells us what the value there means :)
LasseThid
Advanced member
Posts: 365
Joined: Tue Mar 03, 2015 2:30 pm
Location: Molndal, Sweden

Re: job.getName issue

Post by LasseThid »

Ahhh... ok!

Thanks!
Enfocus Switch, Enfocus PitStop Server, Enfocus PDF Review, HP SmartStream& Kodak Prinergy with RBA
Offset 72x102, Offset Large Format, Digital Large Format and Digital print.
Post Reply