User avatar

Posted Wed Nov 09, 2022 3:47 am

From "SimCity additions"

Batchrequester issue - solved

It was simply the wrong ASL.LIBRARY version. BATCHREQUESTER depends heavy on asl.library and as it seems i had (for a test which has endet right now) installed a not 100% compliant asl.library revrting this to V37.27 solved the issue completely i can start now batchrequester n-times and it won't hang or crash the OS (which it occasionally did before, not when i run the program itself from the cli but when it was invoked by a script which it is meant for).

Really i thought it could be my fault and in a further sense it was but problems caused by a different library version usually appear only sparse up to almost never and then you mostly don't expect that it will be a specific librarary, since it is a requester it was quite obvious that the cause must be the asl.library and it was the first i tried today.

The funny thing is if i use a different version the OS sometimes didn't finds the program itself when i use a different name for it, as you might know i renamed batchrequester to batchreq (i'm a lazy typer - no i can't type at all i'm a typical hacker if it was about me i would name batchrequester simply "br" - yes i know...)
and strangewisely the OS often returned "not found". Using the proper library version this never happened (after 100 and one tries) neither that the program will hang, didn't pops up the requester or in the worst case crashes the OS.

Just to tell the problems wasn't caused by my script(s) they was caused by the wrong library version.

It would have been very sad to toss Batchrequester since it is the only fully functional filerequester to use in OS1.3 scripts.

User avatar

Posted Thu Nov 10, 2022 9:31 am

OK, i said "how to automate creating icons for new files in OS1.3"

But before i start with the scripts an essentiyl program for maintining icons especially if you like to have your own for reasons of compliancy.

