![]() |
![]() |
#1 |
Moderator
Join Date: Nov 2004
Location: Eksjö / Sweden
Posts: 5,756
|
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?
![]() |
![]() |
![]() |
#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. ![]() |
![]() |
![]() |
#3 |
Moderator
Join Date: Nov 2004
Location: Eksjö / Sweden
Posts: 5,756
|
Looks like a good entry book even for those who don't yet grasp RAD PIPEs!
![]() Thanks pmc ![]() |
![]() |
![]() |
#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" |
![]() |
![]() |
#5 |
Registered User
Join Date: Oct 2009
Location: Germany
Posts: 3,326
|
Is that somewhere documented? The magic with "?".
|
![]() |
![]() |
#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. |
![]() |
![]() |
#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.
|
![]() |
![]() |
#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" |
![]() |
![]() |
#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. |
![]() |
![]() |
#10 |
Registered User
Join Date: Jan 2002
Location: Germany
Posts: 7,047
|
|
![]() |
![]() |
#11 |
Banned
Join Date: Nov 2007
Location: Trondheim, Norway
Posts: 1,893
|
|
![]() |
![]() |
#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:
|
|
![]() |
![]() |
#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. |
![]() |
![]() |
#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 ![]() |
|
![]() |
![]() |
#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
![]() |
![]() |
![]() |
#16 |
Registered User
Join Date: Sep 2007
Location: Stockholm
Posts: 4,377
|
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 |
![]() |
![]() |
#17 |
son of 68k
Join Date: Nov 2007
Location: Lyon / France
Age: 51
Posts: 5,388
|
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 |
![]() |
![]() |
#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. |
||
![]() |
![]() |
#19 | |
son of 68k
Join Date: Nov 2007
Location: Lyon / France
Age: 51
Posts: 5,388
|
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. |
|
![]() |
![]() |
#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 | |
![]() |
||||
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 |
|
|