请原谅我不那么优雅的脚本编写能力,但在脚本编辑器本身调用时脚本工作正常。但是,当我将其另存为应用程序时,该图标并未表明它是一个小滴,并且不能正常工作。非常感谢任何帮助!
try
set destinationFolder to "Mercury:F1_PropertyLogos:"
tell application "Finder" to set logoFileName to name of item 1 of (get selection)
end try
set file_name to logoFileName
set file_name to remove_extension(file_name)
on remove_extension(this_name)
if this_name contains "." then
set this_name to ¬
(the reverse of every character of this_name) as string
set x to the offset of "." in this_name
set this_name to (text (x + 1) thru -1 of this_name)
set this_name to (the reverse of every character of this_name) as string
end if
return this_name
end remove_extension
tell application "Finder"
set selected_items to selection
set theFolder to "Mercury:F1_PropertyLogos:"
repeat with x in selected_items
move x to theFolder
end repeat
end tell
tell application "QuarkXPress"
set mypath to "Mercury:F1_Layouts:"
set myfile to file_name
set extension to ".qxp"
set logoFolderPath to "Mercury:F1_PropertyLogos:"
set myLogoFile to file_name
set myLogoExtension to ".psd"
set myLogo to (logoFolderPath & myLogoFile & myLogoExtension)
open file (mypath & myfile & extension)
set selected of picture box "Logo" of spread 1 of document 1 to true
set image 1 of picture box "Logo" of spread 1 of document 1 to file myLogo
set bounds of image 1 of picture box "Logo" of spread 1 of document 1 to proportional fit
end tell
end
答案 0 :(得分:0)
要处理投放到应用程序上的项目,您需要添加一个打开处理程序,该处理程序接收已删除项目的列表(即使只有一个),例如:
on open theDroppedItems
-- whatever
end open
您应该重新安排代码,将主要语句放入可以从多个位置调用的处理程序(或处理程序),因为双击应用程序将调用运行处理程序。