(what had he in mind when he chose the name "iconmiser" - miserable?)
This nice tool, nah commodity since it runs in the background, works for any OS (known to me, above 3.1 i can't judge), and does what it should do very well, it exchanges an icon stored by any program with one of your choice, you can exchange the image or the whole icon (if you need different tooltypes i.e.) or get totally rid of the icon. In OS1.3 obviousely the drag and drop won't work but any else functions flawless. Of course since it stays in the background it exchnges them as soon as they are created, you won't notice a tid bit of that except that you will have your own icon to look at i.e. for a picture saved by DPaint. It is also straightforward in use and one doesn't have to read any instructions to understand how to use it. Just (drag & drop) enter the name of the to replace icon, enter the name of the new icon, decide to replace image, complete replacement or no icon at all, accept changes, store pref, basta.

Sure this won't create icons for new files but it is to me an essential helper to maintain icons, no matter OS1.3 or OS3.1.
If you ike to have icons in a similar style or in a given size IconMiser isn't to forgo.

Now to the little more difficult task to create an icon for a new file.
To be honest until i only use this in my "editor" script (it simply starts Ed for me - "simply" lol), but this could be added to any script with which you start such a generic program like Ed.

What you need to create an icon for a new file is first to determine if that file is a new one.
That is not as hard, just list the <PATH> you entered for the file you edit to a temp file, a minimal list will do the job it just needs a date and that is all. It solves two things at once, first if that is a existing file list stores the timestamp if not list stores nothing but the empty temp file will exist, that is of course only if you list to >sdtout via redirection if you use LIST TO it won't create a file if there is no file present to be listed, redirection always creates a new file no matter what the result of the program is.

As next in the script you can start the program, in this case Ed.
Do you edits and exit Ed.

Then again use list in the script and list the same <PATH> to a new temp file (same procedure).

You have now two files to compare.

If temp file a differs to temp file b the file has been edited, this comparison can be a simple one you don't have to compare the date itself, the byte count will differ and this means "unequal" that is enough.
IF NOT $file_a EQ $file_b
execute edprotect
this you won't really need to determine if it's a new file and if an icon belongs to it, but in my variant it plays a little role it calls PROTECT via a script and allows me to determine what sort of ascii file it is i created, for this i added an own manner of differing them, RWED is a project (receives default project icon), SRWD is a script (receives default script icon), RWD is plain text (receives ASCII default icon).
(additionally i write the filetype in the comment field but this isn't needed at all)

If temp file a is empty it must be a new file
IF "$file_a" EQ ""
execute createicon

In this step the icon is simply copied from ENV:SYS/... to <PATH>.info
"simply" means it will decide which icon is to use based on the file protection i applied to the file.

It could be any directory you stored them, an ICONS: dir on you HD will do it as good as to store them in ENV:
OK, if you run a OS2.x or above program in OS1.3 (of course one which works) and this program takes the default icon for new files from ENV:SYS then it plays a little role. That is the case for DirWork, while unfortunately this works for new files created by DirWork but if you select "add icon" it will take the image out of the program itself, dunno why if you have default icons and you use it for new files why don't use the same turd for "add icon"? I don't understand.
And a case IconMiser can't help, this isn't to clear to me but somewhere must be a difference between what DirWork stores and what is effectively written to the media, at least DirWork internal created icons aren't recognized by IconMiser, right now i have an idea let's extract the turd instead to use the created icon even if it's just a single byte which differs this will be enough to hinder IconMiser. DirWork runs well in 1.3 but i always disliked that it uses internally stored OS2.x icons if you select "add icon" instead of the ones in ENV:SYS

User avatar

Posted Thu Nov 10, 2022 9:32 am

Besides i prefere DirWork over DirectoryOpus to me it is far to blown up 50% of what DOpus offers you will use never up to almost never. I have DOpus for my A4000 or since i have my A4000 but well... a matter of choice.
Overall for a daily use to copy, move, rename, extract, a program like S.I.D does it as good as both and the good thing is for SID you don't need to spend an afternoon to make an OS1.3 look since it is a OS1.3 program.

However this method could be used of course for any editor, EMACS or whichever which stores no icons for new files.
To add a script to them makes to me a lot of sense since i can make use of the filerequester and i don't have to type in what file is to open, further i can use most of the time the shift click manner even if the program itself is a CLI program and doesn't supports this. More even i can add a short help or reminder or the syntax.

A slight problem there is within projects and shift click, it isn't possible for a script to open a tool in this manner the OS will always invoke the tool before the project, but for a text editor this plays absolutely no role.

In principles this can be adapted for other programs as an editor as well, it depends on the program.
To recognize a binary is quite easy all what is refused by Ed to open must be a binary and will receive the default icon for a binary.
Filetypes could be differed using a filetype tool, there are a couple of them on aminet i just didn't tried them out yet.
If you don't like that and like to script your own, no problem as well.

Most files have a header, in the header is always a identifier stored for all IFF this will be a ASCII string which will help you a lot, no big deal to differ an IFF image from an IFF 8SVX.
But even if that isn't to see there will be an identifier it's in this case just a hex value, but you can use the web to understand the header structure (chunks).

Well and if it leaks of all that then it is most probably a headerless binary, to determine here between them isn't as easy
they have obvious differences to the human eye but that will be hard to retrieve by a script or program.
To keep that simple i would use the default icon "undefined" for all of them.
But yes it can be evaluated, at least i see a possibility for sound streams because they are somewhat unique, no other file will have so many 0x00 and 0xFF stored as a signed PCM, you can depend on this, same for unsigned then it's just 0x7F and 0x80 you have to look for.
but on the other hand there aren't many tools which can create such a raw audio stream and mostly this program will have the sole purpose to edit sound and then it will be clear what it stores.

As soon as you know the filetype it's a sneeze to copy the proper default icon to a new file, determine if that is a new file in the same manner as i showed it for Ed, simply compare the LIST output before and after editing.
Theoretically - no, practically - this allows you even to tell if a file was edited and it could receive a slightly different icon as a new file or you can use FILENOTE and store as comment edited: (date)

Just well, to reach this most programs will receive a script wrapper.

And well maybe that is a reason why we love the Amiga - it gives us endless work, it's just not funny when all works flawless by pressing of a button ;)

No tension, no action, but if you solved the smallest problem by yourself you feel like Archimedes and like to run naked through your hometown shouting out "heureka!"

User avatar

Posted Thu Nov 10, 2022 9:56 am

The Amiga forces users to get interested in programming or at least to create something with it, it invokes creativity.
That was to see also for my beloved Inty, as soon as "Nanochess" released his IntyBASIC which isn't an interpreter it is BASIC in programming but will be converted to an assembler program (based on Joe's SDK1600) since any else won't work for an Intellivison ROM and the final purpose of it is to create new games for this old console.

Hower after this release games popped up like mushrooms after the rain.

Somehow that is funny, because the SDK1600 isn't that hard to understand, i guess most are just paralysed by the idea "assembler". Because if you know how to write a game in BASIC you won't be far from understanding how to use the SDK to create a game. But all the years before the interest in programming for the Inty was very sparse, just because of "shocking it's assembler".

User avatar

Posted Fri Dec 02, 2022 8:44 am

A slight mistake in the online manual to Amiga scripting ... ng_Scripts

this here:
.<space> Comment line. Be sure to include the space following the dot to avoid producing an error. Note that the preferred method for entering comments is with a semicolon (;).
this could give a reader the impression that the semicolon is to prefere for commenting in fact it's literally written here.

Any else they stated about .DOT and substitution is proper but this isn't.
This contradicts to the original manuals which clearly state that the semicolon is for inline commenting and a DOT comment line will be skipped just like REM for a MS-DOS batch.

Again i've read that right yesterday and i thought "hmmm.... that clearly contradicts".
thus let's se who is right here the original manuals or the online scripting help
on a fast machine you won't notice this but i set up two cases "1000 lines of nothing"
for the case01 i used DOT commenting
for the case02 i used the semicolon
and here is the result on an emulated A2000 running approximately at A500 speed.
case one DOT commenting states executed in one second (same second even)
case two SEMICOLON commenting executed in lemme see... in about 4 seconds

the result would even differ a lot more if i would have really commented but i used only "blablabla", either ". blablabla" or ";blablabla" which is a very short "comment line" assumed it would be a longer comment the time to execute would differ even more. (wrote thousend lines? nah but in notepad++ i can simply mark a column and write something to that column otherwise i would have setup a script which would have typed the 1000 lines of blablabla for me).
the reason is simply that a semicolon commenting must be read by execute - the frickin' whole line will be read but not executet any ". " (dot followed by a space) is skipped and won't be read by execute and it won't matter if you use up the 255 columns it will be skipped the same as a single column while "; and 255 columns" all 255 columns will be read but not executed.
any questions?

I was sure it is in this manner but i liked to show it off because a commenting to the online manual isn't possible
Effectively you could have thousend lines of a DOT comment and it won't make the script slower executed a tiny little bit.
As a result one could claim
A .DOT comment line is to prefere over the semicolon IF the whole line is a comment
One could claim?
this is almost the exact text in the manuals to OS1.3 and OS3.1

Why this comment?
Simply because you will have noticed that i use in general ". comment" and prefere it over in line commenting and one might guess it's wrong if he peeps into the online scripting help which tells that the semicolon is to prefere over DOT.

If someone still has doubts here are the two "scripts" and you can try the test case yourself.
I for sure make still a lot of mistakes and errors, i'm far from good and well i like if at least a help is proper.
(1.54 KiB)
It's a bit like the leaking explanation of possible escape sequences for Amiga OS, it leaks of a lot but you have to dig quite deep to find someone who can explain those you never heard of.

Especially this super short and cool thing for OS3 and above (perhaps OS2 as well)

Code: Select all

This sets the background color of a shell window to any of the colors present in the palette (subtitute # with the register nr. of the color, the code looks to me a bit like "redirect color# to shell").

I know many many asked for this how to tint the shell window in OS3.

do not care about what he stated about newer OS's and try the stuff out yourself (in OS3): ... #msg254232
Most i know but at least how to tint a shell window is new to me and even i looked for an answer several times with the usual reply "not needed to do" which means "don't bother me with that because i don't know it".
instead to simply say "pardon me but i don't know it".

Maybe it's "not needed" but it's nice and in my OS1.3 setup i even use random shell colors for certain scripts though they always appear a little different, really useless yes but nice.
Now i can make this for OS3 and i can even select from up to 256 colors to tint the shell background.
Or i could run through all 255 and stress my eyes ;)

User avatar

Posted Fri Dec 02, 2022 10:22 am

Many things aren't "needed" spaceships for a space sim aren't needed for gameplay but would it be a game without that?
Windows in space ships are not only not needed they are hand wavy sci-fi, but it's cool to peep ibnto a space vessel isn't it?
Breasty femals as pilots for the ships are for sure not needed but well...
Games overall aren't of need, heck what fun would be left if we strip all which isn't needed?

User avatar

Posted Thu Dec 15, 2022 5:03 pm

Create a stereo 8SVX in OS1.3

A quite handy script since there isn't any CLI program to create a stereo IFF (as far as i know, there are some with a GUI but maybe one likes to batch process the files). As usual from two streams, the samples must have the same length (obviousely) and must be in IFF 8SVX format because i read the data from the existing header (that presupposes the data in the header is correct).

- two mono 8SVX files of same length in IFF 8SVX format, suffix ".iff" is default
- dummy 8SVX header file, the simple method to create a header
- SPLITQ, used in the script as "SPLIT", needed to read the data from the header and to split the header from the files
- FILTER, my FILTER hack, this is always needed to strip linefeeds and to type without linefeed
- WC, my WC (wordcount) hack, outputs no descriptions and no linefeed
- PATCH, patch program to write the new data to the new header
- LIST, ARP LIST program, since i need to retrieve only the filename from the path

the script:

Code: Select all

.BRA {
.KET }
.DEF 2ND -2 
.DEF AUTH YourSoft
. --------------------------------------------------------------------------
. $VERMakeStereo20221215YourSoftUnlimited
. MakeStereo IFF 8SVX, enter path without suffix
. sample length depends on free RAM
. new file [PATH[OUTFIX]]
. --------------------------------------------------------------------------
  IF "{Q}" EQ ""
    ECHO "Patience please"
  IF "{Q}" EQ ""
    ECHO "{PATH} doesn't exists"
. --------------------------------------------------------------------------
. get header & file length
. --------------------------------------------------------------------------
D:SPLIT >NIL: "{PATH}.iff" T:MKS{$$}A 0 128
D:SPLIT >NIL: T:MKS{$$}B T:MKS{$$}C 15 8
D:SPLIT >NIL: T:MKS{$$}B T:MKS{$$}LEN1 77 8
D:SPLIT >NIL: T:MKS{$$}B T:MKS{$$}SMP 130 4
ECHO >>T:MKS{$$}A " TO T:MKS{$$}B"
. --------------------------------------------------------------------------
. write temp raw files
. --------------------------------------------------------------------------
. --------------------------------------------------------------------------
. get name and author (limit to 16 resp. 8 characters)
. --------------------------------------------------------------------------
D:REPSTRING >NIL: T:MKS{$$}A T:MKS{$$}B $2E696666 $00
D:WC >ENV:MKS{$$}A -c T:MKS{$$}B
IF VAL $MKS{$$}A GT 16
  D:SPLIT >NIL: T:MKS{$$}B T:MKS{$$}NAME 0 16
D:WC >ENV:MKS{$$}A -c T:MKS{$$}A
. --------------------------------------------------------------------------
. write header
. --------------------------------------------------------------------------
COPY S:8SVX.header T:MKS{$$}HDR
TYPE >>T:MKS{$$}B T:MKS{$$}LEN3 
D:PATCH >NIL: T:MKS{$$}HDR h23 -h {TYP}
D:PATCH >NIL: T:MKS{$$}HDR h5C -h 06
. --------------------------------------------------------------------------
. join files to path
. --------------------------------------------------------------------------
IF "{Q}" EQ ""
  ECHO "MakeStereo 2022 Yoursoft Unlimited*NCreated *E[1m*"{PATH}{OUTFIX}*"*E[0m stereo IFF"
DELETE >NIL: ENV:MKS{$$}#? T:MKS{$$}#? "{TEMPDIR}/MKS{$$}#?"

User avatar

Posted Thu Dec 15, 2022 5:03 pm

That's quite some arguments, you can enter them following the path or change the defaults in the script if you use always the same (which i assume).

PATH is obviousely the path to the source file(s) and mandatory, enter source without suffix!
2ND is the label for the left channel file and expected to follow the filename but to precede the suffix, 2ND defaults to "-2"
TEMPDIR is the directory the temporary raw streams will be written to, default is SYS:Trashcan
SUFFIX defaults to .iff (note that the seperator is included)
OUTFIX optional suffix for the out-file, no default resp. out-file equals to source without suffix
AUTH optional AUTHOR field fill in whatever you like - no program ever reads this ;)
TYP not mentioned to be used at all, this defaults to 0x01 for uncompressed
Q quiet, do not print status

