[proFit-list] Applescript question on data import options

Scott Lasley slasley at space.umd.edu
Fri Mar 25 14:27:33 CDT 2011


On Mar 25, 2011, at 2:35 PM, Dave Sopchak wrote:

> Hi all,
> 	I'm trying to write an applescript to automate data import of some files with a big header, and I noticed in the pro Fit applescript dictionary a data import option headerLines, which I figured could be used to chop off this stuff and get to what I need. It doesn't work, though, with various combinations.  What am I doing something wrong?
> Here's an example of what I'm trying to do. If it does import, it doesn't cut off the header.
> on parseStuffIn(theFile)
> 	tell application "pro Fit 6.2.3"
> 		activate
> 		data import options mode custom -- or withTitles or withoutTitles
> 		data import options headerLines 93
> 		open theFile with «class impo» given «class as  »:data window
> Thanks for any and all. 
> Dave

I think you need to set the delimiter and terminator
Here's a couple of lines from an applescript I use to read a text file, skip the first 14 lines, and read the titles

	data import options mode custom headerLines 14 delimiter "*\\w" terminator "\\R" title delimiter "\\w" with copyInfo and titles
	open thermFile as data window

The script fails to import data properly if I remove the delimiter and terminator options.  It was generated using the Record button in Applescript Editor.  Click Record at the top left of the AppleScript Editor window, switch to pro Fit and import a file using the custom options you need, then switch back to AppleScript Editor and click the Stop button.  That should give you a template you can use to figure out the data import options.

Hope this helps,
Scott


More information about the proFit-list mailing list