CreateDir issue....

Technical support and scripting issues

Moderators: JRL, Dorian (MJT support)

Post Reply
User avatar
pgriffin
Automation Wizard
Posts: 460
Joined: Wed Apr 06, 2005 5:56 pm
Location: US and Europe

CreateDir issue....

Post by pgriffin » Fri Feb 17, 2006 1:15 am

Try this code. I am trying to create a directory named "Create x270 Download"...but first I filter the data....

let>Var=Create x270 Download

let>ValidChar=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890
len>Var,lenVar
let>thisDigit=0
let>MyDirectory=
Repeat>thisDigit
let>thisDigit=thisDigit+1
Midstr>Var,thisDigit,1,chkDigit
Pos>chkDigit,ValidChar,1,KeepDigit
if>KeepDigit>0
concat>MyDirectory,chkDigit
endif>
Until>thisDigit=lenVar
mdl>%MyDirectory%
wait>5
CreateDir>MyString
rem> (this will show the Cr at the beginning of the string as a pipe character)


I am on v8.0 (also tried it under 7.4...same result)

My work around is to NOT filter the first two characters if they are Cr....

User avatar
JRL
Automation Wizard
Posts: 3532
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Post by JRL » Fri Feb 17, 2006 5:07 am

"CR" is a system variable for "Carriage Return". Try setting VAREXPLICIT=1. You then need to place %s around called variables so "CR" without %s will be interpretted as text.


Let>Var=Create x270 Download

let>ValidChar=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890
len>Var,lenVar
let>thisDigit=0
let>MyDirectory=
Repeat>thisDigit
Let>VAREXPLICIT=1
let>thisDigit=%thisDigit%+1
Midstr>%Var%,%thisDigit%,1,chkDigit
Pos>%chkDigit%,%ValidChar%,1,KeepDigit
if>%KeepDigit%>0
concat>MyDirectory,%chkDigit%
endif>
Let>VAREXPLICIT=0
Until>thisDigit=%lenVar%
mdl>%MyDirectory%
wait>5
CreateDir>MyString
rem> (this will show the Cr at the beginning of the string)


Hope this is helpful,
Dick

User avatar
pgriffin
Automation Wizard
Posts: 460
Joined: Wed Apr 06, 2005 5:56 pm
Location: US and Europe

Post by pgriffin » Fri Feb 17, 2006 2:24 pm

I am sure that the system is interpreting the Cr as a carriage return, but my point is that it should not when the Cr is a part of a string. I always pass variables with %var% in place. %Cr% is not the same as %Cre%...

I appreciate your answer and I may try to change to VAREXPLICIT, but I think we should be able to stuff a variable with filtered characters without the characters being changed to a Carriage Return...

User avatar
JRL
Automation Wizard
Posts: 3532
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Post by JRL » Fri Feb 17, 2006 4:30 pm

SW,

Support may be able to give a more complete answer, but I don't know any other reason for VAREXPLICIT to exist. This situation that you are describing is resolved by VAREXPLICIT. Without setting VAREXPLICIT to 1 "CR" is immediately interpretted as Carriage Return. It doesn't matter that it will become a part of a longer string one nanosecond later. "CR" or any other predefined variable can only be used as text by setting VAREXPLICIT to 1 or by redefining the predefined variable.

For Example:

Let>CR=C
Concat>CR,R

In that case be sure you have not defined "C" or "R". Also, you will no longer have the use of Carriage Return in the script.

Hope this is helpful,
Dick

User avatar
Marcus Tettmar
Site Admin
Posts: 7395
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Sat Feb 18, 2006 9:46 am

SkunkWorks wrote:I am sure that the system is interpreting the Cr as a carriage return, but my point is that it should not when the Cr is a part of a string. I always pass variables with %var% in place. %Cr% is not the same as %Cre%...
But it is NOT part of a string. With your original code if you step through with the debugger you will see that on the second iteration the MyDirectory is set to Cr which is the variable that contains a carriage return character. So on the third iteration it is set to carriage return + e.

On the second iteration it is not PART of a string - it IS the string.

So, as Dick suggests, you want to set VAREXPLICIT to 1 to make it see Cr as a literal value rather than the variable of the same name.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

User avatar
pgriffin
Automation Wizard
Posts: 460
Joined: Wed Apr 06, 2005 5:56 pm
Location: US and Europe

Post by pgriffin » Sat Feb 18, 2006 2:53 pm

I have a work-around, but if the end result is a string "Create..." .....


I'll live with it....

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts