You will find here (perhaps with the help of other members) script examples for O.S.1.3 mostly because it can be a difficult task to work around the leaks in O.S.1.3 such as missing backtabbing or very limited handling of environment variables and the complete leak of per process variables.
I would have a couple of scripts started but recently only one is in a state that i dare to publish it.
The first script i will show off here is "Float Dir" which supports "NoIconPos" (v1.0 4-nov-87 AMSoft), noiconpois is a CLI command to as the name intents clear the position of an icon - one single icon. NoIconPos has a drawback it won't perform its action if you pass the suffix ".info" to it thus it can't be run with "DPAT" or "ARP FOR" that's why i scripted this batch proggie.
Sure "FloatIcon" on the other hand as program gives you the opportinity to shift click on a range of icons to float, but if you like to float 100 icons this is stupid and often you will move one unintentinally out of the drawer or if unintentionally doubleclicked move the icon of the drawer containing the icon in its own drawer though it's swallowed by itself in a sort of way.
"Float Dir" does it better if you like to float a whole drawer, it allows you
a) to run the script from CLI and specify a directory
b) to run it from CLI without argument and it will pop up a filerequester to select the desired directory
c) to shift click on the desired drawer on WB
d) to launch the script from it's icon and it will even pop up the filerequester
Let's see how that appears: Nice little script for what i missed since decades.
Before i post the script a list of the the used programs:
- NOICONPOS v1.0 4-nov-87 AMSoft (fish disks, aminet)
- BATCHREQUESTER v1.1 1990 by Christoph Teuber (simple OS1.3 requestfile, aminet)
- FILTER (hack) by Russell Wallace (part of CLI_Utilities, fish disks, aminet)
- REPSTRING v1.0 1988 Luciano Bertato (much easier to use as to program edit, aminet)
- SOUND by GRAMMA SOFTWARE 07 Mar 1991 RLStockton (aminet)
NoIconPos is of course the thing it is all about
Batchrequester i found after a deep search respectively after i tried out a felt 1000 filerequester demos which are useless in a batch but this is exactly what one will need, a bit limited but OK for OS1.3 especially since it is the only really useful i found. The strongest drawback is that it leaks of an errolevel setting for the operation "cancel", it isn't by far the only CLI program which leaks of this all so natural and needed feature for a batch. The author worked around this leak by defaulting the start directory to RAM: and to set as default file "Test" this can be checked if cancel is pressed or OK is pressed without to select a directory other than RAM:, i do not understand proper why in this manner the erorlevel return would be what one expects.
Filter is what you like to filter binaries out of strings, but this thing leaks of filtering LF (0x0A) and filters uselessly all above 0x7E, the tilde thus it was a must to hack it to my needs since as a Swiss i need the umlauts, french citicens will need the apostrophe and nordic users the rest of quirky phonetic characters and so on...
Suggested adresses and values to hack FILTER:
0x0155 from 0x7F to 0xFE (extends qualified character range)
0x015D from 0x0A to 0x1B (keeps "ESC" instead of "LF", thought you have a script edited with M-EMACS or similar which will contain binary instructions for FF, BEL or ESC to have escape sequnces in a text/script without to echo them to it)
0x0165 from 0x09 to 0x07 (keeps "BEL" instead of "TAB", which is the least needed change but i listed it to show the left last qualifier you can hack to your needs)
RepString replaces in a comfortable way a given string with a new string and it is also possible to erase a section of a string in a simple manner. No need to get yourself a messed up brain by using "edit" or "bawk" for the same task just enter the two qualifiers and the in and output files. RepString will always process the whole file and change all occurances of the qualifier, exactly what i need to strip ".icon" off the directory listing to make it suitable for the use with NoIconPos which needs the icon names to be passed to it without the suffix.
Sound, a rather optional program but i like if my scripts play a SFX, as intro, at end and to report positive or negative selections/answers.
"Das scriptli" explained:
Code: Select all
.KEY DIR
.BRA {
.KET }
.
. -----------------------------------------------------------------------------
. OS1.3 Script to float all icons in a directory using NoIconPos, of course
. one could use DPAT, "ARP FOR" or similar commands but unfortunately NoIconPos
. allows no suffix for the icons which means all of the possible commands
. won't work for NoIconPos since under OS1.3 all will pass the suffix to
. NoIconPos.
. This script simply creates a list from the icons in the selected or to
. the script passed directory and erases the suffixes from the listed files,
. unfortunately OS1.3 doesn't supports a formatting of the string with %M
. (lists only names without suffix), as result you will have a nice script
. which can be executed by IconX from an Icon just like a standalone program.
. It will open a file-requester to select the directory and shows in the output
. window the progress of the running script (listing).
.
. ADVANTAGES:
. - Can be invoked from CLI
. - Can be invoked from WB by shift clicking on the desired directory
. - Opens a filerequester if invoked without argument
. - You always missed this possibility to float a whole directory
.
. DISADVANTAGES
. - lumpy script
. - uses many non standard commands/programs
. - not all possible errors are handled proper
. - You might not need it at all
. -----------------------------------------------------------------------------
.
. -----------------------------------------------------------------------------
. ARP CLS or ECHO "*E[H*E[J" NOLINE
. give the window a different color as WB background
. -----------------------------------------------------------------------------
ECHO "*E[42;33m*E[H*E[J" NOLINE
.
. -----------------------------------------------------------------------------
. Show help in sys:system/help which is my default help dir for my scripts
. this makes a) the scripts smaller b) gives the possibility to read the help
. of a "silent executed" script like this without to invoke it from CLI.
.
IF "{DIR}" EQ "H"
RUN >NIL: >NIL: EXECUTE S:showhelp FloatDir
QUIT
ENDIF
.
. -----------------------------------------------------------------------------
. use filerequester if DIR is empty
. -----------------------------------------------------------------------------
IF "{DIR}" EQ ""
LAB #START#
RUN <NIL: >NIL: D:SOUND SFX:beep/beep13 Q D V32
D:BATCHREQ >NIL: ENV:FD{$$}A "Select directory (no file!)" RAM:
.
. -----------------------------------------------------------------------------
. assumed it's invoked from CLI or from WB with shift-click
. -----------------------------------------------------------------------------
ELSE
RUN <NIL: >NIL: D:SOUND SFX:beep/beep13 Q D V32
ECHO >ENV:FD{$$}A "{DIR}/" NOLINE
ENDIF
.
. -----------------------------------------------------------------------------
. check if cancel is pressed, directory variable is empty
. -----------------------------------------------------------------------------
SETENV FD{$$}B 0
IF "$FD{$$}A" EQ ""
D:SOUND SFX:Voice/ah Q D V48 8000
SKIP #EXIT#
ENDIF
.
. -----------------------------------------------------------------------------
. check if OK is pressed and directory is still RAM:
. -----------------------------------------------------------------------------
IF "$FD{$$}A" EQ "RAM:"
D:SOUND SFX:Voice/ah Q D V48
DELETE >NIL: T:FD{$$}#? ENV:FD{$$}#?
SKIP #START# BACK
ENDIF
.
. -----------------------------------------------------------------------------
. if everything is fine report this acoustical
. -----------------------------------------------------------------------------
D:SOUND SFX:Voice/ja Q D V48
.
. -----------------------------------------------------------------------------
. FILTER possible linefeed (0x0A) using FILTER HACK
. -----------------------------------------------------------------------------
D:FILTER >T:FD{$$}B ENV:FD{$$}A
.
. -----------------------------------------------------------------------------
. create an executable temp file to list the selected directory
. -----------------------------------------------------------------------------
ECHO >T:FD{$$}A "LIST " NOLINE
ECHO >T:FD{$$}C "#?.info LFORMAT *"SYS:Tools/NOICONPOS ***"%S%S***"*" TO T:FD{$$}E"
JOIN T:FD{$$}A T:FD{$$}B T:FD{$$}C TO T:FD{$$}D
.
. -----------------------------------------------------------------------------
. execute the temp file
. -----------------------------------------------------------------------------
EXECUTE T:FD{$$}D
.
. -----------------------------------------------------------------------------
. erase suffix ".info" from temp list because NOICONPOS allows no suffix
. -----------------------------------------------------------------------------
D:REPSTRING >NIL: T:FD{$$}E T:FD{$$}F .info" ""
.
. -----------------------------------------------------------------------------
. execute temp script to clear position of all listed icons
. -----------------------------------------------------------------------------
RUN <NIL: >NIL: D:SOUND SFX:BARIS/liftoff Q D V32
IF EXISTS T:FD{$$}F
EXECUTE T:FD{$$}F
ENDIF
.
. -----------------------------------------------------------------------------
. wait for SOUND to finish (this is even a standalone helper script)
. -----------------------------------------------------------------------------
LAB #LOOPY#
STATUS >ENV:COM{$$} COMMAND D:SOUND
IF "$COM{$$}" EQ ""
WAIT
ELSE
WAIT
SKIP #LOOPY# BACK
ENDIF
DELETE >NIL: ENV:COM{$$}
.
LAB #EXIT#
. -----------------------------------------------------------------------------
. play a nice end sfx and clean up the mess
. -----------------------------------------------------------------------------
D:SOUND SFX:beep/beep15 Q D V32
DELETE >NIL: T:FD{$$}#? ENV:FD{$$}#?
WAIT 2
.
. -----------------------------------------------------------------------------
. clear the screen in case it's invoked from CLI
. -----------------------------------------------------------------------------
ECHO "*E[0m*E[H*E[J" NOLINE
.
. -----------------------------------------------------------------------------
. This script uses following additional programs:
. SOUND by GRAMMA SOFTWARE 07 Mar 1991 RLStockton
. BATCHREQ(UESTER) v1.1 1990 by Christoph Teuber (simple OS1.3 requestfile)
. FILTER (hack) by Russell Wallace (part of CLI_Utilities, Fish Disks)
. REPSTRING v1.0 1988 Luciano Bertato (much easier to use as to program edit)
.
. At last but not at least:
. NoIconPos v1.0 4-nov-87 AMSoft
.
. FILTER (hack)
. FILTER unfortunately filters "umlauts", for english typing users FILTER will
. be fine but it will strip ALL characters after "~" (0x7E) like "umlauts"
. or "accent" which is very sad. I hacked FILTER and exceeded the range of
. qualified characters from " " (0x20) to "ý" (0xFD) therefore it strips now
. linefeed (0x0A) but keeps "ESC" (0x1B, for pre-made esc sequences, i.e. with
. M-EMACS) and BEL (0x07) to keep the bell command in scripts or texts,
. a further inclusion of qualified characters will need a recompiling of the
. source. The original FILTER keeps linefeed (0x0A), tab (0x09) and all
. from 0x20 to 0x7E.
. Adresses to hack:
. 0x0155 from 0x7F to 0xFE (extends qualified character range)
. 0x015D from 0x0A to 0x1B (keeps "ESC" instead of "LF")
. 0x0165 from 0x09 to 0x07 (keeps "BEL" instead of "TAB")
.
. SFX:
. beep13 - invoke program, parametric synthesizer
. beep15 - exit/cancel program, parametric synthesizer
. ja - settlers "ja!" (OK)
. ah - settlers "ah..." (Cancel)
. LiftOff - BARIS "liftoff" (successfully run final script)
.
. SOUND is my preferred SFX player it is the most comfortable i found for
. OS1.3. It could be only slightly better if it could be terminated even
. if the status bar isn't shown any else is fine it properly recognizes
. stereo 8SVX and can even play stereo files with a wrong header or proper
. made stereo raw samples. Stereo 8SVX is an abuse of the so called
. "high octave" for 8SVX which means the left channel will follow the right
. channel both as mono streams very unlike other formats where right and
. left channel is sampled byte-wise or word-wise, if a raw stream is sectioned properly
. at half of the total filesize the option "S" will play this sample in stereo.
. When you encounter that a stereo 8SVX is played twice pass even "S" as option
. to SOUND and the sample will be played correctly (with the drawback that the
. header will produce a short noise). This unique behave of stereo 8SVX makes
. it possible to join two complete different samples of the same filesize to
. a quasi stereo sample. SOUND even recognizes and plays back proper
. Fibonacci compressed files if they are played from RAM, if played from
. DISK (using option D) it will stutter since the decompressing needs more
. time as the playback speed is. The comnpression ratio of fibonacci compressed
. files is quite good but extracting needs to long especially for larger SFX
. which makes it unsuitable to use under OS1.3.
. But samples with 8bit depth and a sample rate of 8000 to 12000 Hz won't
. use more space as a 128kB/s MP3, sure not as useful on a real Amiga
. if i guess that i was a lucky A2000 user with a whopping 250MB rigid disk.
. But well a CD-ROM drive attached to it would allow to play music in this
. format, sure meager 12kHz@8bit but me aged 56 can't hear any difference
. no more except a noise floor, this static noise of an 8bit sample can be
. reduced if the sample is sampled without to dither the wave, for i.e.
. "Audacity" this would mean the output dithering is set to "no" instead of
. "rectangular", "triangular" or "formed" (which would offer the smoothest
. dithering for >= 16bit samples).
. Brute force noise reduction:
. It is possible to lower the noise floor of an existing sample, but take
. care this method can and will destroy data. You can use a recent Hex-Editor
. and change i.e. all FF to 00 or vice versa this will erase the static noise
. of complete silent passages, but if you clean-up the complete stream in this
. manner it will leave a hard crackle for low volume passages. However it can
. be handy to erase the noise of silent passages if only these are altered.
.
. Directory D:
. this is my second C: directory which contains all non standard CLI programs
. to keep C: clean from them (i did that already on my A2000 which i do not own
. anymore since long), programs with the same name in D: won't interfere with
. those in C: even if D: is in the searchpath because C: has priority over all
. if C: is additionally set by PATH in the startup-sequence, i.e. "List" will
. always invoke "C:List" and never "D:List" (the ARP list).
. imho it's very useful to have a D: directory where you can manipulate, hack,
. and put new programs in, even if D: is a tohou-wabohou C: will stay clean.
The help, suggested to put in "SYS:system/help" it will be called by the "FloatDir" script if "H" is passed as argument to it and will reside as a standalone help in "Help" (the short s:showhelp script will follow in the next entry here).
Code: Select all
[H[J[43;32m[K[2f[K[3f[K[4f [42;33m[K[5f[1D[43;32m[K[5f [42;33m[K[6f[1D[43;32m[K[6f [42;33m[K[7f[1D[43;32m[K[7f [42;33m[K[8f[1D[43;32m[K[8f [42;33m[K[9f[1D[43;32m[K[9f [42;33m[K
[10f[1D[43;32m[K[10f [42;33m[K[11f[1D[43;32m[K[11f [42;33m[K[12f[1D[43;32m[K[12f [42;33m[K[13f[1D[43;32m[K[13f [42;33m[K[14f[1D[43;32m[K[14f [42;33m[K[15f[1D[43;32m[K[15f [42;33m[K
[16f[1D[43;32m[K[16f [42;33m[K[17f[1D[43;32m[K[17f [42;33m[K[18f[1D[43;32m[K[18f [42;33m[K[19f[1D[43;32m[K[19f [42;33m[K[20f[1D[43;32m[K[20f [42;33m[K[21f[1D[43;32m[K[21f [32m2022GS66[33m[K[0m
[H[2;3f[1;43;32mFLOATDIR[0;43;32m [DIR][5;3f[1;42;33m[DIR][0;42;31m optional directory path, if "H" is omitted this help is shown.[7;3f[42;33mThis script can be invoked from CLI but it is intentionally meant to be started
[8;3f[42;33mfrom Workbench. However, if you invoke it from CLI you can either pass a path to[9;3f[42;33ma directory with icons to float to it or if [DIR] is not omitted it will open a
[10;3f[42;33mfilerequester to select the desired directory. As a second possibility you can[11;3f[42;33mshift click on a directory on Workbench and it will float all icons in this
[12;3f[42;33mdirectory. As third option you can invoke the script from WB without any argument[13;3f[42;33mand it will even open the filerequester to select a directory.
[14;3f[42;33mIf you press "Cancel" in the filerequester the whole operaton is cancelled.[15;3f[42;33mIf you press "OK" and have no directory selected except the preset RAM: it will
[16;3f[42;33mreturn and open the filerequester again, it won't check if icons are present[17;3f[42;33min the selected directory neither if unintentionally a file is selected.
[18;3f[42;33mBy default the Icon of this script opens a RAW window and if the script hangs[19;3f[42;33mit must be closed by entering "endcli" and then press CTRL+ENTER to exit.
[0m
[J
More will nicely display this as shown below: Last but not at least a zip of the used SFX place them anywhere i suggest to set up an assign for a specific SFX drawer like used in this example "SFX:" where that resides won't matter, personally or if you have the chance to use a second rigid disk drive put it there though it will play most smoothly, but on slow machines it is intented to play from RAM:.
However no matter how "slow" i setup the virtual Amiga SOUND seems to have no problems to play proper from disk thus the disk speed might be what is more important as the machine speed. And at last but for sure not at least the icon for "FloatDir" no special thing it's a copy from the icon for "FloatIcon".
Perhaps i will create a new one especially since i like to update all icons to a size of 80x40.
However it contains the call for "Xicon" if you would like to use "IconX" you will need to make a tiny script to execute S:showhelp <filename>
Most often i use "IconX" and not "XIcon" this is an exclusion. ...worng as wrong can be...
i liked to link this help ansi End of Script #1 "FloatDir"