I'd like a simple, basic command line program or other solution that anyone can use to determine whether application named A is already installed in the main dock (or anywhere) of AmiDock.
Process:
1. Your program reads in the XML file associated with the current AmiDock. 2. Searches for the name given in the command line arguments.
If an instance is found either or both a warn is raised or a local environment variable is set containing the filename and path of the instance that we can perform a conditional check on.
I could properly do this myself in Hollywood in one afternoon, but surely SURELY someone can find time to write something in C/C++ or PortableE that can pull this off without me resorting to bloatware.
I might suggest something on OpenAmiga if feedback is poor here.
2. Searches for the name given in the command line arguments.
I don't understand this part.
What I understood is that you want to run a "FindInAmidock" tool. This can be achieved very easily with a script. Something like:
.key COMMAND/A
.bra [
.ket ]
search >NIL: env:sys/amidock.amiga.com.xml [command]
if warn
echo Not found
else
echo [command] is installed in Amidock.
endif
Edited by Elwood on 2011/8/2 19:40:13 Edited by Elwood on 2011/8/2 19:41:01
If you want to find the command from anywhere, not just in the amidock then you can try the script below. Open notepad and paste in what's between ==== lines.
Anywhere else might be found , but this is where system scipts go. Oh hang on, this isn't a system script, my bad! :)
Simn
Comments made in any post are personal opinion, and are in no-way representative of any commercial entity unless specifically stated as such. ---- http://codebench.co.uk
Actually you're kinda right Simon, I have an added path to S: on my setup, but the default install places shell scripts in the S:Shell directory and there is also a path there by default. So "S:Shell" is the best place for it.
Elwood wrote: What I understood is that you want to run a "FindInAmidock" tool. This can be achieved very easily with a script. Something like:
.key COMMAND/A
.bra [
.ket ]
search >NIL: env:sys/amidock.amiga.com.xml [command]
if warn
echo Not found
else
echo [command] is installed in Amidock.
endif
Just be aware that this method is not foolproof. As an example, try looking for a program named "acemen".
To be absolutely robust, one should probably parse the XML file and find the correct elements in the relevant context. But it might be useful to have an easier API to things like this. Shouldn't application.library be able to provide this, e.g. to use from ARexx or Python?
Yes, those kinds of "do-it-all-in-one-program"/"Jack-of-all-trades" solutions seem to be popular on those platforms. I've never understood why.
In AmigaOS we usually have separate commands or programs for each of those tasks. So instead of having to type e.g. "sfk list", "sfk delete" or "sfk find", we only have to type "list", "delete" or "search" (with appropriate arguments in both cases).
Of course some of sfk's subcommands can do things the corresponding Amiga commands can't - and vice versa. But if we need any of those features, we can usually create them with a simple script which again can be called (after being "S"-protected) with one word.