Marketcircle    Forums  Hop To Forum Categories  Extending Daylite  Hop To Forums  Scripting    add file reference with F-Script
Go
New
Find
Notify
Tools
Reply
  
-star Rating Rate It!  Login/Join 
Apprentice
Posted
Can anyone give me a tip about how to add a file reference to a contact with F-Script? I would like to do the same as the contextual menu item "Add File Reference", but I need to do it from a script.

All I've managed so far is the following:


tell application "Daylite"
eval "
document := (NSApplication sharedApplication) firstDayliteDocument.
objects := (document firstMainWindowController) selectedObjects.
object := objects lastObject.
urlReference := ((GWURLReference alloc) init).
urlReference setTypeCode:1; setUrl:'http://www.vimia.com'; setName:'Vimia GmbH'; setNote:'Test'.
(object urlReferences) add:urlReference.
"
end tell

This creates the GWURLReference and appends it to (object urlReferences), but urlReference is not initialised.

Steve
 
Posts: 20 | Registered: January 25, 2008Reply With QuoteEdit or Delete MessageReport This Post
Apprentice
Posted Hide Post
I've solved it. For those who are interested, this is how I did it:

tell application "Daylite"
eval "
document := (NSApplication sharedApplication) firstDayliteDocument.
objects := (document firstMainWindowController) selectedObjects.
object := objects lastObject.
objectContext := object objectContext.
cc := objectContext creationContext.
urlReference := cc createObjectForEntityNamed:'URLReference' addToObjectContext:true.
urlReference setTypeCode:1; setUrl:'http://www.vimia.com'; setName:'Vimia GmbH'; setNote:'Test'.
object addToUrlReferences:urlReference.
objectContext saveChanges.
"
end tell

I'm going to use this to create an Automator action and/or a system service to copy URLs into Daylite as URLReferences.

Steve
 
Posts: 20 | Registered: January 25, 2008Reply With QuoteEdit or Delete MessageReport This Post
Apprentice
Posted Hide Post
whoah, that looks impressive (not that I know how scripting works), but will this have the effect of allowing external applications to include a macro-type function to enable file paths/references to DL contacts/orgs, etc.?


Tim Jacka
Jacka Lawyers
+61 3 9014 1299
http://www.jackalawyers.com.au
 
Posts: 18 | Location: Melbourne, Australia | Registered: February 15, 2008Reply With QuoteEdit or Delete MessageReport This Post
Apprentice
Posted Hide Post
Tim

It works the other way around. It allows me to attach URLs and filenames to objects in Daylite. I use it to create links to e-mails in Xing (which is browser-based), but it works with any kind of URL.

I don't know if it is possible to export links from Daylite which would be accessible from external programs, which I think is what you are looking for. Perhaps the daylite: or daylite3: protocols allow this: I haven't had time to look at them closely enough. I agree that it would be useful.

Steve
 
Posts: 20 | Registered: January 25, 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    add file reference with F-Script

© Copyright 2006 Marketcircle Inc. All rights reserved.