Login
Username:

Password:

Remember me



Lost Password?

Register now!

Sections

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

Members: 0
Guests: 124

more...

Headlines

 
  Register To Post  

Pick up a canceled requestfile
Just can't stay away
Just can't stay away


See User information
I have tested several approaches to detect the case when a requestfile is canceled. None works (OS4.1 Update 6,, not tested on OS4.1FE
(for requeststring there are no such problems)
eg

unset m  can i test if m is set?
 
set m `REQUESTFILE TITLE="Choose your music"`
 echo 
$m  ;prints $m  if canceled 
 
; if $m EQ ""
 
if $m EQ "\$m"
    
echo "No music"
 
endif
 unset 
m


Has anyone a suggestion ?

Go to top
Re: Pick up a canceled requestfile
Just can't stay away
Just can't stay away


See User information
@JosDuchIt

Try to keep it simple, this should work

DELETE T:music FORCE QUIET
REQUESTFILE TITLE
="Choose your music" ACCEPTPATTERN="*.(mp3|mod|wma|m4a)" TO T:music
IF NOT WARN
  
;play music command goes hereeg.
  
playtunes <T:music
  DELETE T
:music FORCE QUIET
ELSE
  ECHO 
"No Music"
ENDIF


If the redirection doesn't work try:

IF NOT WARN
  SET m 
`TYPE T:music`
  
playtunes "$m"
  
UNSET m
ENDIF


or simpler:
IF NOT WARN
  playtunes 
`TYPE T:music`
ENDIF


If IF NOT WARN doesn't work you can use IF EXISTS T:music instead as the file isn't created if you cancel the requester.

edit: changed code a little to remove pointless if exists check.

Amiga user since 1985
AOS4, A-EON, IBrowse & Alinea Betatester

Ps. I hate the new amigans website. <shudder>
Go to top
Re: Pick up a canceled requestfile
Not too shy to talk
Not too shy to talk


See User information
@JosDuchIt

This should work:

set m ""
set m `REQUESTFILE TITLE="Choose your music"
if 
$m EQ "" 
   
echo "No music" 
endif


Quote:
can i test if m is set?


Yes:

get >nilm
if warn
  
echo "m is not set"
else
  echo 
"m is set to $m"
endif

Go to top
Re: Pick up a canceled requestfile
Just can't stay away
Just can't stay away


See User information
Thanks Severin & Thomas

Go to top
Re: Pick up a canceled requestfile
Just can't stay away
Just can't stay away


See User information
@thomas

Quote:

set m ""
set m `REQUESTFILE TITLE="Choose your music"`
if $m EQ ""
echo "No music"
else
echo "music $m"
endif

saved as thomas.bat & protected +S
gives me the following output



5.Stock:Backup_Datas/Gui4Cli/C/RTF-Riddle> thomas.bat
music Thomas.bat

when selectingt the script
5.Stock:Backup_Datas/Gui4Cli/C/RTF-Riddle> thomas.bat
music

when hitting cancel

It does not seem to solve the issue imho a canceled requestfile returns something that looks like an empty string but is not?






Go to top
Re: Pick up a canceled requestfile
Not too shy to talk
Not too shy to talk


See User information
Sorry, I didn't see the missing quotation marks. The if statement has to look like this:

if "$meq ""



Go to top
Re: Pick up a canceled requestfile
Just can't stay away
Just can't stay away


See User information
@thomas Works OK that way

Thanks

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-2023 The XOOPS Project