Search found 252 matches
- Wed Feb 25, 2015 11:12 am
- Forum: LEGACY scripting
- Topic: Help with RegEx
- Replies: 10
- Views: 10376
Re: Help with RegEx
Hi, As always with regular expressions there are several possibilities. Here is one: var theString = "FAKEAOS-nofrt-nofrt-000411-004"; var theRegex = /[A-Za-z0-9]+-[A-Za-z0-9]+-([A-Za-z0-9]+-[A-Za-z0-9]+-[A-Za-z0-9]+)/; theRegex.search( theString ); var theResult = theRegex.cap(1); The lin...
- Thu Aug 11, 2011 12:32 pm
- Forum: LEGACY scripting
- Topic: replace spaces for %20 in javascript
- Replies: 2
- Views: 6689
replace spaces for %20 in javascript
Hi Robert, What you're seeing is because %2 has special meaning when logging to the Switch message pane. But this should not be a problem, because the path is only substituted in the log, not in the actual variable. You can prove this with this code: var theURI = "hello world"; var newURI ...
- Thu Jul 14, 2011 10:26 am
- Forum: LEGACY scripting
- Topic: Replacing values in an XML by a script
- Replies: 8
- Views: 14856
Replacing values in an XML by a script
Szia Peter, Unfortunately the only way to change an XML is to completely re-write it. But this is not really as bad as it sounds: the whole parsing and rewriting part is done in the background. There are only 4 steps to go through: 1. open the XML This is a single line: var xmlDocument = new Documen...
- Tue Jul 05, 2011 5:48 pm
- Forum: LEGACY scripting
- Topic: How to get file and folder count of the first level of a job folder
- Replies: 3
- Views: 6935
How to get file and folder count of the first level of a job folder
Hi Evan,
try this:
var theDir = new Dir( job.getPath() );
var Filecount = theDir.entryList("*", Dir.Files | Dir.Dirs | Dir.NoDotAndDotDot, Dir.Unsorted ).length;
// ...
try this:
var theDir = new Dir( job.getPath() );
var Filecount = theDir.entryList("*", Dir.Files | Dir.Dirs | Dir.NoDotAndDotDot, Dir.Unsorted ).length;
// ...
- Mon Jul 04, 2011 4:17 pm
- Forum: Flows
- Topic: execute command to launch a python csv to xml script
- Replies: 4
- Views: 15870
execute command to launch a python csv to xml script
Can you try changing the arguments to: -c 'python Volumes/HD/Desktop/csv2xml.py "%1" > "%2"'
If this doesn't work, I would suggest wrapping the whole thing into a bash script, and using that in the command property.
If this doesn't work, I would suggest wrapping the whole thing into a bash script, and using that in the command property.
- Thu May 19, 2011 11:02 am
- Forum: Applications
- Topic: Settings in user preferences
- Replies: 1
- Views: 6145
Settings in user preferences
Windows (at least XP, but I think other versions as well) will give a warning when there is less than 200 MB available. In my opinion, this is much too low for modern systems, and Windows should warn earlier. That being said, the Switch setting is quite independent of what Windows does. The Switch s...
- Fri Apr 15, 2011 5:51 pm
- Forum: LEGACY scripting
- Topic: Injecting files using a Script
- Replies: 6
- Views: 14533
Injecting files using a Script
reprokaiser wrote: Why there isn't a file.rename() function available? How can I rename a file (not the job) using a script? Do I need to go around the circle like getting a temporary path, copying the file to whatever I got, then copying back to the original location with a different name, then rem...
- Tue Apr 05, 2011 3:03 pm
- Forum: Applications
- Topic: indesign script error: out of memory
- Replies: 3
- Views: 10526
indesign script error: out of memory
Although you have 32 GB memory in your Mac, Adobe InDesign is limited to 4 GB of memory - and this will remain the case until Adobe creates a 64-bit version. On top of that, the effective limit is actually much less, because the operating system uses a part of that 4 GB to keep the program's code in...
- Tue Apr 05, 2011 2:45 pm
- Forum: Flows
- Topic: XML pickup tool
- Replies: 11
- Views: 17904
XML pickup tool
sherczog wrote: And in Powerswtich an Single-line text with variables defined: [Metadata.Text:Path="//field[tag=pad]/value",Dataset="Xml",Model="XML"]. The xpath expression is not completely correct. Try this one: [Metadata.Text:Path="//field[tag='pad']/value"...
- Tue Apr 05, 2011 2:32 pm
- Forum: LEGACY scripting
- Topic: Injecting files using a Script
- Replies: 6
- Views: 14533
Injecting files using a Script
Actually, sending a file to a single outgoing connection really is as simple as you think. But there are some things to remember: - You have to send a *job* to the outgoing connection, not a file. Basically this means you should use job.sendToSingle instead of thePDF.sendToSingle. - sendToSingle tak...
- Thu Mar 03, 2011 5:59 pm
- Forum: LEGACY scripting
- Topic: Sample: create xml from scratch
- Replies: 2
- Views: 12580
Sample: create xml from scratch
I have - this complicates things a little, but not that much really. There are basically 4 changes to the script if you want to use namespaces: 1. ask the xml document to create a new map 2. add the namespace definitions to this map 3. use the namespace prefixes in each element or attribute name tha...
- Thu Mar 03, 2011 10:41 am
- Forum: LEGACY scripting
- Topic: Sample: create xml from scratch
- Replies: 2
- Views: 12580
Sample: create xml from scratch
Below is a sample showing how to create an xml document using the Switch scripting API. The code is supposed to be used in a script element, with TrafficLight outgoing connections. There are plenty of comments, so I hope it's easy enough to read :-) //*************************** // This sample shows...