Re: move the contents of a document into a variable/record...
Re: move the contents of a document into a variable/record...
- Subject: Re: move the contents of a document into a variable/record...
- From: Bryan <email@hidden>
- Date: Mon, 20 Nov 2000 19:05:23 -0500
- Organization: Apex Radiology
Yes it's possible.
See my response to Chris Fowler,
Like I said, it's really funny how things work on these lists.
The same problem seems to arise for multiple people simultaneously.
I copied the previous thread below.
Jim Bob Support wrote:
>
i have a simple text file that contains one long string, something like
>
this...
>
>
{RecordID:1234, Docket:4312, CompanyName:"Fred's Garage", Quantity:10}
>
>
...normally i would open BBEdit and copy the contents of the document into a
>
variable/Record.
>
>
i would like to know if i can simply transfer the contents of the document
>
into the variable/record without using an application like BBEdit to serve as
>
a conduit.
>
>
is this possible ?
>
>
thank you for your time and help ;-)
It's really funny how things happen on this list sometimes.
I just finished this script last night.
How's this for a solution?
Keep your old scripts in place.
Make a new, smaller FMP db, just for the design department.
Export just the data you'll need to the text files.
Import the text files to the new FMP db.
The code to import the text files is at the end.
[/caveat]
This code is requires Tanaka's OSAX.
[/end caveat]
This assumes that every exported text file has the same format,
but not that every item is populated.
The format of the data in the text file for this example is:
[CMP DESC]
Control=0
Author Name=Bryan Kaufman
Author ID=1216
Subject Name=
Subject ID=819835
JobNum=156242
Tran ID=0
Tran Name=
Author Time=Sat Nov 04 16:44:34 2000
Author Time Long=973374274
Transcribe Time=Wed Dec 31 19:00:00 1969
Transcribe Time Long=0
In Transcribe Time=0
Work Type=81
Department=0
Location Code=0
Account=0
User Field1=0
User Field2=0
User Field3=0
User Field4=0
User Field5=0
User Field6=0
User Field7=0
User Field8=0
User Field9=0
User Field10=0
Location Name=0
VoiceName=D:\WAVES\156242.wav
VoiceSize=1261248
Priority=0
Aged=Not Aged
Original JobNum=156242
Port Number=13
System Id=1000
Logical Unit=0
Physical Unit=0
Source Id=1
Source Name=
-------Begin Code---------
on run
set filelist to choose file
open (filelist)
end run
on open (filelist)
global secondparse
if (count of (filelist as list)) is 1 then set filelist to {filelist}
repeat with fp in filelist
set fref to open for access file fp
set t to read file fp
close access fref
set firstparse to MT Parse t item delimiter "="
set firstparse to suppress item 1 from firstparse
set secondparse to {}
repeat with eachprop in firstparse
set propval to (suppress item 1 from eachprop)
if propval is not {} then ,
set secondparse to secondparse & item 1 of propval
end repeat
tell application "FileMaker Pro" to ,
set newRec to create new record with data secondparse ,
at end of layout 0 of database 1
end repeat
end open
-------End Code---------
Chris Fowler wrote:
>
Hey all,
>
>
I'm in a situation where our company is migrating from a FileMaker Pro, Mac
>
based company system to a SQL Server / ASP / browser based company solution.
>
Also, many people in the company are/will be now using PCs. However, our
>
graphic designers will continue on with their Macs. I've written quite a few
>
AppleScripts which interface with FileMaker Pro to automate some work for
>
the designers. Now, I have to have the AppleScript interface with data
>
generated from SQL Server instead of FileMaker.
>
>
My thoughts on the solution are to have an ASP page that exports a text file
>
from the database with the information I need for the AppleScript. Then,
>
have the AppleScript interface with the text file rather than with FileMaker
>
Pro (which will no longer exist).
>
>
Has anyone done a solution similar to this who would have some code snippets
>
or tips that will save me any headaches? Code for either an AppleScript
>
interfacing with a text file or for a PC/Mac solution?
>
>
Thanks!
>
>
Chris Fowler
>
email@hidden