Using Text as a Variable

Discuss RoboTask here
Post Reply
Brendan
Posts: 17
Joined: Wed Jun 30, 2004 2:39 pm

Using Text as a Variable

Post by Brendan »

In Version 2.1:
Whenever I have a .txt file or a piece of clipboard text, and try to turn it into a variable, a comma is inserted at the end.
For example:
The following string:
123456
When turned into a variable "Var" using Get Text and inserted into a folder or filename ie: "Create Folder" --> C:\{Var}text
Will always result in the error:
Can't create folder C:\"123456,text"
Which is obviously because there is a comma in the middle of the filename.  I'm not sure if this is a reult of the Comma Delimited Text format that the Widows Clipboard uses, but it's painful to work around
The only workaround I've found is by loading the contents of the text file into a "text loop" and then immediately ending the loop. 
My ultimate goal is simply to sort file versions:
ie, a folder containing the following:
ONE.txt
ONE(1).txt
ONE(2).txt
TWO.txt
THREE.txt
THREE(1).txt
needs to have all "older" versions removed, ie:
ONE(2).txt
TWO.txt
THREE(1).txt
 
So far I've had to:
Move *(1).txt to folder 1
Move *(2).txt to folder 2
etc...
And then starting with the highest folder (4)..
Create a File Loop, setting the file name as the variable
Pasting the variable into temp.txt
Using prerecorded keystrokes (END)(Backspace(X7)) to edit the text
Save file
Open Text Loop to create a variable with JUST the Name (not version)
Delete {JUSTTHENAME}*.txt from folders 3,2,1,0
And again for the files in folder 3,
Etc...
Does anyone think there might be an easier way ??? (or one that moves a bit faster, this takes forver with a few thousand files)
Oleg
Site Admin
Posts: 3014
Joined: Thu Jan 01, 1970 1:00 am
Contact:

Using Text as a Variable

Post by Oleg »

For example:

The following string:

123456

When turned into a variable "Var" using Get Text and inserted into a folder or filename ie: "Create Folder" --> C:\{Var}text

Will always result in the error:

Can't create folder C:\"123456,text"
You get this error when clipboard contains line with <CR><LF> symbols (carriage return and line feed). <CR><LF> is contained at the end of any text line (in multilines text).
But when RoboTask writes message to logfile it replaces these symbols with comma (,) .
The only workaround I've found is by loading the contents of the text file into a "text loop" and then immediately ending the loop.
When RoboTask do a text loop each line is retrieved without <CR><LF> symbols
Last edited by Oleg on Fri Sep 17, 2004 11:40 am, edited 1 time in total.
Brendan
Posts: 17
Joined: Wed Jun 30, 2004 2:39 pm

Using Text as a Variable

Post by Brendan »

Thanks, Oleg, is there any possibility that a future version might include an option to "Ignore line breaks in text strings?"
My text loop workaround is actually working pretty well right now, but isn't elegant. (actually this comes back to my suggestion for a Variable Value Translation function that would allow you to translate a list of characters into other characters or delete them completely from a variable string).
Post Reply