I’ve copied a cell (a3) which contains a formula (=a1*a2)
I want to click in the destination cell (manually) and then call an AppleScript to “paste value”.
I’ve tried this:
tell application “AppleWorks 6”
activate
set r to 0
set r to the clipboard
paste r
end tell
and also:
tell application “AppleWorks 6”
activate
paste values
end tell
…but, of course, these don’t work. My intent is to assign a keystroke for this. Any assistance will be appreciated.
Thanks!
Barry
kel
June 4, 2006, 3:56am
#2
Hi,
I don’t remember using ‘paste values’. Maybe there’s a bug there. This worked:
tell application "AppleWorks 6"
activate
set x to the clipboard
set selection to x
end tell
gl,
kai
June 4, 2006, 4:15am
#3
Hi guys.
To do a physical paste:
tell application "AppleWorks 6"
activate
paste
end tell
You could also set the selected cell directly (it’s a good idea to specify the first cell, to avoid an error if more than one cell is selected):
tell application "AppleWorks 6" to set cell 1 of selection to the clipboard
You could even perform the entire operation without copying or pasting:
tell application "AppleWorks 6" to set cell 1 of selection to cell "A3" of document 1
It therefore follows that, if you know the target cell in advance, you don’t even have to select it:
tell application "AppleWorks 6" to tell document 1 to set cell "C5" to cell "A3"
Kel,
Thanks very much. Using “paste values” resulted in exactly the same effect as “paste” (which was a relative formula - what I didn’t want). Your script did the job.
Barry