Results 1 to 9 of 9

Thread: Feature suggestion: Enhancing the Stationary Script Context with Note Title

  1. #1

    Default Feature suggestion: Enhancing the Stationary Script Context with Note Title

    Hi Michael,

    I've been experimenting a bit with custom format notes and I've been following the great documentation available on the subject.

    One thing that I've found a bit limiting is the lack of access to a new note title from within the metadata script details. The context contains some details about the location of the note to be created, but the title you enter manually is not available in that context.

    So for example if my notes follow a custom filename pattern (e.g. date-title.extension), I cannot do this in one step through the metadata script.

    Do you think it would be possible to include this bit of information in the context record that gets passed to the script?

    thanks,

    A://
    Last edited by Michael Tsai; 02-24-2012 at 06:42 PM. Reason: Added link.

  2. #2

    Default

    Quote Originally Posted by alex View Post
    One thing that I've found a bit limiting is the lack of access to a new note title from within the metadata script details. The context contains some details about the location of the note to be created, but the title you enter manually is not available in that context.

    So for example if my notes follow a custom filename pattern (e.g. date-title.extension), I cannot do this in one step through the metadata script.

    Do you think it would be possible to include this bit of information in the context record that gets passed to the script?
    I will add that to do the to-do list. For now, I think it would work if you made the File column visible. Then EagleFiler would no longer bring up the sheet to ask you for the filename. You could then add a “display dialog” command to your metadata script that prompts for a filename, and then it would be available to you within the script.

  3. #3

    Default

    I went this route and sometimes it works, but sometimes I'm getting a weird error back:

    Code:
    AEError: {
      NSAppleScriptErrorAppName = EagleFiler;
      NSAppleScriptErrorBriefMessage = "No user interaction allowed.";
      NSAppleScriptErrorMessage = "No user interaction allowed.";
      NSAppleScriptErrorNumber = "-1713";
      NSAppleScriptErrorRange = "NSRange: {0,0}";
    }
    Now the error message is spelled out, but I cannot figure out what it really means (or why it works sometimes).

    My stationary script is as simple as:

    Code:
    on metadata(_context)
    	set _title to text returned of (display dialog ¬
    		"Enter note name" with title ¬
    		"EagleFiler Markdown Note" default answer ¬
    		"" buttons {"Continue…"} ¬
    		default button 1)
    	set _base to do shell script "date '+%Y%m%d%H%M%S'"
    	set _basename to _base & "-" & _title
    	set _tags to {"note", "markdown"}
    	return {basename:_basename, tags:_tags, title:_title}
    end metadata
    Any ideas?

    thanks a lot,

    A://

  4. #4

    Default

    Quote Originally Posted by alex View Post
    I went this route and sometimes it works, but sometimes I'm getting a weird error back:
    It seems to be working on my Mac. Do you get consistent results within a given EagleFiler launch session?

  5. #5

    Default

    Quote Originally Posted by Michael Tsai View Post
    It seems to be working on my Mac. Do you get consistent results within a given EagleFiler launch session?
    Hmmm... that's a good question. I guess the answer would be yes, as once I'm noticing it doesn't work there's nothing I can do to make it work. For example today, it works. I'll keep this question in mind and try to validate it.

    Do you have any thoughts what might trigger this behavior? It makes me think of some permission related behavior that would not allow AS scripts to display visual elements (the input dialog) when the app was started automatically...

  6. #6

    Default

    Quote Originally Posted by alex View Post
    I guess the answer would be yes, as once I'm noticing it doesn't work there's nothing I can do to make it work.
    I wonder if restarting EagleFiler or your Mac would help.

    Quote Originally Posted by alex View Post
    Do you have any thoughts what might trigger this behavior? It makes me think of some permission related behavior that would not allow AS scripts to display visual elements (the input dialog) when the app was started automatically...
    I’ve typically seen this error when the script is run from a context in which there is no user interface. For example, logged into a Mac via Terminal and then running the script with “osascript”. However, in this case the script is running from within EagleFiler, which is obviously already displaying a user interface. So I’m not sure what the problem is.

    It would also be interesting to see what happens if you put the “display dialog” inside a “tell” for another application…

  7. #7

    Default

    Quote Originally Posted by Michael Tsai View Post
    I’ve typically seen this error when the script is run from a context in which there is no user interface. For example, logged into a Mac via Terminal and then running the script with “osascript”.
    I don't to that.

    Quote Originally Posted by Michael Tsai View Post
    However, in this case the script is running from within EagleFiler, which is obviously already displaying a user interface. So I’m not sure what the problem is.

    It would also be interesting to see what happens if you put the “display dialog” inside a “tell” for another application…
    I think this last part might do it. I remember using a similar trick for displaying a dialog from an AS script triggered by cron.

  8. #8

    Default

    I think I've finally identified a scenario that leads to this error:

    1. leave EagleFile running
    2. put computer to sleep
    3. wake up
    4. create new item (using custom stationary script)

    The only workaround I've found is restarting EagleFiler.

    I'm not sure there's anything that can be done or if this represents a more serious bug in the way Mac OS X changes app attributes after a sleep-wakeup cycle (I'm not a OS X developer so I shouldn't comment on this though).

    A://

  9. #9

    Default

    Quote Originally Posted by alex View Post
    I think I've finally identified a scenario that leads to this error:

    1. leave EagleFile running
    2. put computer to sleep
    3. wake up
    4. create new item (using custom stationary script)
    It sounds like a potential bug in Mac OS X. However, I was not able to reproduce this problem on my Mac with a stock installation of 10.7.3. So there might be some other software involved.

Similar Threads

  1. Feature request: note pane
    By brab in forum EagleFiler
    Replies: 5
    Last Post: 05-16-2011, 01:16 PM
  2. Importing note via Launchbar & script
    By jas in forum EagleFiler
    Replies: 5
    Last Post: 11-23-2010, 07:04 PM
  3. Feature Request: Quick Note
    By efjedi in forum EagleFiler
    Replies: 11
    Last Post: 11-23-2010, 07:03 PM
  4. Script to set URL to Note Text
    By kaybee in forum EagleFiler
    Replies: 3
    Last Post: 02-25-2010, 02:15 PM
  5. Script to set title
    By pwg in forum EagleFiler
    Replies: 4
    Last Post: 10-16-2008, 06:12 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •