log in | register | forums
Show:
Go:
Forums
Username:

Password:

User accounts
Register new account
Forgot password
Forum stats
List of members
Search the forums

Advanced search
Recent discussions
- Upgrading your RISC OS system to 5.30 (News:2)
- WROCC May 2024 meeting on wednesday - Gerph talks games (News:)
- Wakefield Show 2024 in Pictures (News:4)
- RISC OS 5.30 arrives (News:1)
- April 2024 News Summary (News:1)
- uniprint upgraded to 4.50 (News:)
- PhotoDesk 3.23 released (News:)
- R-Comp reveals N.Ex.T Boxes - the successor to the i.MX6 (News:)
- RISCOSbits at Wakefield Show 2024 (News:)
- R-Comp releases Genealogy v2 (News:)
Latest postings RSS Feeds
RSS 2.0 | 1.0 | 0.9
Atom 0.3
Misc RDF | CDF
 
View on Mastodon
@www.iconbar.com@rss-parrot.net
Site Search
 
Article archives
The Icon Bar: Programming: %*0
 
  %*0
  (17:11 6/6/2002)
  Phlamethrower (17:19 6/6/2002)
    ninj (17:47 6/6/2002)
      Phlamethrower (17:54 6/6/2002)
        bmsh (14:58 15/6/2002)
          Hertzsprung (12:43 7/6/2002)
            Phlamethrower (14:07 7/6/2002)
              Matthew (14:40 7/6/2002)
                bmsh (15:19 7/6/2002)
                  Matthew (07:54 8/6/2002)
            Matthew (14:58 15/6/2002)
              Phlamethrower (14:58 15/6/2002)
 
bmsh Message #5131, posted at 17:11, 6/6/2002
Unregistered user Could anyone point me in the direction of a reference to the %*0-style references that you find in !Run files and the like? I've seen a few different variations but can't work out what each character means or whatever.

I've got the PRMs on CD but can't work out what to look up in the index...

  ^[ Log in to reply ]
 
Phlamethrower Message #5132, posted at 17:19, 6/6/2002, in reply to message #5131
Unregistered user The syntax is something like:

%[*]<num>

Where <num> is the parameter number, starting at 0, and * is a flag to include all parameters from there on. E.g.:

!Test contains 'echo %1 monkeys went to %*2' would do:

!Test foo 1234 one two three

1234 monkeys went to one two three

Is that OK?

  ^[ Log in to reply ]
 
ninj Message #5133, posted at 17:47, 6/6/2002, in reply to message #5132
Unregistered user The variations in the syntax are probably those where you need to be able to pass it through GStrans and not hardcode the value of the variable at that time.

In simple terms it means that if you called
Set Alias$RunType_FFF dump %0
it would determine what %0 was at that time and subsitute it. It it would end up always dumping out the same file when you clicked on a text file.

So instead they use a form that turns into %0 when evaluated. That's done by doubling up the % - so %%*0 turns into %*0, %%1 turns into %1. [Is that right? I don't have an obey file to hand]

I think I read it documented in the Archimedes User Guide. That (or a recent incarnation of it) should be in the Manuals directory on your hard disc, I think. In the PRMs it's probably a feature of OS_CLI, and the %% business is a feature of GStrans.

  ^[ Log in to reply ]
 
Phlamethrower Message #5134, posted at 17:54, 6/6/2002, in reply to message #5133
Unregistered user That's a good point - % acts as the 'escape character', like / in C. So %%0 would be converted to %0, and %0 would be converted to the value of parameter 0
  ^[ Log in to reply ]
 
Hertzsprung Message #5136, posted at 12:43, 7/6/2002, in reply to message #5135
Unregistered user You'll be needing SYS "OS_GetEnv" I believe. If you've got the PRMs it'll be in there...
  ^[ Log in to reply ]
 
Phlamethrower Message #5137, posted at 14:07, 7/6/2002, in reply to message #5136
Unregistered user Or a StrongHelp manual. Be warned though - I think you may need to manually read the string character by character into a BASIC string - I'll give an example if you need one.
  ^[ Log in to reply ]
 
Matthew Message #5138, posted at 14:40, 7/6/2002, in reply to message #5137
Unregistered user
Or a StrongHelp manual. Be warned though - I think you may need to manually read the string character by character into a BASIC string - I'll give an example if you need one.

You can do SYS"OS_GetEnv" TO A$ to read it into a string. Then do some mucking about with INSTR and LEFT$,RIGHT$ etc., or try and use OS_ReadArgs. Not the most intuitive way of passing variables to a program...

  ^[ Log in to reply ]
 
bmsh Message #5140, posted at 15:19, 7/6/2002, in reply to message #5138
Unregistered user Thankyou to to everyone for their help -- I'm very grateful.

Matthew, when you say that it's not the most intuitive way of passing variables do you mean there's a better way, or just that the available methods aren't very intuitive?

  ^[ Log in to reply ]
 
Matthew Message #5142, posted at 07:54, 8/6/2002, in reply to message #5140
Unregistered user
Matthew, when you say that it's not the most intuitive way of passing variables do you mean there's a better way, or just that the available methods aren't very intuitive?

I don't know of a better way if you're using BASIC, no. Anyone?

  ^[ Log in to reply ]
 
bmsh Message #5135, posted at 14:58, 15/6/2002, in reply to message #5134
Unregistered user Thanks, guys, that's explained it for me. Now on to the next problem: is there a way to read these parameters from a BASIC program?

What I mean is, if I have done *Set Alias$RunType_XXX <App$Dir>.!RunImage %%0 (or something) where !RunImage is a BASIC program, is there a way to read the name of the file double-clicked on from my program?

I'll try looking this up at home tonight but I'm not entirely confident of being able to find the answer myself... unhappy

  ^[ Log in to reply ]
 
Matthew Message #5139, posted at 14:58, 15/6/2002, in reply to message #5136
Unregistered user
You'll be needing SYS "OS_GetEnv" I believe. If you've got the PRMs it'll be in there...

Does no-one realise that the StrongHelp manuals are all online, courtesy of AcornSearch? smile

The entry for OS_GetEnv.

  ^[ Log in to reply ]
 
Phlamethrower Message #5141, posted at 14:58, 15/6/2002, in reply to message #5139
Unregistered user
Does no-one realise that the StrongHelp manuals are all online, courtesy of AcornSearch? smile

No. Or at least I didn't tongue

  ^[ Log in to reply ]
 

The Icon Bar: Programming: %*0