Re: Using Applescript to find an existing yojimbo note...

2008-01-19 Thread Michael Heinz
If it matters, I got the same error as Alan, but I chose to wrap it  
with the try/on error/end try block that I was already using.


--
Michael Heinz
Phoenixville, Pennsylvania


On Jan 18, 2008, at 2:40 PM, Alan German wrote:



On Jan 18, 2008, at 2:24 PM, Jim DeVona wrote:

On Jan 18, 2008 1:00 PM, Alan German [EMAIL PROTECTED]  
wrote:

On Jan 18, 2008, at 12:38 PM, Jim DeVona wrote:


-- find existing note
set mynote to first note item whose name is mytitle
if mynote is missing value then
-- create a new note
set mynote to (make new note item with properties ¬
{name:mytitle, contents:imported on   date})
add tags mytags to mynote
end if



In my testing here, this causes an error (in Script Debugger) when  
no

such item exists.


Just for reference, I tested my version with Yojimbo 1.5 on Mac OS X
10.4.11 using Apple's Script Editor 2.1.1 (AppleScript 1.10.7), and  
no

error occurs when an item named by mytitle does not exist. Perhaps it
is a Script Debugger issue?


I should have offered similar clues -- sorry.

I'm using Yojimbo 1.5 on Mac OS X 10.5.1. I get the same error in  
Script Editor 2.2 (Applescript 2.0) as I do in Script Debugger 4.0.8.


Yojimbo got an error: Can’t get note item 1 whose name = Friday,  
January 18, 2008. Invalid index.


Let's blame Apple, shall we? ;-)


Whatever works!


That's my motto!


Alan


--
--
This message is sent to you because you are subscribed to
the mailing list yojimbo-talk@barebones.com.
To unsubscribe, send mail to: [EMAIL PROTECTED]
List archives:  http://www.listsearch.com/yojimbotalk.lasso
Have a feature request, or not sure if the software's working
correctly? Please send mail to: [EMAIL PROTECTED]



--
--
This message is sent to you because you are subscribed to
 the mailing list yojimbo-talk@barebones.com.
To unsubscribe, send mail to: [EMAIL PROTECTED]
List archives:  http://www.listsearch.com/yojimbotalk.lasso
Have a feature request, or not sure if the software's working
correctly? Please send mail to: [EMAIL PROTECTED]


Re: Using Applescript to find an existing yojimbo note...

2008-01-18 Thread Alan German

On Jan 18, 2008, at 12:38 PM, Jim DeVona wrote:


-- find existing note
set mynote to first note item whose name is mytitle
if mynote is missing value then
-- create a new note
set mynote to (make new note item with properties ¬
{name:mytitle, contents:imported on   date})
add tags mytags to mynote
end if



In my testing here, this causes an error (in Script Debugger) when no  
such item exists. I had to change the test for finding an existing  
note as follows:


-- find existing note
set resultList to get (every note item whose name is mytitle)

if (count of resultList) is 0 then
-- create a new note
set mynote to (make new note item with properties ¬
			{name:mytitle, contents:imported on   mytitle}) -- N.B. changed  
'date' to 'mytitle'

add tags mytags to mynote
else
set mynote to first item of resultList
end if



Alan


--
--
This message is sent to you because you are subscribed to
 the mailing list yojimbo-talk@barebones.com.
To unsubscribe, send mail to: [EMAIL PROTECTED]
List archives:  http://www.listsearch.com/yojimbotalk.lasso
Have a feature request, or not sure if the software's working
correctly? Please send mail to: [EMAIL PROTECTED]


Re: Using Applescript to find an existing yojimbo note...

2008-01-18 Thread Jim DeVona
On Jan 18, 2008 2:40 PM, Alan German [EMAIL PROTECTED] wrote:

 On Jan 18, 2008, at 2:24 PM, Jim DeVona wrote:

  On Jan 18, 2008 1:00 PM, Alan German [EMAIL PROTECTED]
  wrote:
  On Jan 18, 2008, at 12:38 PM, Jim DeVona wrote:
 
   -- find existing note
   set mynote to first note item whose name is mytitle
   if mynote is missing value then
   -- create a new note
   set mynote to (make new note item with properties ¬
   {name:mytitle, contents:imported on   date})
   add tags mytags to mynote
   end if
 
 
  In my testing here, this causes an error (in Script Debugger) when no
  such item exists.
 
  Just for reference, I tested my version with Yojimbo 1.5 on Mac OS X
  10.4.11 using Apple's Script Editor 2.1.1 (AppleScript 1.10.7), and no
  error occurs when an item named by mytitle does not exist. Perhaps it
  is a Script Debugger issue?

 I should have offered similar clues -- sorry.

 I'm using Yojimbo 1.5 on Mac OS X 10.5.1. I get the same error in
 Script Editor 2.2 (Applescript 2.0) as I do in Script Debugger 4.0.8.

 Yojimbo got an error: Can't get note item 1 whose name = Friday,
 January 18, 2008. Invalid index.

 Let's blame Apple, shall we? ;-)

It so happens I just installed Leopard this evening, and indeed I get
the same error now too. Probably just a consequence of the changes to
AppleScript; I didn't realize so much syntax was influenced. (I
foresee a long weekend of... adapting to these improvements.) Anyway,
thanks for your corrections.

Jim

--
--
This message is sent to you because you are subscribed to
  the mailing list yojimbo-talk@barebones.com.
