Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
User Defined Function - Return value
#1
Hi,
I feel so stupid because I can't figure this basic programming.
I am trying to utilize more user-defined functions in my macros.

I have been able to pass str variables to and from the user defined function and it worked fine.
But now there is a condition that depends on whether the user defined function worked properly and found what it was looking for.

I can't seem to get it to just return a value (0 or 1) and then have a decision tree based on that in the calling macro.

This is the syntax I have been trying to implement after looking through the help menu


The calling Macro is Macro1

Macro 1
Code:
Copy      Help
str accn;; accn will be used to define the window name in a later Acc statement in the function T2Series
GetPACSAccn accn;; GETPACSAccn gets the variable accn to be passed along in T2Series

int ifseriesfound
ifseriesfound = T2Series (accn)

if ifseriesfound = 1
,OnScreenDisplay    "found it"
if ifseriesfound = 0
,OnScreenDisplay "didn't find it"

The user-defined function is:

T2Series

Code:
Copy      Help
;/
function str&accn

Acc a=acc("(T2SeriesType1)|(T2SeriesType2)" "LISTITEM" win(accn "#32770") "SysListView32" "" 0x1002);err
if (!a.a) ret
a.Mouse(0)    
;

I am confused on how to get it to return the correct value or "validity" testing-
I know with some functions you can have a statement like:

Code:
Copy      Help
int i=findcr(f '.')

and then ret i

but I don't know how to set up a statement like this with the Acc statement type of function

I know this is basic programming but I think if I can get a handle on this, my macros will be much more robust.....

Thanks,
Stuart[/quote]


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)