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


Click here to return to the '10.4: Create new blank text files via contextual menu' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
10.4: Create new blank text files via contextual menu
Authored by: macintron on Mar 28, '07 11:32:18AM
For me the file is always opens in plain text mode. Perhaps you can do something like this. I can't test it, but you get the idea...

do shell script "touch ~/Desktop/file.txt && open ~/Desktop/file.txt"
tell application "TextEdit" to activate
tell application "System Events"
	tell process "TextEdit" to keystroke "T" using {command down, shift down}
end tell


[ Reply to This | # ]
10.4: Create new blank text files via contextual menu
Authored by: ZacharyArnold on Mar 28, '07 12:25:20PM
Here's an expanded script I wrote to mimic the new text file contextual menu behavior in Windows. Create the contextual menu as described in the original hint, but use the following for the body of the AppleScript:

on run {input, parameters}
	
	try
		tell application "Finder" to set the sourceFolder to (folder of the front window) as alias
	on error
		-- no open folder windows
		set the sourceFolder to path to desktop folder as alias
	end try
	
	set sourceFolderPath to (POSIX path of sourceFolder) as string
	set touchScript to "touch " & sourceFolderPath & "newTextFile.txt"
	set openScript to "open " & sourceFolderPath & "newTextFile.txt"
	
	do shell script touchScript
	do shell script openScript
	
	return input
end run


[ Reply to This | # ]
10.4: Create new blank text files via contextual menu
Authored by: osxpounder on Mar 29, '07 11:50:38AM

What's nice about this hint is that I can make a text file with a right-click now, though usually I'd prefer to use keystrokes, as they are easier on my tired hands. So far I've experimented with Butler, which brings it downo to these keystrokes:

CTRL-space to bring up Butler
tex to choose TextEdit
Return to confirm

If I could have one system-wide keystroke that would:
- take whatever text is selected and put it into a new text document
- if no text is selected, simply open a new, blank text document

... that would be swell.



[ Reply to This | # ]
10.4: Create new blank text files via contextual menu
Authored by: DavidRavenMoon on Mar 28, '07 02:09:43PM

Just set TextEdit to make new documents in plain text! It's amazing how people will write a script before they look in the preference settings of an application!

---
G4/Digital Audio/1GHz, 1 GB, Mac OS X 10.4.9 • www.david-schwab.com • www.myspace/davidschwab • www.imanicoppola.net



[ Reply to This | # ]