NSCannotCreateScriptCommandError !!!

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)

I have tried with the ‘get size’ methode, but he gives now another error: Mail got an error, Can’t make file into a item.
What should I do to solve this problem???
code:
set open_file to choose file with prompt “Choose a file containing the messages”
–set file_path to open_file as string

→ get size of alias [path to file]
–set file_rate_size to size of the open_file
–set file_rate to file_rate_size as number

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 

Thanks, grtz
lee

Hi jaques,

I want to open a file, a message that I received in a mail…

those file I want to check on the size, if the size is small it has to be in folder 1 and if it is big it has to in folder 2. For that reason I want to know the size of the file.

after putting those files in the right folders (1 or 2) there must be the choice for the user to open and read the messages… that is written on the bottom of the script…

thanks!

Thanks!!
It works better and better now, but there is one thing that is missing,

after it is checked on the size, it has to add to the folder (1,2,3)… and afte rthat it has to be possibility to open that folder with that file in it…

thanks a lot for your help!!!

lee

Hi Jack,

I have seen the code and it’s just … perfect!

thanks!!!

grtz
lee