Marketcircle    Forums  Hop To Forum Categories  Extending Daylite  Hop To Forums  Scripting    Read/Write with F-Script?
Go
New
Find
Notify
Tools
Reply
  
-star Rating Rate It!  Login/Join 
Apprentice
Posted
How do I get F-Script to read a file? For example, I have a CSV full of URLs, and I would like to create URL references for each of them.

The examples in the developer kit include writing, but not reading files.
 
Posts: 11 | Registered: November 19, 2007Reply With QuoteEdit or Delete MessageReport This Post
LS
Apprentice
Posted Hide Post
You read a file just like you would with Cocoa: use NSString stringWithContentsOfFile: pathToFile encoding:NSStringEncoding error:NSError.

data := NSString stringWithContentsOfFile:'/Users/username/Desktop/test.csv' encoding:NSUTF8StringEncoding error:nil.


This returns a NSString containing the contents of the CSV file. To parse the CSV file, you can use -componentsSeparatedByString:NSString
dataItems := data componentsSeparatedByString:', '.


This returns a NSArray of each comma separated value.
 
Posts: 2 | Registered: September 21, 2008Reply With QuoteEdit or Delete MessageReport This Post
 Previous Topic | Next Topic powered by eve community  
 

Marketcircle    Forums  Hop To Forum Categories  Extending Daylite  Hop To Forums  Scripting    Read/Write with F-Script?

© Copyright 2006 Marketcircle Inc. All rights reserved.