Jump to content

Workflow works as HotKey but not Fallback Search...


Recommended Posts

Hi Forum!

I have a simple script to add currently selected text to my Sticky Note. It works great using the hotkey. Then I wanted the ability to add a "Fallback Search" so whatever I have typed in Alfred will be moved to Sticky Note. The latter isn't working and I'm not sure why.

 

Here's the working HotKey script:

 

 

tell application "Stickies" to activate
tell application "System Events"
    tell process "Stickies"
        tell window 1
            keystroke "{query}"
            keystroke return
            keystroke "-"
            keystroke return
        end tell
    end tell
end tell
 

Can someone provide me with a solution for this to work with a Fallback Search?

 

 

Link to comment

Hi Forum!

I have a simple script to add currently selected text to my Sticky Note. It works great using the hotkey. Then I wanted the ability to add a "Fallback Search" so whatever I have typed in Alfred will be moved to Sticky Note. The latter isn't working and I'm not sure why.

 

Here's the working HotKey script:

 

 

tell application "Stickies" to activate
tell application "System Events"
    tell process "Stickies"
        tell window 1
            keystroke "{query}"
            keystroke return
            keystroke "-"
            keystroke return
        end tell
    end tell
end tell
 

Can someone provide me with a solution for this to work with a Fallback Search?

 

 

You are currently not able to set a workflow or something similar as a fallback search. I would suggest you simply create a workflow and set a keyword for it and just use the keyword to action it instead.

Link to comment

Ok, I tried that but now it only works for adding single words. I'm guessing this is an applescript problem, but I can't find a work around.

 

I also tried:

 

 

set theNote to "{query}" as text
tell application "Stickies" to activate
tell application "System Events"
    set the clipboard to theNote
    tell process "Stickies"
        tell window 1
            keystroke "v" using command down
            keystroke return
            keystroke "-"
            keystroke return
        end tell
    end tell
end tell
 
Does anyone know off-hand the solution? 
Link to comment

Ok, I tried that but now it only works for adding single words. I'm guessing this is an applescript problem, but I can't find a work around.

 

I also tried:

 

 

set theNote to "{query}" as text
tell application "Stickies" to activate
tell application "System Events"
    set the clipboard to theNote
    tell process "Stickies"
        tell window 1
            keystroke "v" using command down
            keystroke return
            keystroke "-"
            keystroke return
        end tell
    end tell
end tell
 
Does anyone know off-hand the solution? 

 

Could you try this and verify that it works?

set theNote to "{query}" as text
tell application "Stickies" to (activate)
tell application "System Events"
	set the clipboard to theNote
	tell process "Stickies" to tell window 1 to keystroke "v" using command down
	tell process "Stickies" to tell window 1 to key code 36
	tell process "Stickies" to tell window 1 to keystroke "-" 
	tell process "Stickies" to tell window 1 to key code 36
end tell
Link to comment

D'oh! It was an easy fix. The problem came from me not understanding what "Escaping" meant with all options checked. Since "Escaping" was checked for "Space" the query shortened itself. All fixed now. Thanks for your help!

 

Ha cool. I read the first reply and was thinking, "I know I had it working yesterday..".

 

Glad you were able to figure it out :)

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...