Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Having trouble using foreach and user-defined function
#1
[Sorry didn't mean to crosspost this also into resources]....


Just can't seem to get my syntax right, despite looking at manual:
For each item (str serieslauncher) in the collection seriesname, I would like the steps carried out in user-defined function to be executed


Code:
Copy      Help
str serieslauncher

str seriesname=
*re*air*
"*re*ost*ad*"
"*re*re*ad*"
"*re*T2*"
"*24*air*"
"*24*ost*ad*"
"*24*re*ad*"
"*24*T2*"


foreach serieslauncher seriesname
    LaunchSeries serieslauncher

Function LaunchSeries
Code:
Copy      Help
function str&serieslauncher str&seriesname

spe -1
act win("Cheshire Launch Pad" "CabinetWClass")

Acc a=acc(serieslauncher "LISTITEM" win("Cheshire Launch Pad" "CabinetWClass") "SysListView32" "" 0x1001)
int x y cx cy
a.Location(x y cx cy)
mou x+5 y
lef+
mou +5 0
act win("Cheshire(TM)" "CheshireMainFrame")
lef-


It keeps on getting hung up on the Acc statement in the function. Even though it is receiving the argument serieslauncher correctly (I checked with an out statement. If I explicitly define serieslauncher in the function (e.g. serieslaunch="*re*air*"), the Acc statement does work. So the function receives the variable correctly and the steps in the function do work. Nevertheles still getting error (Error (RT) in LaunchSeries: object not found)

Any suggestions? I know there are supposed to be two arguments passed to function each time but I can't seem to get it to work.

Thanks!!!!
Stuart
#2
Remove " in first code.


Forum Jump:


Users browsing this thread: 1 Guest(s)