Re: Scripting copy and paste commands in FileMaker
Re: Scripting copy and paste commands in FileMaker
- Subject: Re: Scripting copy and paste commands in FileMaker
- From: David Durkee <email@hidden>
- Date: Fri, 15 Aug 2003 17:39:00 -0500
On Friday, August 15, 2003, at 05:12 PM, kai wrote:
on Fri, 15 Aug 2003 14:07:28 -0500, David Durkee <email@hidden>
wrote:
I just tried this, which worked for me. The main difference is that
I'm
using the standard addition "set the clipboard to" instead of using
the
Finder to set the clipboard, which did not appear to work.
tell application "FileMaker Pro"
set texttocopy to cell "Publisher email" of database 1
set the clipboard to texttocopy
end tell
tell application "Microsoft Word"
paste
end tell
Remember that, for the 'set the clipboard' to work properly, the target
application needs to be frontmost.
It worked for me without FileMaker or Word being frontmost. (As you can
see, there are no activates in my script and I ran it from Script
Debugger, so it remained active at all times.) "Set the clipboard to"
is a scripting addition, not a command of FileMaker so it really
doesn't matter what's in front when you use it. (For clarity, I should
have put it outside the tell block.) I tested this in Mac OS X
(10.2.6), and I'll readily admit that it might work differently in
older OSes, especially 9ish ones.
David
In a previous message, Kelvin Aitken said:
It will work faster if you skip the "activate" command.
- which is true for FileMaker Pro (but not necessarily for other apps).
However, if you don't activate FileMaker, and then tell it to set the
clipboard to something, the command is unlikely to work. If no
application
has been explicitly activated, it might be safer to use something like
(all
one line):
==============================
tell application (path to frontmost application as string) to set the
clipboard to textcopied
==============================
FWIW, in Courtney's original question (Thu, 14 Aug 2003 16:06:10
-0500), he
tried this:
Tell application "FileMaker Pro"
Activate
Select (data of cell "z_yearMonthSpreadsheet")
Copy
End tell
In a situation like this, I'd probably go for the 'set the clipboard'
approach too. However, to help clarify why the above failed (and to
demonstrate the usefulness of the 'do menu' command), here's a syntax
example that should work:
================================
tell application "FileMaker Pro"
activate -- required for the "Copy" command below
go to cell "z_yearMonthSpreadsheet" of database "Hours_.FP5" --
select
do menu menu "Edit"'s menu item "Select All" -- select cell's
contents
do menu menu "Edit"'s menu item "Copy" -- copy the selection
end tell
================================
(To deselect after copying, add the line: go to database "Hours_.FP5")
---
kai
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.
--
David Durkee
email@hidden
<
http://ddurkee.homeip.net/>
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.