How do I use variable with 'using terms from'


Brian Christmas
 

G’day scripters.

I hope this is the last missing piece in my app.

With using GraphicConverter, I need to use ‘using terms from’, but the code is ‘locked’ into using the text 'GraphicConverter 10'.

If at all possible, I need versatile code that will use ANY version of GC.

However, all my efforts have been in vain, that handler just wont accept any variable.

As the old GC was just ‘GraphicsConverter;, and the new ones will be ‘GraphicConverter 11’ etc, I really, really need that variable method.

Any advice or guidance, please?

Regards

Santa

on printGraphicConverter()
try
tell application "Finder" to set theApps to (name of (every item of folder (path to applications folder))) as list
repeat with theApp2 in theApps
if theApp2 contains "GraphicConverter" then
set theUserApp to application theApp2
exit repeat
end if
end repeat
tell application "System Events"
set theApp to (bundle identifier of (info for (path to theUserApp))) as text
end tell
tell application "Finder" to set theProcesses to (name of processes) as list
repeat with theApp2 in theProcesses
if theApp2 contains "GraphicConverter" then
set theUserProcess to theApp2 as text
exit repeat
end if
end repeat
end try
#set temp to a reference to application "GraphicConverter 10"  
  using terms from theUserApp
tell application id theApp
launch
do shell script ("sleep 0.2")
try
close every window saving no
end try
end tell
  end using terms from
 end printGraphicConverter