Jump to content

bethany7

Member
  • Posts

    7
  • Joined

  • Last visited

  • Days Won

    1

Reputation Activity

  1. Like
    bethany7 reacted to mlgill in Create a Note in Notes App   
    Hi Bethany,
     
    Nice workflow!
     
    To get a notification, you have to return a string of some kind from the "alfred_script" subroutine. I'm no Applescript wizard myself, but I think I can help.
     
    Here's a sample applescript that will query Notes.app to see if the note was created and then return information about it. I've made lots of comments so hopefully it's relatively clear. 
     
    on alfred_script(q) tell application "Notes" set theNoteID to make new note in folder "Notes" with properties {name:"From Alfred", body:q} end tell -- this function will check for the note and retun a string with some information from it set theResultOfNoteQuery to my verify_note(theNoteID) -- next return the string from this script to alfred return theResultOfNoteQuery end alfred_script on verify_note(theNoteID) try tell application "Notes" -- get references for the properties of the note and the list that contains it set theNoteProperties to properties of theNoteID set theListProperties to properties of container of theNoteID -- get some of the properties of interest from the note and from the list set theTitle to the name of theNoteProperties set theText to the body of theNoteProperties set theCreationDate to the creation date of theNoteProperties set theListName to the name of theListProperties end tell -- shorten the main text of the note so it fits in the notification -- can adjust this via the integer for "maxStringLength" set maxStringLength to 15 if the length of theText > maxStringLength then set theShortText to (items 1 thru maxStringLength of theText as string) & ".." else set theShortText to theText end if -- put this together to make a string with note info -- this joins some variables with text -- the backslashes before some of the double quotes are so that these double quotes are part of the text that is shown -- this can be customized if you want to change the notification -- this is a detailed version of the string to be returned -- it has currently been commented out so it is not used --set theSuccessString to "Created note with title \"" & theTitle & "\" on list \"" & theListName & "\" on " & theCreationDate & " with text \"" & theShortText & "\"." -- this is a shorter version set theSuccessString to "Created note with text \"" & theShortText & "\"." on error -- if the "try" function fails, it likely means the note does not exist set theSuccessString to "There was an error creating the note." end try -- send this back to the main alfred function return theSuccessString end verify_note  
     
    It sounds like you know this, but after the "Run Applescript" block in the workflow, you then also have to add a block to "Post Notification" within that block, add {query} to the "Text:" field and customize anything else. This notification block has to be connected to the backend of your "Run Applescript" blocks.
     
    Hope this helps.
  2. Like
    bethany7 got a reaction from mlgill in Create a Note in Notes App   
    Hi,
     
    Okay, please forgive me for any mistakes I make here! This is my first, very basic, AppleScript workflow. It is probably terribly done and completely wrong, but I was proud and wanted to share it! It's very simple, just creates a note in the Notes app. It can either close immediately after or (by pressing alt) can leave the app open.
     
    I apologise if this workflow is a duplicate of someone else's, I couldn't find one by searching when I looked, as I wasn't originally planning on creating it myself!
     
    I was hoping somebody could give me some advice on extending the workflow to add a notification when successful. I wanted to display the contents of the note in the notification, but using {query} just results in a blank message! Any corrections, improvements and modifications are very welcome!
     
    Workflow available here: http://d.pr/f/H7f6
  3. Like
    bethany7 got a reaction from jibbe in Create a Note in Notes App   
    Hi,
     
    Okay, please forgive me for any mistakes I make here! This is my first, very basic, AppleScript workflow. It is probably terribly done and completely wrong, but I was proud and wanted to share it! It's very simple, just creates a note in the Notes app. It can either close immediately after or (by pressing alt) can leave the app open.
     
    I apologise if this workflow is a duplicate of someone else's, I couldn't find one by searching when I looked, as I wasn't originally planning on creating it myself!
     
    I was hoping somebody could give me some advice on extending the workflow to add a notification when successful. I wanted to display the contents of the note in the notification, but using {query} just results in a blank message! Any corrections, improvements and modifications are very welcome!
     
    Workflow available here: http://d.pr/f/H7f6
  4. Like
    bethany7 got a reaction from drking in Create a Note in Notes App   
    Hi,
     
    Okay, please forgive me for any mistakes I make here! This is my first, very basic, AppleScript workflow. It is probably terribly done and completely wrong, but I was proud and wanted to share it! It's very simple, just creates a note in the Notes app. It can either close immediately after or (by pressing alt) can leave the app open.
     
    I apologise if this workflow is a duplicate of someone else's, I couldn't find one by searching when I looked, as I wasn't originally planning on creating it myself!
     
    I was hoping somebody could give me some advice on extending the workflow to add a notification when successful. I wanted to display the contents of the note in the notification, but using {query} just results in a blank message! Any corrections, improvements and modifications are very welcome!
     
    Workflow available here: http://d.pr/f/H7f6
  5. Like
    bethany7 reacted to phyllisstein in [Fixed Again] Kindle Bookstore Search   
    Thanks! It's not quite as simple as pointing the script at a different URI, since it needs to search the page for specific tags that contain the data it needs; however, it's also not quite a matter of totally rewriting it, either, and the Kobo search page is pretty clearly laid-out, so I'll see if I can't put something together later this afternoon.
×
×
  • Create New...