Re: Write file command in Filemaker
Re: Write file command in Filemaker
- Subject: Re: Write file command in Filemaker
- From: Jay Louvion <email@hidden>
- Date: Tue, 03 Oct 2006 14:59:50 +0200
- Thread-topic: Write file command in Filemaker
Title: Re: Write file command in Filemaker
On 3.10.2006 14:04, "Peter Baxter" <email@hidden> spake thus:
How about this,
set theText to the clipboard
tell application "Microsoft Word"
activate
if exists not "Grammar Checker.doc" then
make new document
insert text theText at the end of text object of active document
check grammar text object of active document
save as active document file name "Grammar Checker.doc" with replacing
else
insert text theText at the end of text object of active document
check grammar text object of active document
save as active document file name "Grammar Checker.doc" with replacing
end if
end tell
Peter
Thanks Peter. Certainly a good solution for scripting Word, but as I stated, my itch is elsewhere and looks kinda like this:
tell application "FileMaker Pro" -- the tell block could be removed when runngin this from FM, I guess
set WebCode to cellValue of cell "WEB code" of current record of document 1 as text -- retrieving data from cell 1
set JobNr to cellValue of cell "Nr." of current record of document 1 as text -- retrieving data from cell 2
set JobTitle to cellValue of cell "concerne:" of current record of document 1 as text -- retrieving data from cell 3
set NewProjectContent to WebCode & return & JobNr & return & JobTitle -- compiling data in one block
my WriteToFile(NewProjectContent, (path to desktop as text) & "test.txt" as string, true) -- calling a subroutine to create and write to a file
end tell -- the tell block could be removed when runngin this from FM, I guess
on WriteToFile(this_data, target_file, append_data)
try
set the target_file to the target_file as text
set the open_target_file to ¬
open for access file target_file with write permission
if append_data is false then ¬
set eof of the open_target_file to 0
write this_data to the open_target_file starting at eof as «class utf8» -- at this stage, when compiling in FM, I have to add "tell app "System Events" or "Finder" to..." otherwise the "write" sounds off the non-compilation alarm.
close access the open_target_file
return true
on error
try
close access file target_file
end try
return false
end try
end WriteToFile
This whole script runs fine, the text file is just a 0K file, like the access errored out (I’ll have to ask FM to display a dialog if this is the case, I’ll post back)
Best,
j.
Jay Louvion
Studio Casagrande
3, rue Müller-Brun
1208 Geneva
T+4122 840 3272
F+4122 840 3271
skypeme:
jaylouvion
www.studiocasagrande.com
P Please consider the environment before printing this email.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden