I have this nifty script which says it can’t make my spreadsheet into type real.
get sheet “Details”
sheet “Details”
“Can’t make "WCSlave14.xls" into type real.”
What kind of error is type real?
dzelnio
on run
idle
end run
on idle
tell application "Finder" to set t_file to (duplicate "Macintosh HD:WordCounts.xls" to "Macintosh HD:wcounts" with replacing) as Unicode text
tell application "Microsoft Excel"
open t_file
set oldValue to display alerts
set display alerts to false
save workbook "WordCounts.xls" in t_file as Excel9795
set display alerts to oldValue
tell application "Microsoft Excel"
copy range range "A:D" of the active sheet
end tell
close workbook "WordCounts.xls"
end tell
tell application "Microsoft Excel"
open "Macintosh HD:wcounts:WCSlave14.xls"
set oldValue to display alerts
set display alerts to false
set cells_toPaste to {"WCSlave14.xls" / (worksheet sheet "Details") / A, D}
paste
save workbook "WCSlave14.xls"
set display alerts to oldValue
end tell
close workbook
return 60 * 60 -- one hour, in seconds
end idle
AppleScript is trying to coerce that string into a real number so that it can do the division in your script.
I do not know the problem with your script.
I thought this might help you a little.
According to my AppleScript book a real is a interger with a decimal point.
class of 1 – interger
class of 1.1 – real
hope this helps!
higashijoe
{“WCSlave14.xls”/(worksheet sheet “Details”)/A, D}
is a path to a worksheet called Details.
Being a novice I want to make this my path
WCSlave14.xls:Details:A:D
But that doesn’t work
Basically I want to select columns A through D on WCSlave.xls and paste the information from earlier in the script. It will need to constantly write-over existing info.
By the way, manually copying and pasting works fine.
I hate errors.
paste range "WCSlave14.xls:Details:A:D"
"Microsoft Excel got an error: range \"WCSlave14.xls:Details:A:D\" doesn't understand the paste message."
===
The script
on run
idle
end run
on idle
tell application “Finder” to set t_file to (duplicate “Macintosh HD:WordCounts.xls” to “Macintosh HD:wcounts” with replacing) as Unicode text
tell application "Microsoft Excel"
open t_file
set oldValue to display alerts
set display alerts to false
save workbook "WordCounts.xls" in t_file as Excel9795
set display alerts to oldValue
tell application "Microsoft Excel"
copy range range "A:D" of the active sheet
end tell
close workbook "WordCounts.xls"
end tell
tell application "Microsoft Excel"
open "Macintosh HD:wcounts:WCSlave14.xls"
set oldValue to display alerts
set display alerts to false
tell application "Microsoft Excel"
paste range "WCSlave14.xls:Details:A:D"
save workbook "WCSlave14.xls"
set display alerts to oldValue
end tell
end tell
close
return 60 * 60 -- one hour, in seconds
end idle