AlekThunder

Q: Please help me to improve automator's action

Hello to everyone.

 

I made an automator action to create a new note

 

on run {input, parameters}

 

  set the noteName to text returned of (display dialog "Make a Note" with icon 1 default answer "")

  tell application "Notes"

  set thisAccountName to "iCloud"

  make new note at folder "Notes" of account thisAccountName with properties {name:noteName}

  end tell

 

  return input

end run

 

It works like this 

 

Now I’d like to improve it in that way:Screenshot 2016-08-17 12.58.02.png

- make a wider window for input text to be able to see all the text, not only a few words in one line

- use a default account  for a new note

- use a clipboard as a default text

OS X El Capitan (10.11.6)

Posted on Aug 17, 2016 3:18 AM

Close

Q: Please help me to improve automator's action

  • All replies
  • Helpful answers

  • by Camelot,Solvedanswer

    Camelot Camelot Aug 17, 2016 7:22 AM in response to AlekThunder
    Level 8 (47,243 points)
    Mac OS X
    Aug 17, 2016 7:22 AM in response to AlekThunder

    make a wider window for input text to be able to see all the text, not only a few words in one line

    You have virtually no control over the 'display dialog' layout. Your options are to:

     

    1) use the Automator action 'Ask for Text' which performs a similar function, but with a larger text area.

    2) switch to a system other than Automator (e.g. AppleScriptObjC) which gives you full UI controls, so you can design your own dialog

    3) hack the display dialog input to force a multi-line input field:

     

    set the noteName to text returned of (display dialog "Make a Note" with icon 1 default answer "

     

     

    ")

     

    By providing default answer that is multiple (blank) lines, the dialog expands to show this. It's not perfect, but the work-effort is virtually 0.

     

    - use a default account  for a new note

    I don't understand what you mean here by 'default account'.

     

    - use a clipboard as a default text

    Just:

     

    set the noteName to text returned of (display dialog "Make a Note" with icon 1 default answer (get the clipboard as text))


  • by AlekThunder,

    AlekThunder AlekThunder Aug 17, 2016 11:45 PM in response to Camelot
    Level 1 (55 points)
    Mac OS X
    Aug 17, 2016 11:45 PM in response to Camelot

    Thank you very much. It works and it’s very useful.

    Concerning to “default account”. I thought that “Note” had settings for choosing an account by default, because any time I share something to “Note” from other app, it makes a new note always in the same account. But I didn’t find any settings. So, I delete this question.

     

    Thank you again!