ChrisHSoftware DevPosted
14 years agoI'm trying to get a simple AmigaDOS script to work on AROS, and have run into a problem which I can't solve. Here is basically what I am doing:
[code]SetEnv AnnPathReply ""
RequestFile TITLE "Where is Annotate located?" DRAWERSONLY >Env:AnnPathReply
IF "$AnnPathReply" EQ ""
SKIP Quit
ENDIF
LAB Quit[/code]
On AmigaOS4 this works as expected, but on AROS the "IF" command gets very confused by the fact that the AnnPathReply already contains quote marks, and so gives this error message:
[quote]If: wrong number of arguments[/quote]
If I have "Set echo on" enabled, then you can see why it gets confused:
[quote]IF ""Work:Chris/Annotate/"" EQ ""[/quote]
Please do NOT suggest that I remove my quotes around $AnnPathReply, because when I cancel RequestFile the IF line would fail because it'd look like this:
[quote]IF EQ ""[/quote]
Also note that RequestFile does NOT return an error code when cancelled (not on OS4 either), so I can't use "IF WARN".
I'm kinda shocked that using RequestFile in a script isn't possible on AROS. Hasn't anyone else run into this problem? Or is there some other solution I overlooked? As it currently stands I can't write a simple installer script that works on AROS :-(
Hi Chris
[quote]Also note that RequestFile does NOT return an error code when cancelled (not on OS4 either), so I can't use "IF WARN".[/quote]
That's strange, as [url=http://aros.sourceforge.net/documentation/users/shell/requestfile.php]our documentation[/url] state that it does.
Not that i don't believe you, but are you sure ?
ChrisHSoftware DevPosted
14 years ago@magnorium
My mistake. RequestFile does indeed set WARN when cancelled. (I think) this solves my problem :)
Nice, such a dual question on multiple forums ;)
Good that it does, as that means the documentation is not lacking :)
If it doesn't solve the problem then please post script again :D.
I f believe it's something like:
[code]REQUESTFILE >ram:blah Title etc.
IF WARN
echo 'filename not returned'
ELSE
echo 'filename was returned'
ENDIF[/code]
ChrisHSoftware DevPosted
14 years ago[quote](I think) this solves my problem[/quote]
Damn. No it doesn't, because now the script doesn't work on OS4 (and perhaps not MOS either - can't test at the moment).
I need to choose different (script) code for AROS vs not. Is there any easy way to identify whether a script is running on AROS or not?
[quote] Nice, such a dual question on multiple forums ;)[/quote]
If you want, I can just post on aros-exec ;)
[quote]Is there any easy way to identify whether a script is running on AROS or not?[/quote]
Shall i post a different solution here ? ;) nah, use the ABI environment variable. afaik it is aros specific.
[quote]If you want, I can just post on aros-exec[/quote]
Uhm... please don't .. i will repeat my answers if there aren't coming any better ones @ ae :-)
BTW: should there be an OS environment variable. Even winblows has it. Oops, you could make such thing yourself in the startup-sequence or user-startup :hint:
ChrisHSoftware DevPosted
14 years agoAs I said on the 'other' forum... Thanks for the ABI env suggestion: It works :)