AppServer V3.01 --------------- NOTE ! WorkBech 2.0 or later required !!! What's new in V3.xx ? You can use AppIcons too ! Have you ever tried to drag an icon into the IconEdit's window ? IconEdit loads it automatically and you don't have to give any names. I liked that feature and wanted to see it in every utility I had. AppServer gives you the power of Application Windows. It is an Application Window AND -Icon Server for WorkBench 2.0. ^^^^^^^^^ AppServer is a configurable front-end for utility programs. An example would be fine, I guess... You want to show a picture. You drag the picture file icon into AppServer's window or icon and AppServer shows the picture using your favorite Iff-Viewer. You can as well make other windows/icons which play samples, show documents and even delete files ! ************************************************************************** Automatic Disclaimer activated from keyword: delete I, Jarto Juhani Tarpio, claim no responsibility whatsoever of what this program might do to your equipment, disk contents or mental health. You run this program entirely at your own risk ! ************************************************************************** Now I feel better. Just go on reading ! :-) Configuration ------------- Configuration is done by icon tool types. If you don't know what a tool type is, mark the AppServer icon and select "Information" from the Icons menu. Supported tool types are: NAME= Name of the window to be opened LEFT= Window left coordinate TOP= Window top coordinate WIDTH= Window width HEIGHT= Window height COMMAND= This one is the most important tooltype. The command is a CLI-command that is executed from AppServer. In the command you mark the filename place with (icon) For example: COMMAND=SYS:Utilities/More "(icon)" The example would show the file with more. The quotes are added so that AppServer can handle spaces in filenames. They are not added automatically, because some utilities can't handle quotes. There may be multiple (icon)'s in a command string. NOTE ! AppServer is not limited to only one command- argument. You can give as many commands you want and they are executed one after other in the same order they appear in the tooltypes. OUTPUT= Output filename. Default is NIL:. If you want to output for example a dir list, the filename could be for example OUTPUT=CON:0/0/640/200/AppServer/CLOSE/WAIT RECURSION=ON/OFF An ON/OFF-switch for recursive directory handling. If this switch is ON, AppServer takes every file in the given directories and their subdirectories. Default option is OFF. ICONS=ON/OFF An ON/OFF-switch for icon-handling. If the switch is on and: - If the icon doesn't have any file, AppServer takes it's .info-file. - If directories are read recursively, every icon-file is also taken. Default option is OFF (No icons) DOUBLECLICK=ON/OFF If this switch is ON and you doubleclick the window, your commands will be run without a filename. This is a handy way to launch for example an editor. Default option is OFF, because doubleclick may be disasterous if the commands delete files. BREAK=ON/OFF If this switch is ON, you may interrupt AppServer while it's working. Really handy when you have accidentally dropped your hard disk icon into AppServer's window :-) Possibility to switch it off because mouseclicks while viewing pictures may give AppServer a break-signal... Default option is ON. PAUSE= Time to wait before AppServer starts handling your icons. Default is 0 seconds. This delay is handy when your commands delete files. It gives you time to think over... REQUESTER=ON/OFF A simple "Are you sure ?"-requester that will show up after the possible pause. May be a good idea to use when your commands delete files. APPICON This option makes AppServer use AppIcons instead of AppWindows. NOTE THAT THE OPTIONS MUST BE WRITTEN IN UPPER CASE ! You should configure the AppServer by creating own Project- type icons. In the Project-type icons write a path to the AppServer into the Default Tool field. If you only duplicate the AppServer-icon and reconfigure it, you waste disk space. The AppServer-icon is configured to show document files using more. There's a Project-type icon, AppMore, that does the same thing. You can use it as an example. Clicking on the window/icon --------------------------- If you double-click on the window/icon, the commands are run with an empty filename. I added this feature because then I can start my favourite text editor just by double-clicking on my ED-window. This option is OFF if you don't use the "DOUBLECLICK=ON"-option. With Icons, a doubleclick will bring up an About-requester where you can quit the icon. If you use the DOUBLECLICK=ON-feature, the commands are run with an empty filename as with the windows, but you can't quit the icon. Be careful with the Doubleclick-option. Let me tell you why... (How I learned to use lock... :-) I was writing a script that would delete all the files and act like a trashed. I don't use trashcans and to get rid of a file by just dropping it into a trasher-window sounded nice. When I had written the script, I drawed an icon and configured it to run my script. Then I opened my hard disk. The window opened partially over the trasher window. I doubleclicked the window to bring it to front... What went wrong ? You see, trasher started my script with an empty filename and gave the command: "Delete ALL QUIET". So it started deleting all my files in the SYS-device. As an final note: Dave, your DiskSalv is nice ! :-) Interrupting AppServer ---------------------- With Windows: You may interrupt AppServer by clicking in the window with your left mouse button while AppServer working on your icons. With Icons: You may interrupt AppServer by DOUBLEclicking on the icon with your left mouse button. This is very handy when you have dropped wrong icons into AppServer's window. This feature may be disabled with the BREAK=OFF option. AppWindow Graphics ------------------ An empty window would look horrible. I'm not good at drawing... Hmm... The solution is icons. AppServer takes the image from your Project-icon and draws it in the middle of the window. If your icon has two images, the second one is showed while AppServer is working on your icons. You could draw this second image to look like a cancel-button. If option BREAK=ON is used, clicking this button would stop AppServer. A second image is a nice way to show the user that AppServer is working, so you could draw one even if you don't use the break-possibility... Now it's up to you to draw good-looking icons :-) Examples -------- Some examples how to use AppServer. Use them as guidelines. Note that you may not have the same utilities that I use and the paths to them are definitely different than in your Amiga. DON'T COPY THE COMMENTS !!! WB1.3-icons look ugly in WB2.0. This example uses BlackOrWhite to convert WB1.2 icons to 2.0 ones: NAME=IConvert APPICON ' AppIcon instead of AppWindow this time... LEFT=430 TOP=153 ICONS=ON ' If no file, AppServer will give us the icon COMMAND=dh0:Starc/BlackOrWhite "(icon)" ' BlackOrWhite can be found in the package... DONOTWAIT ' This is needed in AppServer 3.xx because ' the first AppServer will not return. A picture viewer using ShowIff by Chris Weber: WIDTH=89 HEIGHT=51 LEFT=635 TOP=411 NAME=PIC PAUSE=0 ' No delays... REQUESTER=OFF ' No questions needed... COMMAND=dh0:Stuff/ShowIff "(icon)" RECURSION=OFF ' ShowIff takes the dir contents... ICONS=OFF ' Why show icons ? DOUBLECLICK=OFF ' There's no file requester... BREAK=OFF ' Usually picture changed with ' left mousebutton that may give ' AppServer a Break-signal. APPICON ' If you want to bring it up as an icon DONOTWAIT A document viewer using More: WIDTH=89 HEIGHT=51 LEFT=635 TOP=462 NAME=DOC PAUSE=0 ' No delays... REQUESTER=OFF ' No questions needed... COMMAND=run SYS:Utilities/More (icon) RECURSION=OFF ' Recursion maybe not wise ? ICONS=OFF ' Icons neither... DOUBLECLICK=ON ' Brings up a file requester BREAK=ON ' User may interrupt viewing... APPICON ' If you want to bring it up as an icon DONOTWAIT A sample player: WIDTH=89 HEIGHT=51 LEFT=635 TOP=513 NAME=SND PAUSE=0 ' No delays... REQUESTER=OFF ' No questions needed... COMMAND=DH0:Stuff/PlaySample "(icon)" RECURSION=OFF ' PlaySample plays executables also... ICONS=OFF ' As well as icons... DOUBLECLICK=OFF ' No file requester BREAK=ON ' User may interrupt playing... APPICON ' If you want to bring it up as an icon DONOTWAIT A ST-player using NoisePlayer: WIDTH=96 HEIGHT=51 LEFT=628 TOP=11 NAME=PLAY PAUSE=0 ' No delays... REQUESTER=OFF ' No questions needed... COMMAND=execute dh0:MusicProgs/TrakkerModules/PlayScript (icon) RECURSION=ON ' Play every module in dirs too... ICONS=OFF ' Don't play icon-files DOUBLECLICK=ON ' Bring up a requester BREAK=ON ' User may interrupt playing... APPICON ' If you want to bring it up as an icon DONOTWAIT The PlayScript is: .key module IF EQ "GarbageToFindEmptyOne" cd dh0:MusicProgs/TrakkerModules dh0:Stuff/NoisePlayer -r ELSE dh0:Stuff/NoisePlayer -m5 ENDIF And finally the Trasher ! A deleter that kills the given files just like Delete in the WorkBench. It's here where the options PAUSE, REQUESTER and BREAK are mostly needed :-) My Trasher doesn't ask any questions. It just waits two seconds before starting and it can be interrupted by clicking in the window. You could add requesters with REQUESTER=ON and give no pause value if you want Trasher to ask for your permission first. The deletion is done by IconKill. It deletes the file and the icon. Icons disappear from the WB-screen as well as directories are closed. This Trasher is really dangerous. A safer one could be to copy the files to a graveyard-directory before killing them. The script could always empty the graveyard in the beginning. Then the last deleted files would be in the graveyard until the next deletion. But here's the dangerous one. Read the disclaimer once more before using it. My icon-image looks really nasty... :-) NAME=KILL TOP=62 LEFT=628 WIDTH=96 HEIGHT=88 PAUSE=2 ' Pause value gives you time to think over... REQUESTER=OFF ' It would be safer to switch it on... COMMAND=IconKill "(icon)" ' IconKill can be found in the package... OUTPUT=nil: RECURSION=ON ' Every file in the subdirs ICONS=ON ' Including icons DOUBLECLICK=OFF ' AND NO DOUBLECLICK !!!!!!!!!!!!!!!!!!!! BREAK=ON ' This makes you definitely feel better :-) APPICON ' If you want a trasher-icon instead of a window. DONOTWAIT Techical stuff and possible problems ------------------------------------ - AppServer can't be run from CLI. If you want to start AppServers at boot- time, drag the icons to the WbStartup-drawer. - If you don't give any COMMAND-arguments, AppServer will start, but doesn't do anything useful. - When you have dropped icons into AppServer's window, it starts by first locking to every file and collecting the locks into a list. When every file has been collected, AppServer replies to messages and starts running your commands on the icons. This may cause delays if big directories are processed recursively. - AppServer launches the programs using Execute from dos.library. This execute is about the same as run in CLI. It's not the Execute in CLI. - When the user interrupts AppServer, the disk drives may continue working because AppServer has to stop legally. That is: Unlock every locked file. - AppServer doesn't show with requesters if the command was succesful. While building the command you can change the output to a file or console so that you can notice the error messages. I use "pipe:" and a script that types my messages from pipe to a window. - Don't assume that the default dir would be in the same dir as the icon you just dragged into AppServer. In fact, the default dir is SYS:. Keep this in mind if you use scripts. - AppServer waits until the previous command has been executed. If you want to be able to execute the next command before the previous has been completed use RUN just like in CLI. - Every window and icon have an own process. Code is however shared so you won't waste memory. - AppServer was coded in Assembly using ArgAsm from Argonaut Software. Changes ------- V1.1 AppServer opened and closed the output file and delayed at every command. It wasn't nice when executed many commands to the console. Now I open the file before the first command and delay and close it after the last command. V1.2 Filename and windowname were not null-terminated. Argh... V1.3 Now opens windows using OpenWindowTagList and WA_AutoAdjust. Default output-file 'NIL:' was typed as DC.L instead of DC.B O:-) Now executes the command with an empty filename if user double-clicks on the window. Nice way to launch a text-editor... V2.0 Major changes: Added recursive handling of directories. Working image taken from the Icon's secong image. Break possible by clicking the window while AppServer is working. Optional requester added for dangerous configurations. Five new arguments: RECURSION=ON/OFF ICONS=ON/OFF DOUBLECLICK=ON/OFF BREAK=ON/OFF REQUESTER=ON/OFF Pause changed ! Now it is a delay BEFORE starting handling icons. It used to be a time value to wait after a command had been executed. But it was useless, because console windows can wait for the close button in WB2.0. V3.0 Major changes: Added AppIcon support. (Argument APPICON) Code sharing to minimize memory consumption. Added a small utility, BlackOrWhite, to add IConvert functions. V3.01 The first AppServer didn't always start... IconKill didn't delete ".info"-file. Also added ASS (AppServerServer) by Juha Tuominen to the package. ASS checks the type of the given file and runs different programs depending on the type. The benefit is that you only need one "Show"-AppWindow that can show pics, docs, samples etc.. Read ass.doc for more info ! Credits ------- I would like to send my thanks to the Commodore Folks at WestChester for making so many nice features into KS/WB2.0 and for adding DeleteDiskObject() afterwards to icon.library. It's good to notice that you are reading our suggestions ! Many thanks also to Juha Tuominen for making the AppServerServer (ass). Copyright and distribution -------------------------- AppServer is Copyright © 1991 by Jarto Tarpio. It can be freely distributed for non-commercial purposes. Comments and bug-reports to: Jarto Tarpio Nikkarinkuja 2 A6 02600 Espoo Finland Internet e-mail: robin@vipunen.hut.fi or Jarto.Tarpio@hut.fi