Amiga.org
Amiga computer related discussion => General chat about Amiga topics => Topic started by: sim085 on October 02, 2009, 01:23:44 PM
-
Hi,
I would like to make the commodity 'ClickToFront' run on Workbench Start-up. Of course I could just move this commodity to the WBStartup (as I am doing now).
However is there maybe a way I can do a short-cut so that I leave the ClickToFront commodity in the Commodities directory and just put a short-cut in the WBStartup directory?
Regards,
Sim085
-
The User-Startup can be used (create one if it isn't already in the S directory).
Run >NIL: SYS:Tools/Commodities/ClickToFront
Ed: it might not need to be Run, it might just need to be called... in which case
"ClickToFront"
will do (the User-Startup is executed after the Path statement, so it will be found, or you could explicitly give its full path).
You could save this snippet as a separate script, and set its protection bits appropriately, and possibly give it an icon, and then when you double-click on the icon the script will get run and the comodity will be fired up. Etc.
In other words, yes, there are ways to do things.
-
Have you looked at the other Commodities... FKey springs to mind...
-
The User-Startup can be used (create one if it isn't already in the S directory).
Run >NIL: SYS:Tools/Commodities/ClickToFront
Ed: it might not need to be Run, it might just need to be called... in which case
"ClickToFront"
will do (the User-Startup is executed after the Path statement, so it will be found, or you could explicitly give its full path).
However if I do this then the WBStartup directory under system would be pritty much useless right? I could put any application I want to run from startup in the User-Startup file!
You could save this snippet as a separate script, and set its protection bits appropriately, and possibly give it an icon, and then when you double-click on the icon the script will get run and the comodity will be fired up. Etc.
In other words, yes, there are ways to do things.
How do I go an create a script file? Are there any examples anywhere (maybe already on Workbench)?
-
However if I do this then the WBStartup directory under system would be pritty much useless right? I could put any application I want to run from startup in the User-Startup file!
That's about the size of it - but the WBStartup drawer does things as if you had double-clicked on the icons, which means that the Tooltypes get parsed, which does not necessarily happen when you launch things from scripts. You sometimes need to add keywords like QUIET etc.
How do I go an create a script file? Are there any examples anywhere (maybe already on Workbench)?
Use a text editor, type something, save it.
Then look at the protection bits (Icon Info stuff, or shown in file-listers). If it has the "s" bit set then it's a script. If not, you set that bit, now it's a script. ;)
Ed: there's a little more to it, but not much. The "rwed" bits have some relevance, particularly the "e" bit. If that is NOT set then the file is a project (which might be a script, might be data, or almost anything) and the file is NOT "Executable" by direct clicking on it, or naming it, etc. You have to type the command "Execute scriptname" in that case, this overrides the protection bits status.
If the "e" bit IS set then you can run the file/program by clicking on it or naming it, but that doesn't make it a script even though it could well be one. :) It is the "s" bit that says "script file intended to be used from the Shell/CLI" and if it is also "e" set then you can call it by name and it gets executed as if it were a regular program.
-
The Startup-Sequence is a good example of a script, as are some of the other files in the S directory.
-
The Startup-Sequence is a good example of a script, as are some of the other files in the S directory.
Thanks :) Maybe I am pushing this a little; but can parameters be passed to script file? Something like project icons!
-
Have a look at the "Shell" icon in the System drawer, you'll see how Workbench does things...
Scripts can indeed accept parameters/arguments. Some of mine use up to four.
Also, Ed: study the scripts in S, look at SPat, DPat, and PCD. Think about what is going on, and you will be able to write your own scripts for all sorts of weird things.
-
As an aside, if ClicktoFront is the only thing you've got in WBStartup, I'd be inclined to just leave it there.
-
Have a look at the "Shell" icon in the System drawer, you'll see how Workbench does things...
Scripts can indeed accept parameters/arguments. Some of mine use up to four.
Also, Ed: study the scripts in S, look at SPat, DPat, and PCD. Think about what is going on, and you will be able to write your own scripts for all sorts of weird things.
Thanks :) Now all I have to do is find out how to create Project icons!
As an aside, if ClicktoFront is the only thing you've got in WBStartup, I'd be inclined to just leave it there.
Yes I know, but I would like to have everything in order ... and at the same time I learn how to build simple scripts on Workbench (it might help on my CV ;))
-
Thanks :) Now all I have to do is find out how to create Project icons!
IconEdit, in the Tools drawer.
-
IconEdit, in the Tools drawer.
Thanks :) I have done my first script with an icon!! Now I'll check the other scripts you suggested so that I can learn some syntax will try to build a shortcut tool :)
-
.KEY .BRA .KET etc... ;)
-
Hi,
I would like to make the commodity 'ClickToFront' run on Workbench Start-up. Of course I could just move this commodity to the WBStartup (as I am doing now).
However is there maybe a way I can do a short-cut so that I leave the ClickToFront commodity in the Commodities directory and just put a short-cut in the WBStartup directory?
Regards,
Sim085
Well, the way I do it is just make a copy of 'ClickToFront'. Then put the copy into WBStartup. That way all the Commodities stay where they are in that drawer.
'ClickToFront' is less than 4k in size. A shortcut in Windows probably is larger in size than that. ;-)
So unless you're on a floppy and really need every list kilobyte, then for me this is basically the same thing as a shortcut. (this way also if I mess with the tooltypes of the one in WBStartup I'm safe in knowing the original in the Commodities drawer is always set to the correct defaults)
-
'ClickToFront' is less than 4k in size. A shortcut in Windows probably is larger in size than that. ;-)
I know but I just want everything to be organised.
At the moment I have a problem. I created my scrypt under SYS: and a new icon (project) in a partition Documents: however I cannot understand how to make this icon execute the script in SYS!
-
Put them in the same directory... they should be named "myscript" and "myscript.info" (or any other name of your choosing, but there must be a file and a file.info in the same directory).
Ed: alternatively, look at the Shell icon, "FROM=S:Shell-Startup" tooltype as an example of how to use a different file. (This might be restricted in how you can use it.)
-
Thanks again. I managed to make the script run by using the FROM parameter as you suggested :) I then used the RUN command to run the wanted program.
I now just have to understand how I can use the CLI to run a script without actually opening the CLI window.
Rather then asking one question at a time (hopefully not annoying you) - is there a place where I can learn more about these things.
-
Thanks again. I managed to make the script run by using the FROM parameter as you suggested :) I then used the RUN command to run the wanted program.
I now just have to understand how I can use the CLI to run a script without actually opening the CLI window.
Do you mean run the script from the icon?
in the C folder is a program called iconX (think it comes with the OS)
If you right click on the Icon for your script and go to properties, where it says 'Default Tool' put
C:iconx
That should make it so the script will start just like you went to CLI and ran the script.
As for inside the script you can use run >nil: instead of just run which will keep CLI windows comming up everytime a run command is issued in the script.
-
Using
Run >NIL: myscript
EndCLI
I managed to run the script and close the CLI window. This is good enough for me for now. However I am intrested to know if it is possible to run the script without actually opening the CLI window (maybe through some other way?).
I tried to play a little with the IconX - however I think this is only usefull when the script and the icon are in the same directory, which is not my case.