NOTE: the maximum length for a single channel stream depends foremost on the amount of free RAM

PATH, IFF filetype is mandatory and also the sufix .iff for the source files, as i already stated i read the header and file length from the existing header, this presupposes that the header of the source files is correct.
Enter the path to the source files without the suffix!
You can specify a different suffix or make a different to the default with the keyword SUFFIX
2ND is the label for the left channel file and it defaults to "-2" but you can specify anything or set anything as default
TEMPDIR is the temporary directory the script will write the temporary raw streams to, make sure you have enough free space on your chosen drive (the amount of free RAM is rather a problem)
If you specify no OUTFIX the script writes the new file to the path without the suffix specified by SUFFIX, this i assumed as default behave probably change this to your needs.
:) Author the least important thing but i kept at least this it defaults to "YourSoft", the maximum string length for AUTH is 8 anything longer will be simply stripped.
The script writes the filename to the chunk NAME which has a fixed with of 16 characters and will be limited to 16 likewise AUTH to 8.
TYP i only specified for a single reason and it wouldn't have to be a default value. But the dummy header is use has no compression type specified this to keep the dummy header flexible for a different use. Also the chunk CHANNEL is left undefinied in the header but is set in the script this for the exact same reason.

The dummy header has a volume of 0xFFFF instead 0x00FF, this because i own at least one IFF player which expects 0xFFFF as maximum volume and will play in silence when the volume is only a word in length, i dunno what is the correct standard the player is else a very correct playing one and reports every tidbit from the IFF header, however 99% of players default to word length for the volume but won't be affected by a double word at this adress. To keep it compatible with
all to me known players i decided for the double word length.
The dummy header is expected to reside in S:
if you like it to be stored somewhere else you will need to change the call for it in script to this location

