Hi,
I’m trying to import pictures into QuarkXPress 4.1 (OS9) which isn’t a problem - the problem is that l’m trying to code it so I don’t have to use 'tell application “QuarkXPress4.1” because some of the mac’s don’t have the same app name
This is what l’ve got:
tell application “Finder”
set creaType to “XPR3”
set filetype to “XDOC”
tell application “Finder” to the first process whose ¬
creator type is (creaType as type class)
try
set QXPappName to the result as «class psn »
on error
set QXPappPath to application file id “XPR3” as string
set creaType to “XPR3”
set filetype to “XDOC”
select file QXPappPath
open selection
tell application “Finder” to the first process whose ¬
creator type is (creaType as type class)
try
set QXPappName to the result as «class psn »
on error
display dialog “Can not set QXP App Name”
end try
end try
end tell
– (display the QXP app name that’s running
display dialog "QXP Name: " & QXPappName
tell QXPappName
set sufName to "pic" as string
set macImagePath to "HD Vin:Desktop Folder:iDTP - Templates:garyb:1712_garyb_pic.eps"
set boxAlignment to "3"
set downloadList to {}
tell document 1
try
set image 1 of picture box sufName to alias (macImagePath)
if boxAlignment is equal to "1" then
set bounds of image 1 of picture box sufName to centered
else if boxAlignment is equal to "2" then
set bounds of image 1 of picture box sufName to proportional fit
else if boxAlignment is equal to "3" then
set bounds of image 1 of picture box sufName to exact fit
end if
on error ems
display dialog "ERROR: " & ems
end try
end tell
end tell
Has anyone got any ideas on how I can get this to work?
Regards, Gary.
My experience is that the application’s file name is often the one also used to address the application in the tell block. The following code works here:
set creatortype to "XPR3"
tell application "Finder"
set qxpappfile to application file id "XPR3"
end tell
set qxpappfileinfo to (info for (qxpappfile as alias))
set qxpappfilename to (name of qxpappfileinfo) as text
tell application qxpappfilename
activate
end tell
Thanks for the reply - but getting the qxpappfilename isn’t the problems - it’s when you are trying to set image 1 content:
set creatortype to “XPR3”
tell application “Finder”
set qxpappfile to application file id “XPR3”
end tell
set qxpappfileinfo to (info for (qxpappfile as alias))
set qxpappfilename to (name of qxpappfileinfo) as text
tell application qxpappfilename
set sufName to "pic" as string
set macImagePath to "HD Vin:Desktop Folder:iDTP - Templates:garyb:1712_garyb_pic.eps"
set boxAlignment to "3"
set downloadList to {}
tell document 1
try
set image 1 of picture box sufName to alias (macImagePath)
if boxAlignment is equal to "1" then
set bounds of image 1 of picture box sufName to centered
else if boxAlignment is equal to "2" then
set bounds of image 1 of picture box sufName to proportional fit
else if boxAlignment is equal to "3" then
set bounds of image 1 of picture box sufName to exact fit
end if
on error ems
display dialog "ERROR: " & ems
end try
end tell
tell application qxpappfilename
It only works if you use 'tell application QuarkXPress" it doesn’t validate the syntax without it.
Gary.
Hi,
You can try to use like follows, the ‘using terms’ block is only necessary to trick AppleScript to compile the script:
set creatortype to "XPR3"
tell application "Finder"
set qxpappfile to application file id "XPR3"
end tell
set qxpappfileinfo to (info for (qxpappfile as alias))
set qxpappfilename to (name of qxpappfileinfo) as text
using terms from application " QuarkXPressâ„¢"
tell application qxpappfilename
activate
tell document 1
tell page 1
-- etc.
end tell
end tell
end tell
end using terms from
Thanks - l’ll give that a try! 