22 November 2011, 02:10 | #1 |
Moderator
Join Date: Nov 2004
Location: Eksjö / Sweden
Posts: 5,759
|
AmigaDOS scripting resources
Post your tips, manual links, and above all examples here. It would also be nice with an overview guide regarding how it all hangs together (Thomas? )
|
22 November 2011, 09:07 | #2 |
gone
Join Date: Apr 2007
Location: completely gone
Posts: 1,596
|
I don't know very much about this stuff but there is this manual:
http://amiga-manuals.xiik.net/ebooks...0eBook-ENG.rar It has a whole chapter (Chapter 5) on Command Sequence Files (scripts) for AmigaDOS. |
22 November 2011, 19:20 | #3 |
Moderator
Join Date: Nov 2004
Location: Eksjö / Sweden
Posts: 5,759
|
Looks like a good entry book even for those who don't yet grasp RAD PIPEs!
Thanks pmc |
24 December 2017, 10:33 | #4 |
Banned
Join Date: Nov 2007
Location: Trondheim, Norway
Posts: 1,893
|
Not much here
I am sometimes asked how one can put user input into a variable, well, this is one way: Code:
Echo noline "What is your name? " Set >NIL: answer ? Echo "Hello, $answer" |
24 December 2017, 14:41 | #5 |
Registered User
Join Date: Oct 2009
Location: Germany
Posts: 3,326
|
Is that somewhere documented? The magic with "?".
|
24 December 2017, 16:40 | #6 |
Registered User
Join Date: Jan 2002
Location: Germany
Posts: 7,047
|
I am quite sure that one of the very first things explained in the AmigaDOS manual is that you get a template of the command's parameters if you enter a question mark and it then waits for input so you can enter only the missing/wrong arguments and don't have to re-enter the whole command.
Hiding the template and using the input in a script is a nice trick but surely no magic. |
24 December 2017, 17:19 | #7 |
Registered User
Join Date: Oct 2009
Location: Germany
Posts: 3,326
|
I wasn't sure if the "?" does something special in this case or it is "just" the command template thing. Yes, the trick is nice but I would never find this solution by myself without documentation. I don't know if an other way is described in AmigaDOS manual.
|
25 December 2017, 03:24 | #8 |
Banned
Join Date: Nov 2007
Location: Trondheim, Norway
Posts: 1,893
|
Sure there are others ways, like the shell internal "ask" command, which I'm sure is documented...
Code:
Ask "What is your name? " string to answer Echo "Hello, $answer" |
25 December 2017, 14:49 | #9 |
Registered User
Join Date: Oct 2009
Location: Germany
Posts: 3,326
|
Yes, "Ask" is more or less for Yes/No questions.
I think it is well known but the backtick "trick"/function is sometimes nice: Code:
Set file `RequestFile` Echo "Your choice: $file" The char in front of and after RequestFile must be backticks. I pressed Shift + '`-key then Space. On my german pc keyboard it is the key right of ß key. I don't know if that is correct. |
25 December 2017, 15:38 | #10 |
Registered User
Join Date: Jan 2002
Location: Germany
Posts: 7,047
|
|
25 December 2017, 15:50 | #11 |
Banned
Join Date: Nov 2007
Location: Trondheim, Norway
Posts: 1,893
|
|
25 December 2017, 15:55 | #12 | |
Banned
Join Date: Nov 2007
Location: Trondheim, Norway
Posts: 1,893
|
Yes, it is rather primitive, room for improvements (a "HIDDEN/S" option, or "STAR/S" option, for passwords, for example).
Quote:
|
|
25 December 2017, 16:18 | #13 |
Banned
Join Date: Nov 2007
Location: Trondheim, Norway
Posts: 1,893
|
Must have shell extension tools from Aminet:
http://aminet.net/package/util/shell/Pipe-1.5 http://aminet.net/package/util/shell/EArg Makes it possible to, for example, do things like... Code:
List all files p=#?.info lformat "%p%m" | earg "ProcessIcon MWB2CI" Last edited by kolla; 25 December 2017 at 16:33. |
26 December 2017, 12:21 | #14 | |
Registered User
Join Date: Feb 2008
Location: RNO
Posts: 1,010
|
Quote:
Code:
List all files p=#?.info lformat "*"%p%m*"" So, here's a modified version using just the standard commands, and I'd prefer doing it this way: Code:
List all files p=#?.info lformat "ProcessIcon MWB2CI *"%p%m*"" > T:MyBatchConvertScript Execute T:MyBatchConvertScript About the original question about manuals or resources, I think the best starting point is just read the official Amiga manuals which you either got with the machine or on CD (3.5/9). I've learned all I know about Amiga Shell and its scripts just by reading that single AmigaDOS manual The official OS3.9 HTML manual is just fine to keep open on a browser when writing scripts. You don't practically need anything else to understand what you can do. |
|
26 December 2017, 16:46 | #15 |
Banned
Join Date: Nov 2007
Location: Trondheim, Norway
Posts: 1,893
|
Yes, hehe, as expected. I kinda knew using List output as example was a bad choice, since it already does text formatting using LFORMAT, that wasn't really what I wanted to illustrate
|
26 December 2017, 17:15 | #16 |
Registered User
Join Date: Sep 2007
Location: Stockholm
Posts: 4,381
|
Andy Finkel (ex-Commodore) has made a useful "for each in" command: http://aminet.net/package/util/cli/finkelshelltoo
There is also an alternative here: http://aminet.net/package/util/cli/foreach |
26 December 2017, 17:19 | #17 |
son of 68k
Join Date: Nov 2007
Location: Lyon / France
Age: 51
Posts: 5,391
|
Aside of the fact the above script removes ".info" from the file names, it could be done with standard SPat script present in "S" dir :
Code:
s:spat ProcessIcon #?.info MWB2CI |
26 December 2017, 20:04 | #18 | ||
Banned
Join Date: Nov 2007
Location: Trondheim, Norway
Posts: 1,893
|
Quote:
Quote:
Here is a challenge - make a commandline that uses processicon _only_ on directories, and _not_ files. |
||
26 December 2017, 20:32 | #19 | |
son of 68k
Join Date: Nov 2007
Location: Lyon / France
Age: 51
Posts: 5,391
|
Of course, else i wouldn't have told about it.
Quote:
I just told about SPat, specifying the difference would be it does not remove the ".info". Please don't take it as a criticism of what you wrote, it wasn't the intent at all Single line command, nope - would do it with a two-liner script. |
|
26 December 2017, 20:57 | #20 | ||
Banned
Join Date: Nov 2007
Location: Trondheim, Norway
Posts: 1,893
|
Quote:
My idea was to give a hint about a nice tool that can build and run lines from stdin Quote:
Except, there are a few dragons: - only dirs with corresponding .info files are wanted - %p expands to a string with trailing / Thre latter may explain why there sometimes are files named just ".info" here and there Last edited by kolla; 26 December 2017 at 21:05. |
||
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
UAE Scripting Layer | FrodeSolheim | support.FS-UAE | 15 | 26 January 2014 15:56 |
C= 64 BASIC as a Scripting Language | Charlie | Retrogaming General Discussion | 2 | 17 November 2008 14:23 |
AmigaDOS 1.3 Scripting Language | redblade | Coders. General | 10 | 16 August 2008 12:58 |
Resources?? | DDNI | project.WHDLoad | 5 | 25 April 2007 20:42 |
|
|