English Amiga Board


Go Back   English Amiga Board > Support > support.Other

 
 
Thread Tools
Old 12 January 2014, 15:59   #1
mfilos
Paranoid Amigoid
 
mfilos's Avatar
 
Join Date: Mar 2008
Location: Athens/Greece
Age: 45
Posts: 1,978
Passing parameters to a script via WBRun

Hey guys I'm stuck at some point and I need a bit of help.

I created an AmigaDOS script which gets a parameter via using the .key option.
According to what the script does I also get an output via Echo command.

For example:
Script name: test
Code:
.key input1
Echo <input1>
wait 1
- If I execute the script via the execute command (execute test HelloWorld) everything runs just fine and I get the echo output (HelloWorld) in my current shell.
- If I give an icon with IconX default tool and use the WBRun command (WBRun test HelloWorld) the script runs but my parameter doesn't pass

Since I want to use my script with BMenu (making 4 buttons for my 4 options) I'd rather use WBRun command in order to have the output window.
If I can't pass parameters in my script using WBRun is there another option of running my script via Execute command but having output as it won't run in an already open shell?
mfilos is offline  
Old 12 January 2014, 17:50   #2
daxb
Registered User
 
Join Date: Oct 2009
Location: Germany
Posts: 3,304
Try to set "WINDOW=" tooltype in your Icon with parmeter (eg. window=>con:0/20/300/100/output/wait/close) of course to get an output window.
daxb is offline  
Old 12 January 2014, 18:08   #3
mfilos
Paranoid Amigoid
 
mfilos's Avatar
 
Join Date: Mar 2008
Location: Athens/Greece
Age: 45
Posts: 1,978
I have set that up of course.
Script is working just fine but it doesn't pass any parameter while running it with WBRun.
If I just "echo test" the output window opens just fine.


Edit: I just found out that indeed it passes the parameter, but it also adds a SYS: for some reason :S
For example I run the above script like this:

"execute test HelloWorld" I'll get normally the output window with the line "SYS:HelloWorld" !!!

I for now solved the issue by issuing "SYS:input1" instead of "input1" on the script, but I seriously dislike that solution :S

Last edited by mfilos; 12 January 2014 at 18:53.
mfilos is offline  
Old 13 January 2014, 11:28   #4
mfilos
Paranoid Amigoid
 
mfilos's Avatar
 
Join Date: Mar 2008
Location: Athens/Greece
Age: 45
Posts: 1,978
Ok I found out that the .key parameter works rather strange. To be sure that it's not something of my custom ROMS I just tested it under a clean WB3.1 setup with almost the same output as well!
I even change the brakets by using .bra, .ket commands in case the <> characters create a fuss but still no difference.

So...

In my ClassicWB 3.9 setup:
- If I run the above script from a shell via: WBRun test HelloWorld, I get an output of SYS:HelloWorld.
- If I change vol to RAM: for example and run it again... I get an output of SYS:HelloWorld.

In a Stock 3.1 setup:
- If I run the above script from a shell via: WBRun test HelloWorld, I get an output of System:HelloWorld (System is the name of the system partition volume).
- If I change vol to RAM: for example and run it again... I get an output of Ram Disk:HelloWorld (Ram disk is the name of RAM: volume).

How on earth can I remove the volume name from the .key parameter?

Last edited by mfilos; 13 January 2014 at 11:44.
mfilos is offline  
Old 13 January 2014, 11:46   #5
Bamiga2002
BlizzardPPC'less
 
Bamiga2002's Avatar
 
Join Date: May 2004
Location: Finland
Age: 46
Posts: 3,210
Send a message via MSN to Bamiga2002
How about trying WBLaunch instead of WBRun? Worth a test.
Bamiga2002 is offline  
Old 13 January 2014, 12:02   #6
mfilos
Paranoid Amigoid
 
mfilos's Avatar
 
Join Date: Mar 2008
Location: Athens/Greece
Age: 45
Posts: 1,978
I guess WBLaunch doesn't work with scripts (even with icons).
It gives a "wblaunch: object is not of required type" message one I run it.

So far, I'm doing the job ok with WBRun bit by attaching the extra "SYS:" characters to my parameter name so no problem. It's just that I don't like the behavior.

Edit: Btw I just tried also WBRun2 that just outputs the full path of the directory I'm running the script from. For example if I'm in work:temp and I run "WBRun2 test HelloWorld" I get an output of "Work:Temp/HelloWorld" LOL.

I guess the whole .key parameter is only usable correctly with Execute command. Maybe WBRun/WBRun2 can't work together with parameters using .key dunno :S

Last edited by mfilos; 13 January 2014 at 12:09.
mfilos is offline  
Old 13 January 2014, 12:21   #7
Bamiga2002
BlizzardPPC'less
 
Bamiga2002's Avatar
 
Join Date: May 2004
Location: Finland
Age: 46
Posts: 3,210
Send a message via MSN to Bamiga2002
If you put iconx as default tool WBLaunch surely works dude.
Bamiga2002 is offline  
Old 13 January 2014, 12:29   #8
mfilos
Paranoid Amigoid
 
mfilos's Avatar
 
Join Date: Mar 2008
Location: Athens/Greece
Age: 45
Posts: 1,978
It surely doesn't for the job I want it man.

Take a glimpse for yourself if you don't believe it
https://dl.dropboxusercontent.com/u/939939/wblaunch.avi
mfilos is offline  
Old 13 January 2014, 16:10   #9
daxb
Registered User
 