This script gonna needs a long time if it's a long stereo sample like a whole song, that is caused mostly by JOIN which needs very long to join the parts.
However if you have a set of files to convert it is still more comfortable as to use a program with a GUI.
A script to use BATCHREQUESTER to select a directory or to shift click on a directory to convert a whole directory of files will follow soon. I didn't included this in this script because it would have complicated all and to convert a couple of or a single file this script is handy enough.

Load the file to a online converting program

Get under circumstances non working stereo IFF samples in return, the reason is in the length of the filename which will be written to the header, any method (else as my script) will write the name in correct string length to the header but won't limit the header length to a multiple of four (4) which will lead to wrong files if the filename is even in length or if it otherwise doesn't matches a total filesize which is divideable by four which happens quite often for both methods. To fix this the filename must match an odd number, all in all that is turd, personally i use a script for JOIN2STEREO which has as temporary outfilename simply IFF thus the header size will always match.

Using the above or a similar script and a dummy header of a given length bypasses this issue completely.
To use a dummy header isn't unusual, Audacity uses for IFF 8SVX as well a dummy header of given size (but can't export to stereo) where simply nothing is written to the chunk NAME.

The script and the used CLI proggies:
get the string length of the filename and author, write the full strings to the header and make the header divedeable by four in length, write the proper string length for both chunks to the header.
But all that isn't needed to play them proper back.

While i worked a lot with eval especailly for the simcity additions i noticed that the OS3.x EVAL leaks of a tid bit the OS1.3 eval offers. While the newer eval allows to calculate with multiple values and operators it leaks of a couple of lformat options such as to indent the output string to a given length (right align) which is very useful if you like to format the output (hence "list-format").

User avatar

Posted Fri Dec 16, 2022 12:51 pm

Quite an interesting read, again.

What surprises me a bit is that I would have suspected such a functionality in programs such Aegis Music or whatever that was called.

As a script, it seems a bit of overkill.

Return to “Software”