Login
Username:

Password:

Remember me



Lost Password?

Register now!

Sections

Who's Online
124 user(s) are online (112 user(s) are browsing Forums)

Members: 0
Guests: 124

more...

Support us!

Headlines

 
  Register To Post  

The AREXX thread (Questions, hints, ideas)
Home away from home
Home away from home


See User information
Hey fellow scripters,

i'd like to use two seperate "macros" in my AREXX script

...

long and broing arexx script:

EXIT

FirstMacro:
do something important

SecondMacro:
do something even more important

...


How do i tell AREXX to stop after the first macro has been executed and return to the main script?

That works if i only use one macro and the execution reaches EOF, but right now with two macros in place, i call FirstMacro, but AREXX keeps jumping over the SecondMacro destination and tries to execute that as well (which will lead to errors, since it lacks mandatory information not given by calling FirstMacro).

Is there some kind of "end macro" character?
Like a simple ":" at the end of one macro or a turned around leap destination, like ":FirstMacro"?

I didn't find anything in my books.

Thanks a lot

Go to top
Re: The AREXX thread (Questions, hints, ideas)
Quite a regular
Quite a regular


See User information
Duplicate


AmigaOne X1000, A1222Plus, uA1
Go to top
Re: The AREXX thread (Questions, hints, ideas)
Quite a regular
Quite a regular


See User information
@Raziel

RETURN [expression]
RETURN is used to leave a function and return control to the point of the function's invocation. The evaluated expression is returned as the function result. If an expression is not supplied, an error may result in the caller's environment. Functions called from within an expression must return a result string and will generate an error if no result is available. Functions invoked by the CALL instruction need to return a result.

A RETURN issued from the base environment of a program is not an error and is equivalent to an EXIT instruction. Refer to the EXIT instruction for a description of how result strings are passed back to an external caller. For example:

RETURN 6*7 /*Returns 42*/

AmigaOne X1000, A1222Plus, uA1
Go to top
Re: The AREXX thread (Questions, hints, ideas)
Home away from home
Home away from home


See User information
@ktadd

Ahh, thanks a lot, my AREXX book is kind of not very clever managed

Go to top
Re: The AREXX thread (Questions, hints, ideas)
Home away from home
Home away from home


See User information
Hi there,

ok, that is a strange one (unless i'm not doing something completely wrong...again...)

Start the little script below, all is fine, all is going well, clips are created.
/*
*/
SETCLIP('boot_scripts',1)
IF 
GETCLIP('boot_scripts')=1 THEN
    SETCLIP
('boot_scripts',2)
IF 
GETCLIP('boot_scripts')>1 THEN DO
    
val=GETCLIP('boot_scripts')
    
val=val-1
    SETCLIP
('boot_scripts',val)
END


now...start the same script, but with the below script called "1.rexx" in the same directory as the above script
/*
*/
SAY 'I have been summoned...'


This is what i get now (the clips are still created, of course, but the fact that another program is silently rexecuted is scary, especially as there is *no* command to tell it to).
17.Development:Scripting/.testsrx exists.rexx 
I have been summoned
...
I have been summoned...
I have been summoned...


The *only* thing i could think of what AREXX is misinterpreting is the check result (which can be seen with "TS" active, see below).
It seems to interpret the result "1" as new command/program and starts it. Why is that?
Is it really meant to interpret results the way it does?
17.Development:Scripting/.testsrx exists.rexx 
  2 
*-* ;
  
*-* SETCLIP('boot_scripts',1);
      >>> 
"boot_scripts"
      
>>> "1"
      
>>> "1"
  
*-* ;
  
*-* SAY 'I have been summoned...';
      >>> 
"I have been summoned..."
I have been summoned...
>+> 
>+> 
  
*-* IF GETCLIP('boot_scripts')=1 THEN
      
>>> "boot_scripts"
      
>>> "1"
>+> 
    
*-* ;
    
*-* SETCLIP('boot_scripts',2);
        >>> 
"boot_scripts"
        
>>> "2"
        
>>> "1"
  
*-* ;
  
*-* SAY 'I have been summoned...';
      >>> 
"I have been summoned..."
I have been summoned...
>+> 
>+> 
  
*-* IF GETCLIP('boot_scripts')>1 THEN
      
>>> "boot_scripts"
      
>>> "1"
>+> 
    
*-*  DO;
      
*-* val=GETCLIP('boot_scripts');
          >>> 
"boot_scripts"
          
>>> "2"
>+> 
      
*-* val=val-1;
          >>> 
"1"
>+> 
      
*-* SETCLIP('boot_scripts',val);
          >>> 
"boot_scripts"
          
>>> "1"
          
>>> "1"
  
*-* ;
  
*-* SAY 'I have been summoned...';
      >>> 
"I have been summoned..."
I have been summoned...
>+> 
>+> 
     
10 *-* END;


I don't think i have something special installed (not in terms of anything AREXX, at least)

Can someone confirm?
If not, there's once again something fishy in my setup.

Thank you

Go to top
Re: The AREXX thread (Questions, hints, ideas)
Just can't stay away
Just can't stay away


See User information
(http://aminet.net/util/rexx/ARexxGuide2_0A.lha)

SETCLIP() returns BOOL value, so it returns 1 on the console and "finds" 1.rexx and runs it.

just put/add a return variable to store the return value:
rv = SETCLIP()

...
rv = SETCLIP(<clipname>, [<value>])()
rv is a Boolean value

Sets the <value> associated with <clipname> or deletes the named clip if <value> is not specified. The search for <clipname> within the clip
list is case sensitive.

Example:
say setclip('Molloy','Samuel Beckett'); >>> 1
say getclip('Molloy'); >>> Samuel Beckett


Also see GETCLIP
RXSET command
...


RX command help:
..
EXAMPLES
1> RX script.rexx arguments

Launch the ARexx command "script.rexx"; note that the command name suffix is omitted and defaults to ".rexx"

1> RX script arguments

Go to top
Re: The AREXX thread (Questions, hints, ideas)
Home away from home
Home away from home


See User information
@jabirulo

I just remembered some similar problem i had in the past and it seems to also fit here: Always use CALL for commands

I had forgotten about that "feature"

Thank you

Go to top

  Register To Post

 




Currently Active Users Viewing This Thread: 1 ( 0 members and 1 Anonymous Users )




Powered by XOOPS 2.0 © 2001-2024 The XOOPS Project