Constructing dynamic strings

Hints, tips and tricks for newbies

Moderators: Dorian (MJT support), JRL

Post Reply
aqua267
Junior Coder
Posts: 27
Joined: Thu Aug 19, 2010 7:57 pm

Constructing dynamic strings

Post by aqua267 » Fri Jan 07, 2011 10:46 pm

I am looking to construct a dynamic string, for instance
I will be assigning a new value to the variable keyword and then invoke the script. If the keyword does not return search results, my application gives the message:No matches found for search text 'x'

Say keyword=x
No matches were found for search text 'x'
In order to compare the string, I declare a variable containing this keyword
Let>NoSearchResults=No matches were found for search text '%keyword%'. How do i construct this variable to hold the keyword value I am passing?

TIA.

adroege
Automation Wizard
Posts: 438
Joined: Tue Dec 07, 2004 7:39 pm

Post by adroege » Mon Jan 10, 2011 2:30 pm

How do i construct this variable to hold the keyword value I am passing?
I don't understand your problem based upon the description you have given. Looks like you are on the right track. Can you give more details?

aqua267
Junior Coder
Posts: 27
Joined: Thu Aug 19, 2010 7:57 pm

Post by aqua267 » Mon Jan 10, 2011 5:10 pm

Thanks for your reply. I am trying to do the following. I am passing a keyword as input to a search window in my application. If the keyword does not return any results, then I will quit. Else I'll call another subroutine and continue.

Code Snippet is something like:

Let>Keyword=xim
GoSub>CallApplication
Send>keyword
//search is done using the keyword and if no search result, the text "No matches found for keyword '' " is returned. I capture the text in GetValue.

GetClipBoard>GetValue
if>GetValue=No matches found for search text '%keyword%' //My question is how do I pass the keyword in this string?
Exit application
else
Call another subroutine and continue.
endif

adroege
Automation Wizard
Posts: 438
Joined: Tue Dec 07, 2004 7:39 pm

Post by adroege » Mon Jan 10, 2011 6:05 pm

If you want to know how to pass in variables to subroutines,
here is a quote from the help system on how to do that.
Gosub>Subroutine_Name[,value1[,value2[,...]]]

Branches to the specified subroutine (SRT). When that the subroutine returns, processing continues at the next line after the Gosub command.

Subroutines can be nested. Subroutines can be located anywhere within the script.

If values are passed on the Gosub line variables will be created to contain these values. The variables are named with the following format: SubroutineName_Var_1, Subroutine_Var_2, ... Subroutine_Var_n

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