Quark: Object reference

Hi

Sorry if this question is too stupid but I can’t go forward in a project without a solution for the the following problem:


tell application "QuarkCopyDesk Passport"
	activate
	set selectedAsset to current assets of query palette 1 of qdsc
end tell

This script will produce the result:

{asset 103 of query palette 1 of qdsc of application “QuarkCopyDesk Passport”, asset 104 of query palette 1 of qdsc of application “QuarkCopyDesk Passport”, asset 105 of query palette 1 of qdsc of application “QuarkCopyDesk Passport”, asset 106 of query palette 1 of qdsc of application “QuarkCopyDesk Passport”}

Is ther a easy way to get out only the numbers of the assets (103,104,105,106)? I couldn’t find a simple way

Thanks a lot in advance

Baschi

Hi Baschi,

I don’t have Quark Express, but there are (at least) two options:
¢ Take a look at Quark’s dictionary and find out whether exists a property with the index number (I guess there is one)
¢ Write a temporary script, which displays the information in the result window like

tell application "QuarkCopyDesk Passport"
	activate
	get properties of asset 103 of query palette 1 of qdsc
end tell

Hi Stefan

Unfortunately ther’s no ID available. The problem is not to get the properties of “asset 103” the problem is to get the ID 103 of a asset selected in a query palette. The only result I’ll get is the mentioned result “{asset 103 of query palette 1 of qdsc of application “QuarkCopyDesk Passport”, asset 104 of query palette 1 of qdsc of application “QuarkCopyDesk Passport”, asset 105 of query palette 1 of qdsc of application “QuarkCopyDesk Passport”, asset 106 of query palette 1 of qdsc of application “QuarkCopyDesk Passport”}” and I’m not able to extract the numbers because the result is not a text which can be treated an I couldn’t find a way to convert this result into a text.

Cheers, Baschi

What happens, when you run the script I posted?

Hi Stefan

This one works fine. I’m getting the properties of the selected asset. Unfortunately there is no ID. because the asset number changes - depending on the query. This number represents the position of the asset in a query result palette.

But here the result:

{class:asset, object reference:asset 103 of query palette 1 of qdsc of application “QuarkCopyDesk Passport”, name:“Demo_Word.doc”, asset type:article, checkout status:no checkout, is attached:true, primary attachment info:{project name:“15.01.fr”}, asset publication:“Basellandschaftliche Zeitung”, asset section:“Anzeigen”, header:{mandatory fields:{asset filename:“Demo_Word.doc”, asset publication:“Basellandschaftliche Zeitung”, asset section:“Anzeigen”, asset status:“Frei zum Layout”, asset routed to:“¢Layout”, revision comment:“”}, custom fields:{field data:{{name:“Ressort”, value:“Front”}, {name:“Erscheinungsdatum”, value:“”}, {name:“Seite”, value:“”}, {name:“Restanz”, value:“Nein”}, {name:“Bemerkungen”, value:“”}, {name:“Inhalt erstellt von”, value:“Repro”}, {name:“Urheber”, value:“Repro”}, {name:“Primärlayoutname”, value:“15.01.fr”}}, component data:{name:“Demo_Word.doc”, type:“Text”, index:0, field data:{{name:“Textvoransicht”, value:" Text im Gas-Streit
Normalisierung / Russland lenkt ein
moskau/Kiew. Nach den Lieferausfällen von russischem Erdgas hat sich in Europa die Versorgungslage gestern normalisiert. Zwischen Russland und der Ukraine zeichnete sich eine erste leichte Entspanpan"}, {name:“Aktuelle Länge”, value:“121.448 mm”}, {name:“Zugeteilte Länge”, value:“130.93 mm”}, {name:“Wortzahl”, value:“139”}, {name:“Zeichenzahl”, value:“1033”}, {name:“Zeilenzahl”, value:“31”}}}}}}

Cheers, Baschi

Hi Baschi,

Here’s a little trick that often works. It is based on a peculiar feature of the “run script” command where otherwise undisplayable object values become readable strings when those objects constitute the message of a “run script” “error” command. The resulting string can then be "grep"ped. It may be worth a try:


tell application "QuarkCopyDesk Passport"
	activate
	set selectedAssets to current assets of query palette 1 of qdsc
end tell
try
	script forcedError
		error selectedAssets
	end script
	run script forcedError
on error selectedAssetsAsString
end try
set assetNumbers to paragraphs of (do shell script "echo " & (quoted form of selectedAssetsAsString) & " | egrep -ow 'asset [0-9]+ of query palette' | egrep -ow [0-9]+")

bmose

…or if that doesn’t work, then try capturing the object’s value as a displayable result by making it the message of a forced error. A simple way to do this is to try to coerce the object to the null class, which always results in an error (even for null itself: null as null – > error!):


tell application "QuarkCopyDesk Passport"
	activate
	set selectedAssets to current assets of query palette 1 of qdsc
end tell
try
	selectedAssets as null
on error selectedAssetsAsString
end try
set assetNumbers to paragraphs of (do shell script "echo " & (quoted form of selectedAssetsAsString) & " | egrep -ow 'asset [0-9]+ of query palette' | egrep -ow [0-9]+")

bmose

hi bmose

Thanks a lot for your support. IT WORKS!!!

Best regards, Baschi

Glad to help.