Marketcircle    Forums  Hop To Forum Categories  Extending Daylite  Hop To Forums  Scripting    F-script libraries? Importing?
Go
New
Find
Notify
Tools
Reply
  
-star Rating Rate It!  Login/Join 
Apprentice
Posted
Haven't found this one in the docs or online yet. Is there a way to import modules/libraries in F-script? And specifically, within dlscriptd folders?

What I'd like to do is have some common code in a file that I can pop into each dlscriptd folder so I don't have to copy and paste it.
 
Posts: 11 | Registered: September 19, 2006Reply With QuoteEdit or Delete MessageReport This Post
Marketcircle Team
Posted Hide Post
Sure, you can load in a file like this...

Here's my file.

===== mystuff.fscript ===== BEGIN =====

addTwoNum := [ :a :b | a+b ].

multiplyTwoNum := [ :a :b | a*b ].

subtractTwoNum := [ :a :b | a-b ].

sayHello := [ :name | sys log:'Hello ' ++ name ].


===== mystuff.fscript ===== END =====

now in a script, you can do...


sys interpreter execute:(NSString stringWithContentsOfFile:'/Users/myUsername/Desktop/mystuff.fscript').

sayHello value:'Eric'.

addTwoNum value:4 value:5.
 
Posts: 60 | Registered: June 13, 2006Reply With QuoteEdit or Delete MessageReport This Post
Apprentice
Posted Hide Post
Thanks. This is helpful. I actually figured out something similar using object serialization but overlooked the interpreter message.

Since I use dlscriptd bundles, I have also been getting the bundle path using:

(scriptPath stringByDeletingLastPathComponent)
 
Posts: 11 | Registered: September 19, 2006Reply 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    F-script libraries? Importing?

© Copyright 2006 Marketcircle Inc. All rights reserved.