Digital Workshop

Welcome to the Digital Workshop Message Boards
It is currently December 22nd, 2024, 7:52 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 6 posts ] 
Author Message
 Post subject: I need to strip off the trailing \
PostPosted: January 7th, 2005, 3:02 pm 
I need to strip off the trailing \ off of the Directory Browse variable return....Any script solutions out there?


Top
   
 
 Post subject:
PostPosted: January 7th, 2005, 3:36 pm 
Offline

Joined: October 25th, 2004, 12:27 pm
Posts: 526
Location: Digital Workshop
Hi,

Thank you for your enquiry.

Yes - this should be possible. Please try the following script actions:

Code:
var length = String.length(directory)
directory = directory.substring(0,length-1)


where directory is the variable containing the directory path.

Please note that this will overwrite the original path with the truncated version. If you want to store the truncated version to a new variable, simply change the second line to:

Code:
result = directory.substring(0,length-1)


Kind regards,

_________________
Robin Garrett
Digital Workshop Technical Support


Top
 Profile Visit website  
 
 Post subject:
PostPosted: January 7th, 2005, 4:07 pm 
Many thanks....works a dream


Top
   
 
 Post subject:
PostPosted: January 10th, 2005, 10:43 am 
I do get this though when a selection is not made...any ideas of what this is doing?

Action (2, 0) : Object Not Found : The called object is not a valid object type (undefined? null?)


Top
   
 
 Post subject:
PostPosted: January 10th, 2005, 11:59 am 
Offline

Joined: October 25th, 2004, 12:27 pm
Posts: 526
Location: Digital Workshop
Hi,

Thank you for your enquiry.

If the user cancels out of the Directory Browse dialog, the directory variable remains blank. The script action then tries to create a substring from an empty string, resulting in the error message.

The solution is to check whether the directory variable has been populated before the substring is created. The following code should be sufficient:

Code:
if (directory != null) {
var length = String.length(directory)
directory = directory.substring(0,length-1)
}


This checks to see if the directory variable is NOT null. If so, the substring is created. If the directory variable IS null, no actions take place.

I hope this helps. Please do not hesitate to contact me if you have any further queries.

Kind regards,

_________________
Robin Garrett
Digital Workshop Technical Support


Top
 Profile Visit website  
 
 Post subject:
PostPosted: January 10th, 2005, 1:08 pm 
Thanks again....I am slowly getting to grips with this.....but very slowly :?


Top
   
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 6 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group