To unsubscribe, send mail to: [EMAIL PROTECTED]
List archives:  http://www.listsearch.com/yojimbotalk.lasso
Have a feature request, or not sure if the software's working
correctly? Please send mail to: [EMAIL PROTECTED]


Re: Using Applescript to find an existing yojimbo note...

2008-01-18 Thread Jim DeVona
On Jan 18, 2008 1:00 PM, Alan German [EMAIL PROTECTED] wrote:
 On Jan 18, 2008, at 12:38 PM, Jim DeVona wrote:

-- find existing note
set mynote to first note item whose name is mytitle
if mynote is missing value then
-- create a new note
set mynote to (make new note item with properties ¬
{name:mytitle, contents:imported on   date})
add tags mytags to mynote
end if


 In my testing here, this causes an error (in Script Debugger) when no
 such item exists.

Just for reference, I tested my version with Yojimbo 1.5 on Mac OS X
10.4.11 using Apple's Script Editor 2.1.1 (AppleScript 1.10.7), and no
error occurs when an item named by mytitle does not exist. Perhaps it
is a Script Debugger issue?

Whatever works!
Jim

--
--
This message is sent to you because you are subscribed to
  the mailing list yojimbo-talk@barebones.com.
To unsubscribe, send mail to: [EMAIL PROTECTED]
List archives:  http://www.listsearch.com/yojimbotalk.lasso
Have a feature request, or not sure if the software's working
correctly? Please send mail to: [EMAIL PROTECTED]


Re: Using Applescript to find an existing yojimbo note...

2008-01-18 Thread Alan German


On Jan 18, 2008, at 2:24 PM, Jim DeVona wrote:

On Jan 18, 2008 1:00 PM, Alan German [EMAIL PROTECTED]  
wrote:

On Jan 18, 2008, at 12:38 PM, Jim DeVona wrote:


 -- find existing note
 set mynote to first note item whose name is mytitle
 if mynote is missing value then
 -- create a new note
 set mynote to (make new note item with properties ¬
 {name:mytitle, contents:imported on   date})
 add tags mytags to mynote
 end if



In my testing here, this causes an error (in Script Debugger) when no
such item exists.


Just for reference, I tested my version with Yojimbo 1.5 on Mac OS X
10.4.11 using Apple's Script Editor 2.1.1 (AppleScript 1.10.7), and no
error occurs when an item named by mytitle does not exist. Perhaps it
is a Script Debugger issue?


I should have offered similar clues -- sorry.

I'm using Yojimbo 1.5 on Mac OS X 10.5.1. I get the same error in  
Script Editor 2.2 (Applescript 2.0) as I do in Script Debugger 4.0.8.


Yojimbo got an error: Can’t get note item 1 whose name = Friday,  
January 18, 2008. Invalid index.


Let's blame Apple, shall we? ;-)


Whatever works!


That's my motto!


Alan


--
--
This message is sent to you because you are subscribed to
 the mailing list yojimbo-talk@barebones.com.
To unsubscribe, send mail to: [EMAIL PROTECTED]
List archives:  http://www.listsearch.com/yojimbotalk.lasso
Have a feature request, or not sure if the software's working
correctly? Please send mail to: [EMAIL PROTECTED]


Re: Using Applescript to find an existing yojimbo note...

2008-01-18 Thread Jim DeVona
How's this?

tell application Yojimbo
set mytags to {QLogic, Diary}
set mytitle to date string of (current date)

-- find existing note
set mynote to first note item whose name is mytitle

if mynote is missing value then
-- create a new note
set mynote to (make new note item with properties ¬
{name:mytitle, contents:imported on   date})
add tags mytags to mynote
end if

activate
open location x-yojimbo-item://  (get id of mynote)
end tell

I don't know of a scriptable way to reveal items in the main window (I
wish there was - it'd be useful) so the open location hack shows the
item in a separate window.

Hope this helps,
Jim

On Jan 18, 2008 11:04 AM, Michael Heinz [EMAIL PROTECTED] wrote:
 Hey,

 I'd like to use Yojimbo to keep a daily work diary. To make it easier,
 I'd like to set up an applescript that will create the title of the
 diary entry (based on today's date) and either (a) find the entry if
 it already exists or (b) create a new entry if it does not.

 I've figured out how to create the new entry, but I can't figure out
 how to search Yojimbo to see if it already exists. In addition, I'm
 not sure how to have Yojimbo select the diary entry and bring it to
 the front. Here's what I have:

 tell application Yojimbo
 set mytags to {QLogic, Diary}
 set mytitle to date string of (current date)
 try
 -- find existing note
 set mynote to ???
 on error
 -- create a new note
 set mynote to (make new note item with properties ¬
 {name:mytitle, contents:imported on   date})

 add tags mytags to mynote
 end try
 activate
 -- how do I bring the note to the front?
 end tell

 Thanks for any help you can give!
 --
 Michael Heinz
 Phoenixville, Pennsylvania



 --
 --
 This message is sent to you because you are subscribed to
   the mailing list yojimbo-talk@barebones.com.
 To unsubscribe, send mail to: [EMAIL PROTECTED]
 List archives:  http://www.listsearch.com/yojimbotalk.lasso
 Have a feature request, or not sure if the software's working
 correctly? Please send mail to: [EMAIL PROTECTED]


--
--
This message is sent to you because you are subscribed to
  the mailing list yojimbo-talk@barebones.com.
To unsubscribe, send mail to: [EMAIL PROTECTED]
List archives:  http://www.listsearch.com/yojimbotalk.lasso
Have a feature request, or not sure if the software's working
correctly? Please send mail to: [EMAIL PROTECTED]