Join Date: Oct 2009
Location: Germany
Posts: 3,304
I don`t know how to solve or if the problem is WBRun or IconX. At least IconX use already the current path in front of the argument. If it is parsed be WBRun or just IconX is faulty here, I can`t say but I`m not fimilar with DOS scripts.
daxb is offline  
Old 13 January 2014, 16:19   #10
mfilos
Paranoid Amigoid
 
mfilos's Avatar
 
Join Date: Mar 2008
Location: Athens/Greece
Age: 45
Posts: 1,978
It's not such a huge problem as I solved it as I said by just checking SYS:HelloWorld instead of just HelloWorld in my IF statement. It was just awkward and that's why I expressed it here

One other solution would have been to just run it via Execute that runs just fine, and from there to output to another window (but I don't know how to open a new shell that will run the remaining script there).

Anyway, thanks for the help everyone.
mfilos is offline  
Old 14 January 2014, 05:57   #11
Bamiga2002
BlizzardPPC'less
 
Bamiga2002's Avatar
 
Join Date: May 2004
Location: Finland
Age: 46
Posts: 3,210
Send a message via MSN to Bamiga2002
Quote:
Originally Posted by mfilos View Post
It surely doesn't for the job I want it man.

Take a glimpse for yourself if you don't believe it
https://dl.dropboxusercontent.com/u/939939/wblaunch.avi
Yep you we're right just tested it myself too. Isn't WBRun using wbstart.library? Which version of that are you using?
Bamiga2002 is offline  
Old 14 January 2014, 09:03   #12
thomas
Registered User
 
thomas's Avatar
 
Join Date: Jan 2002
Location: Germany
Posts: 7,001
You cannot pass parameters to a Workbench program. If you double click an icon on Workbench the only "parameters" you can pass are other icons which are shift-selected when you double click.

WBRun simulates a double click from Workbench. The arguments you pass behind the program you want to double click are other icons which are shift-selected, may they exist or not.

Those shift-selected icons are passed as pairs of directory they are in and file name. What IconX does is to connect the directory name and the file name as one path which it then passed to Execute. There is no way to remove the directory name from this mechanism. Which wouldn't make much sense anyway because the file could not be found if the directory name was removed.
thomas is online now  
Old 14 January 2014, 10:33   #13
mfilos
Paranoid Amigoid
 
mfilos's Avatar
 
Join Date: Mar 2008
Location: Athens/Greece
Age: 45
Posts: 1,978
Yeah I understood the way it works. Thanks for the thorough clarification as always Thomas.

Just for means of knowledge... is there a way I can redirect the output of my script to a new window or shell?
For example can I just run my script via Execute and output that Echo line in a new window or shell?
I just want to press a button that will execute the script with the passing parameter, but I want the script that will run, to output to a window some info.
mfilos is offline  
Old 14 January 2014, 17:21   #14
daxb
Registered User
 
Join Date: Oct 2009
Location: Germany
Posts: 3,304
You can redirect the output of "echo" direct in the script. E.g.:
echo "bldfdf" >con:0/12/111/55/titel/close/wait
daxb is offline  
Old 14 January 2014, 18:39   #15
mfilos
Paranoid Amigoid
 
mfilos's Avatar
 
Join Date: Mar 2008
Location: Athens/Greece
Age: 45
Posts: 1,978
Yeah I know about that. The fact is that I want to redirect more than 1 echo line.
Putting redirection to console in every line will just give me different output windows
I can also redirect to a file and then open the file for example with type <file> with the redirection you just said.

Cheers anyway
mfilos is offline  
Old 14 January 2014, 18:57   #16
thomas
Registered User
 
thomas's Avatar
 
Join Date: Jan 2002
Location: Germany
Posts: 7,001
I don't know any way to do this with the commands supplied with AmigaOS.

However, you can use the attached program. Run it like this:

Code:
outrun con:0/0/640/200/Outrun/CLOSE/WAIT execute s:test arg1 arg2
Attached Files
File Type: lha outrun.lha (679 Bytes, 150 views)
thomas is online now  
Old 14 January 2014, 21:07   #17
mfilos
Paranoid Amigoid
 
mfilos's Avatar
 
Join Date: Mar 2008
Location: Athens/Greece
Age: 45
Posts: 1,978
Thomas thanks a lot!!!
That was exactly what I was looking for. It works like a charm
mfilos is offline  
Old 14 January 2014, 21:59   #18
Bamiga2002
BlizzardPPC'less
 
Bamiga2002's Avatar
 
Join Date: May 2004
Location: Finland
Age: 46
Posts: 3,210
Send a message via MSN to Bamiga2002
Good good!
So whatcha gonna use it for?
Bamiga2002 is offline  
Old 14 January 2014, 22:29   #19
mfilos
Paranoid Amigoid
 
mfilos's Avatar
 
Join Date: Mar 2008
Location: Athens/Greece
Age: 45
Posts: 1,978
Haha. I make some scripts for Enabling/Disabling some of ClassicWB features and wanted one script for selecting different Boot Logos for my Amiga setup (or none). Of course I could have written a script for every choice but I didn't like that approach.

An example is this:
https://dl.dropboxusercontent.com/u/939939/BootLogo.avi

Now with Thomas script I don't have use WBrun along with an icon using IconX to be able to display an output window for Bloodwych scripts. Nice way to get rid of unused icons
mfilos is offline  
 


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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Recommended DTC parameters for these titles? MethodGit project.SPS (was CAPS) 7 29 July 2012 18:46
Passing arguments to scripts Leffmann Coders. General 4 23 January 2009 20:43
WinUAE commandline parameters Borg_Number_One New to Emulation or Amiga scene 7 04 October 2006 14:34
A list of command line parameters D-Dan request.UAE Wishlist 0 10 June 2004 03:46
Norwegians passing thru OSLO? PLEASE READ :) AmiDelf Amiga scene 0 29 September 2003 15:11

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 12:20.

Top

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Page generated in 0.09219 seconds with 14 queries