Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Create a new Sticky widget from entered text Desktop
The following AppleScript asks you for some text, copies it to the clipboard, then creates a new Sticky widget and pastes the text you entered. Here's the code: The two delay lines may need adjustment for different systems; experiment to find what works for you. Once you have the script working, use something like Fastscripts, QuickSilver, Proxi, QuicKeys, etc. to assign it a keyboard shortcut for fast activation. This should work in either Tiger or Leopard.

[robg adds: This worked for me as described on my Mac Pro (no editing of the delays was required).]
    •    
  • Currently 2.33 / 5
  You rated: 4 / 5 (9 votes cast)
 
[11,657 views]  

Create a new Sticky widget from entered text | 11 comments | Create New Account
Click here to return to the 'Create a new Sticky widget from entered text' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Create a new Sticky widget from entered text
Authored by: mariofreak85 on May 29, '09 10:00:13AM

If I need to make a sticky on the fly I usually type some text somewhere and hit cmd + shift + y

But this is helpful if there's nowhere to type some text.



[ Reply to This | # ]
Create a new Sticky widget from entered text
Authored by: Sesquipedalian on May 29, '09 11:28:24AM

⇧⌘Y is used to create a sticky note in Stickies.app. This hint works with Dashboard's Stickies widget, which has noting to do with Stickies.app (unfortunately).



[ Reply to This | # ]
Create a new Sticky widget from entered text
Authored by: osxpounder on May 29, '09 02:44:44PM

I , too, use the CMD-SHIFT-y shortcut, and the Stickies app, because I find it suits my needs better. I'm grateful for the Stickies app and for that keyboard shortcut. Very useful; thanks Apple!

My Stickies app loads at login, so it more closely approaches what I view as the most important function of Stickies: they are there on my screen when I start my work day.

I also occasionally save a Stickies note, or print it. For me, the Stickies widget is no substitute.

But I'm still glad you share this hint with us!



[ Reply to This | # ]
Create a new Sticky widget from entered text
Authored by: piyayo on May 29, '09 10:31:16AM

Works over here. Very nice thanks.



[ Reply to This | # ]
Create a new Sticky widget from entered text
Authored by: morespace54 on May 29, '09 11:03:37AM
Alternatively, if you want to make a sticky from previously copied text, you could simply remove (or comment) the first part:

set the clipboard to text returned of (display dialog "Enter some text for your new Sticky widget..." default answer "Note: ")
This way, you copy some text, invoke the script and your good. Thanks for sharing!

[ Reply to This | # ]
Create a new Sticky widget from entered text
Authored by: morespace54 on May 29, '09 11:05:56AM
...or to be "sticky-safe", you could change it to something like:

set the clipboard to Unicode text of (the clipboard as record)


[ Reply to This | # ]
Create a new Sticky widget from entered text
Authored by: barefootguru on May 29, '09 01:19:16PM

Note that since 10.5 all AppleScript string handling is in Unicode and 'string' and 'Unicode text' are both synonyms for 'text'.



[ Reply to This | # ]
Create a new Sticky widget from entered text
Authored by: Sesquipedalian on May 29, '09 12:15:21PM
Replacing
set stickywidget to ((path to startup disk) as Unicode text) & "Library:Widgets:Stickies.wdgt"
tell application "Finder" to open stickywidget
with
do shell script "open /Library/Widgets/Stickies.wdgt"
will execute faster, and allow you to reduce the one second delay to something short like 0.2 seconds, and (at least on my machine) eliminate the two later delays.

Also, if you want to make sticky widgets without affecting the contents of the clipboard, use this version instead:

set inputText to text returned of (display dialog "Enter some text for your new Sticky widget..." default answer "Note: ")

do shell script "open /Library/Widgets/Stickies.wdgt"
delay 0.2
tell application "System Events"
   keystroke tab
   --delay 0.2 --add this back in if you need it
   keystroke tab
   --delay 0.2 --add this back in if you need it
   keystroke inputText
end tell

For Quicksilver users here is a version that works directly with text entered into Quicksilver's first pane (thus eliminating the need for a dialog box):

using terms from application "Quicksilver"
	on process text inputText
		do shell script "open /Library/Widgets/Stickies.wdgt"
		delay 0.2
		tell application "System Events"
			keystroke tab
			--delay 0.2
			keystroke tab
			--delay 1
			keystroke inputText
		end tell
	end process text
end using terms from

Finally, for people who think in the opposite order (open a Sticky, then type the text), but are tired of how much work it takes to create a new sticky note in Dashboard, I suggest trying New Sticky. (Yeah, I made it, but its freeware, so I feel no shame in plugging for it!)

[ Reply to This | # ]

Create a new Sticky widget from entered text
Authored by: llee on May 29, '09 12:52:15PM
If you use QuicKeys to trigger the script, add "activate" as a new line at the beginning of the script to avoid a possible scope clash.

If you don't mind an extra step, you can wrap the set clipboard line in this "if" statement to provide the choice of typing or using the clipboard. Don't put too much text on the clipboard, of course.

if button returned of (display dialog "Type new sticky or use current clipboard contents?" buttons {"Type", "Use clipboard", "Cancel"} default button 1) is "Type" then
set the clipboard to text returned of (display dialog "Enter some text for your new Sticky widget..." default answer "Note: ")
end if


[ Reply to This | # ]
Create a new Sticky widget from the Dock
Authored by: u2mr2os2 on May 31, '09 08:04:35AM

I just tried something: Navigate to /Library/Widgets. Drag the Stickies widget to the right side of the Dock. Click it for a new Dashboard Sticky! Looks like you can press tab twice to get the focus to it to start typing or paste. You probably want to move the note away from the default place at the center to not be under the next new sticky.



[ Reply to This | # ]
well, since we're having fun with Stickies...
Authored by: tedw on May 31, '09 06:42:17PM
following up on u2mr2os2's post, if you're willing to do a little editing you can make this work. do the following:
  1. copy the Stickies widget from /Library/Widgets to ~/Library/Widgets, and rename the copy StickiesPlus
  2. go to Dashboard, and use the Manage Widgets tool to disable the original Stickies widget (unchecking it is sufficient)
  3. right- or control-click on the new StickiesPlus widget and select Show Package Contents from the contextual menu
  4. open the Info.plist file in a plain-text editor (or in Property List Editor if you have Dev Tools installed) and make the following edits:
    • change the Bundle Identifier, Bundle Name, and Bundle Display Name keys (CFBundleIdentifier, CFBundleName, CFBundleDisplayName) to say StickiesPlus rather than Stickies
    • add a boolean key called AllowSystem and set it to true
  5. back in the package contents folder, open the file Stickies.js, and add the code below in the javascript function loadPreferences() right after the line of code that says var data = preferenceForKey(kDataKey);.
add this code snippet:
 	 if (data=="") {
		var data = widget.system("/usr/bin/pbpaste -Prefer rtf", null).outputString
	}
	...
it will look like this, when you're done:
function loadPreferences() {
	var data = preferenceForKey(kDataKey);
	if (data=="") {
		var data = widget.system("/usr/bin/pbpaste -Prefer rtf", null).outputString
	}
	mydiv.innerHTML = data;
	... 
Make sure the changes you make in the files are saved, and (may or may not be necessary, but can't hurt) kill the dock and let it restart. now every time you double-click on the StickiesPlus icon it will make a new sticky in dashboard with the contents of the clipboard. you could even make an applescript like so:
tell application "System Events"
	set frontProc to item 1 of (every process whose visible is true and frontmost is true)
	tell frontProc
		keystroke "c" using command down
	end tell
end tell

set widgetPath to (path to library folder from user domain as text) & "Widgets:StickiesPlus.wdgt"
tell application "Finder"
	open widgetPath
end tell
You can run that script from the script menu (or quicksilver, or etc) to automatically copy the selection in the foreground app and load it into a dashboard sticky. I think it will only work for text - possible limitation of pbpaste - but I haven't really tested it much.

[ Reply to This | # ]