Applescript:无法将脚本制作成水滴
请原谅我的脚本编写能力不够优雅,但在脚本编辑器中调用脚本时,脚本运行良好。但是,当我将其保存为应用程序时,图标不会显示它是一个液滴,因此无法正常工作。非常感谢您的帮助Applescript:无法将脚本制作成水滴,applescript,Applescript,请原谅我的脚本编写能力不够优雅,但在脚本编辑器中调用脚本时,脚本运行良好。但是,当我将其保存为应用程序时,图标不会显示它是一个液滴,因此无法正常工作。非常感谢您的帮助 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
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
要处理掉到应用程序上的项目,您需要添加一个打开的处理程序,该处理程序接收掉的项目列表(即使只有一个),例如:
on open theDroppedItems
-- whatever
end open
您可能应该重新排列代码,将主语句放入可以从多个位置调用的处理程序中,因为双击应用程序将调用运行处理程序。实际上,我刚刚发现脚本末尾的额外“结尾”阻止了它正确地创建水滴。谢谢在这种情况下,您一定在谈论一个“applet”——如果没有打开的处理程序,您的应用程序将无法处理掉到它上面的项目(这使它成为一个“水滴”)。