我可以让我的脚本通过电子邮件发送图片,它发送文件的文本而不是真实的文件(你好,这里是iLog的屏幕截图:〜:ilogscreenshot.png)
另外,对于sone raison,当我拍摄第一个截图时,在我更改窗口之前没有任何事情发生,然后我有对话框“你对屏幕截图感到高兴”
知道我应该在哪里更改代码吗?
非常感谢
-- Start of screenshot
display dialog "You will have to select the screenshot area you want when you see the cross cursor" buttons {"OK"} default button 1
-- Select the aera :
tell application "iLog" to activate
delay 1
do shell script "screencapture -i ~/ilogscreenshot.png"
--" & winID
display dialog "Are you happy with the selected aera ?" buttons {"Yes", "No"} default button 2
if the button returned of the result is "Yes" then
-- action for Yes
display dialog "Ok we gonna no sent this by email " buttons {"OK"} default button 1
else
-- action for NO
display dialog "No worry, we gonna try again then" buttons {"OK"} default button 1
tell application "iLog" to activate
delay 1
do shell script "screencapture -i ~/ilogscreenshot.png"
--" & winID
end if
-- end of screenshot
-- sceenshot saved files
set theAttachment1 to POSIX file "~/ilogscreenshot.png"
-- end of screenshot saved files
display dialog "Sent to which email" default answer "@apple.com" buttons {"OK"} default button 1
set recipientAddress to text returned of result
set theSubject to "iLog Sceenshot!"
(* This will past the clopboard on the content
*)
set theContent to "Hello, here is the screenshot of iLog " & theAttachment1
tell application "Mail"
##Create the message
set theMessage to make new outgoing message with properties {subject:theSubject, content:theContent, visible:true}
##Set a recipient
tell theMessage
make new to recipient with properties {address:recipientAddress}
##Send the Message
end tell
end tell
答案 0 :(得分:1)
我无法使用iLog进行测试,但屏幕截图部分的工作原理如下:
set screenShot to ((path to desktop) as text) & "ilogscreenshot.png"
# it's easier to check the Screenshot on the Desktop
set happyUser to "No"
repeat until happyUser is "Yes"
tell application "iLog" to activate
do shell script "screencapture -i " & quoted form of POSIX path of screenShot
display dialog "Are you happy with the selected aera ?" buttons {"Yes", "No"} default button 2
set happyUser to button returned of the result
end repeat
将屏幕截图添加到外发消息(here是一个很好的指南):
set theSubject to "iLog Sceenshot!"
set theContent to "Hello, here is the screenshot of iLog:" & return & return
set recipientAddress to "test@test.de"
tell application "Mail"
set theMessage to make new outgoing message with properties {visible:true, subject:theSubject, content:theContent}
tell theMessage to make new to recipient with properties {address:recipientAddress}
tell content of theMessage to make new attachment with properties {file name:file screenShot} at after last paragraph
--send theMessage
end tell