Re: Applescript with Excel
Re: Applescript with Excel
- Subject: Re: Applescript with Excel
- From: T&B <email@hidden>
- Date: Thu, 01 Mar 2001 12:21:20 +1100
I know this doesn't help a lot, but perhaps offers an alternative.
I get an "out of memory" error at 'set cell "TestCell" to the clipboard'.
When I go to the Finder and check the contents of the clipboard, the
clipboard does contain the data I want it to contain.
Avoid using the clipboard in a script. Instead, set a variable to the value of an object in your spreadsheet, then set a cell in your database to that variable.
It's been a while since I've intensively scripted Excel. In AppleWorks, which probably has a better AppleScript object model, the script you need would simply be:
tell application "AppleWorks 6"
set copiedValue to cell "B3" in spreadsheet of document "My Spreadsheet"
end tell
tell application "FileMaker Pro"
set cell "TestCell" to copiedValue
end tell
tell application "Microsoft Excel"
...
CopyObject Selection
Ewww! How about this simpler approach with no clipboard:
set var1 to 12
tell application "AppelWorks 6"
set var2 to cell "M1" in spreadsheet of document "Sheet3"
end tell
activate
if var1 = var2 then
display dialog ("Dialog #1")
else
display dialog ("Dialog#2")
end if
The "display dialog" part of the script doesn't get executed. Instead, when I
run this script from Script Editor, the application menu flashes at me.
You need to activate whatever app id going to display the dialog. Simply add the "activate" line I have above.
Tom
T&B
http://www.tandb.com.au/applescript/