AmiDock

A forum for general AmigaOS 4.x support questions that are not platform-specific
Post Reply
User avatar
djrikki
Posts: 138
Joined: Fri Jun 17, 2011 10:21 pm
Location: Grimsby, Lincolnshire, UK
Contact:

AmiDock

Post by djrikki »

Hello,

As AmiDock seems to form an integral part of the AmigaOS 'experience' I post my suggestion here.

I have read and implemented one of the Arexx calls in my installation process of Jack. Namely the 'ADDOBJECT' call. As stated in the documentation this *always* adds the object to a named bar in AmiDock no matter what. Has there been or will there be any further development of the Arexx calls that AmiDock supports to allow developers to check whether an object already exists anywhere in the AmiDock?

If this is not possible within the Arexx environment is there an intention to provide a command line program to fulfil this void? If a command line program is required it should return the filename and path of an instance it matches and ideally set a local environment variable or a 'warn' so it can be easily integrated into a python or an AmigaDOS batch script.

Just as a reference point, I could probably create a command line program to do the task above in one afternoon if I was to use Hollywood as the base programming language. But realistically I shouldn't have to resort to bloatware for such a small task.

Any interest? Any takers?

Feedback most welcome.
User avatar
ChrisH
Beta Tester
Beta Tester
Posts: 920
Joined: Mon Dec 20, 2010 9:09 pm
Contact:

Re: AmiDock

Post by ChrisH »

djrikki wrote:Has there been or will there be any further development of the Arexx calls that AmiDock supports to allow developers to check whether an object already exists anywhere in the AmiDock?
This might be useful for me: RunInUAE's installer adds a RunInUAE icon to AmiDock, but this can cause duplicates, so I had to resort to only adding it the first time it is installed, and never after that (even if an older version has been uninstalled).
User avatar
tonyw
AmigaOS Core Developer
AmigaOS Core Developer
Posts: 1438
Joined: Wed Mar 09, 2011 1:36 pm
Location: Sydney, Australia

Re: AmiDock

Post by tonyw »

This looks like a reasonable request. I'll fill out an enhancement request for AmiDock. No promises when it might be implemented, though.
cheers
tony
User avatar
djrikki
Posts: 138
Joined: Fri Jun 17, 2011 10:21 pm
Location: Grimsby, Lincolnshire, UK
Contact:

Re: AmiDock

Post by djrikki »

Thanks Tony it would more beneficial to have this as a standard feature for sure.

Like Chris pointed out thats a pretty annoying limitation, duplication of identical objects.

Chris, as you may have noticed already I raised the question on AW and got a lead. Although it requires a couple of libraries (I hate installing third-party libs for menial tasks).

http://os4depot.net/index.php?function= ... exxxml.lha

An XML parser, I'll pm you over a mediocre solution I've developed using ArexxXML sometime tomorrow, I say mediocre because it only checks the main dock and not the whole thing. Its a blend of batch script and arexx.

Not the greatest solution in the world, a stop-gap solution - but it works aside from the aforementioned limitation.
User avatar
djrikki
Posts: 138
Joined: Fri Jun 17, 2011 10:21 pm
Location: Grimsby, Lincolnshire, UK
Contact:

Re: AmiDock

Post by djrikki »

CheckAmiDock.rexx

As part of your installation process you need to check and install:

1. ArexxXML (available on above link) to C:.
2. Expat.library, Uni.library to libs:
3. libexpat.so to sobjs:

I am calling it from another rexx script like so:

address command 'rx CheckAmiDock.rexx Jack'

This example will check to see if the text 'Jack' appears as an application in the main dock bar and if it isn't found will install for you.

If you have the time and feel comfortable with Arexx (I know very little) you can adapt it to check alll sub-docks. If you do, please share the code. :D

Code: Select all

/* Check AmiDock for instance (main dock bar only) - Richard Lake - 02/08/11

	1. Ensure the temporary environmental variable amidock_destination is set, this is the location of the selected
	drawer where the user wants the application installed to.

	2. Ensure the 'executable' variable below points to the executable file within the destination.
		eg. <outerdrawer>/<your application>

*/
options results

if arg(1) ~= "" THEN DO

	executable = "Jack/Jack" ; EDIT THIS ONLY

	/** Check if ports exists, and start ARexxXml */
	WE_STARTED_AREXXML = 0
	IF ~SHOW(PORTS, AREXXXML) THEN DO
	    address command 'run >NIL: ARexxXml'
	    WE_STARTED_AREXXML = 1
	END

	address command 'WaitForPort AREXXXML'
	IF RC > 4 THEN DO
		Say "Couldn't start ARexxXml. Is it on path?"
		IF RC > 10 THEN DO
	    IF WE_STARTED_AREXXML == 1 THEN DO
			QUIT
		END
    	EXIT
	END
	EXIT
	END

	address AREXXXML

	/** Load xml file */
	LOADXML "ENVARC:Sys/AmiDock.amiga.com.xml"

	GETTAG "pobjects.dict.array.dict.array.dict.array.dict[length]"

	/** Iterate through applications */
	len = Result-1
	match = false
	DO i = 0 to len
		GETTAG 'pobjects.dict.array.dict.array.dict.array.dict['i'].string[0]'
		app = Result
		if app == arg(1) THEN DO
			match = true
		END
	END

	IF match == false THEN DO

		id='req'pragma('id')
		address command 'rxset' id $amidock_destination
		path=getclip(id)
		call setclip(id,'')
		filename = '"' || strip(path,b,'"') || executable || '"'

		address amidock
	
		addobject file filename name arg(1)
	
		address AREXXXML
	END
	
	CLOSE
	
	IF WE_STARTED_AREXXML == 1 THEN DO
		QUIT
	END
END
ELSE DO
	say empty
END

User avatar
ChrisH
Beta Tester
Beta Tester
Posts: 920
Joined: Mon Dec 20, 2010 9:09 pm
Contact:

Re: AmiDock

Post by ChrisH »

djrikki wrote:1. ArexxXML (available on above link) to C:.
2. Expat.library, Uni.library to libs:
3. libexpat.so to sobjs:
Rather than install them *just* for the installation to work, I'd be inclined to make temporary assignments for them. For example:

Assign C: installerstuff/c ADD
Assign Libs: installerstuff/libs ADD
Assign SObjs: installerstuff/sobjs ADD

; do stuff

Assign C: installerstuff/c REMOVE
Assign Libs: installerstuff/libs REMOVE
Assign SObjs: installerstuff/sobjs REMOVE
If you have the time and feel comfortable with Arexx (I know very little) you can adapt it to check alll sub-docks. If you do, please share the code. :D
I do know ARexx, but don't like it :)
User avatar
djrikki
Posts: 138
Joined: Fri Jun 17, 2011 10:21 pm
Location: Grimsby, Lincolnshire, UK
Contact:

Re: AmiDock

Post by djrikki »

True that would work, but I'd rather throw good tools/libs/stuff where they belong so they become even more accessible and popular.
Post Reply