Hi,
I’m a Mac-fan and I’m working for al whole week with macintosh and I enjoyed it!!!
But… there is always a but, I get an error (Mail got an error: NSCannotCreateScriptCommandError) of this code and I have not any clu what I have to do with this…
On my original code Applescript gives the same error and I don’t know what to do.
Can anyone help me with this code?
thanks!
tell application "Mail"
activate
set open_file to choose file with prompt "Choose a file containing the messages"
set file_path to open_file as string
set file_rate_size to size of the open_file
set file size to true
if the file_rate > 1.0E+9 then
set the file_rate_1 to (the file_rate div 1.0E+9)
set the file_rate_2 to (the file_rate mod 1.0E+9) div 100000000
set the file_rate to (the file_rate_1 & "." & the file_rate_2 as text) & " GBytes"
make new folder at (path to desktop folder) with properties {name:"theFolder_1"}
adding folder items to theFolder_1 after receiving fileList
else if the file_rate > 1000000 then
set the file_rate_1 to (the file_rate div 1000000)
set the file_rate_2 to (the file_rate mod 1000000) div 100000
set the file_rate to (the file_rate_1 & "." & the file_rate_2 as text) & " MBytes"
make new folder at (path to desktop folder) with properties {name:"theFolder_2"}
adding folder items to theFolder_2 after receiving fileList
else if the file_rate > 1000 then
set the file_rate_1 to (the file_rate div 1000)
set the file_rate_2 to (the file_rate mod 1000) div 100
set the display_text to display_text & "File Size: " & " KBytes" & the file_rate & return
make new folder at (path to desktop folder) with properties {name:"theFolder_3"}
adding folder items to theFolder_3 after receiving fileList
else
set the file_rate to the file_rate & " Bytes"
end if
set the display_text to display_text & "File Size: " & the file_rate & return
display dialog the display_text buttons {"Show File", "OK"} default button 2
if the button returned of the result is "Show File" then
tell application "Finder"
activate
try
reveal file open_file
on error
display dialog "The movie file cannot be shown." buttons {"OK"} default button 1
end try
end tell
end if
display dialog "Wenst u één van de folders openen?" with icon note buttons {"Ja", "Neen"} default button 1
set newfiles to {"kleine berichten", "matig grote berichten", "grote berichten"}
set foldername to newfiles
choose from list newfiles with prompt "Kies uit de volgende folders" & foldername
if newfiles = "kleine berichten" then
opening folder theFolder_1(path to documents folder)
else if newfiles = "matig grote berichten" then
opening folder theFolder_2(path to documents folder)
else if newfiles = "grote berichten" then
opening folder theFolder_3(path to documents folder)
end if
end tell
Model: Mini mac
AppleScript: Mac OSX Tiger
Browser: Safari 312.3.1
Operating System: Mac OS X (10.4)