Position> command generates unwanted error

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
Chaoticz
Newbie
Posts: 15
Joined: Wed Apr 23, 2003 3:47 pm
Location: Atlanta, GA USA

Position> command generates unwanted error

Post by Chaoticz » Tue May 20, 2003 7:01 pm

I am using the position> command to check for a string in another string. My problem is that sometimes the second string is empty and that causes a error window to get displayed, stopping the script.

For example:

// Generates Error
Let>output_var=
Position>find this,output_var,1,start_pos

If output_var is blank, a window pops up that says "Error in Position Command."

// Works fine
Let>output_var=some text
Position>find this,output_var,1,start_pos

If I click OK on the error message box, it will still return 0 in start_pos, but I dont want that error window to be displayed at all.

User avatar
support
Automation Wizard
Posts: 1450
Joined: Sat Oct 19, 2002 4:38 pm
Location: London
Contact:

Post by support » Wed May 21, 2003 9:27 am

Hi,

You should do this:

Length>output_var,len_output_var
If>len_output_var=0,skip
Position>find this,output_var,1,start_pos
..
Label>skip

i.e. if the length of the value is zero, don't do the Position and substring manipulation.
MJT Net Support
[email protected]

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