Register FAQ / Rules Forum Spy Search Today's Posts Mark Forums Read
Go Back   MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Reply
 
Thread Tools Search this Thread Display Modes
Old Aug 30, 2007, 11:06 AM   #1
brianus
macrumors 6502
 
Join Date: Jun 2005
"on adding folder items" Folder Action interrupts editing of new folder names

Hi, is there a way to select a filename for editing in the Finder using AppleScript? I have a Folder Action which checks for proper filenames (according to company criteria) in a particular folder. It's fine for dragging items into the folder, but if you create a new folder in there and start to edit the name, the Folder Action causes it to interrupt your editing. I've already changed the script so that it takes no action when the filename starts with "untitled folder", but it STILL causes the edit box to go away regardless. So I'm figuring the only way to deal with this is to somehow make the Finder re-select the filename for editing at the end of the script, but I haven't found a way to do this. The "select" action only highlights the file, it doesn't open the edit box.
__________________
iPhone 4S 64㎇ 6.1.3 | iPad 4th Gen 128㎇ 6.1.3 | MacBook Pro 13" Retina i7 2.9㎓/8㎇/768㎇ 10.8.4 |
Mac mini C2D 2.66㎓/4㎇/120㎇ SSD 10.8.2 | TV 160㎇ 3.0.2 | Thunderbolt Display | Airport Ex.
brianus is offline   0 Reply With Quote
Old Aug 30, 2007, 12:47 PM   #2
MongoTheGeek
macrumors 68040
 
MongoTheGeek's Avatar
 
Join Date: Sep 2003
Location: Its not so much where you are as when you are.
Send a message via MSN to MongoTheGeek Send a message via Yahoo to MongoTheGeek
Quote:
Originally Posted by brianus View Post
Hi, is there a way to select a filename for editing in the Finder using AppleScript? I have a Folder Action which checks for proper filenames (according to company criteria) in a particular folder. It's fine for dragging items into the folder, but if you create a new folder in there and start to edit the name, the Folder Action causes it to interrupt your editing. I've already changed the script so that it takes no action when the filename starts with "untitled folder", but it STILL causes the edit box to go away regardless. So I'm figuring the only way to deal with this is to somehow make the Finder re-select the filename for editing at the end of the script, but I haven't found a way to do this. The "select" action only highlights the file, it doesn't open the edit box.
You could try having system events type a return.

Perhaps the best thing is to throw up a dialog asking what you want the folder named.

Code:
tell application "Finder"
	set aname to name of folder blahblahblah --substitute whatever var you are getting in
	if aname = "untitled folder" then
		set aname to text returned of (display dialog "What do you want this folder named?" default answer "untitled folder")
		set name of folder blahblahblah to aname
	end if
end tell
checkname(blahblahblah)
__________________
The future ain't what it used to be.
MongoTheGeek is offline   0 Reply With Quote
Old Aug 30, 2007, 03:37 PM   #3
brianus
Thread Starter
macrumors 6502
 
Join Date: Jun 2005
Quote:
Originally Posted by MongoTheGeek View Post
You could try having system events type a return.

Perhaps the best thing is to throw up a dialog asking what you want the folder named.
[/CODE]
I might wind up doing that if there's no other way, though I'd like to avoid interrupting the normal workflow as much as possible (lots of people use this folder). I'm new to AppleScript so I'm not quite clear on how SystemEvents works.. I tried:

Code:
tell application "System Events" to key code 10
to enter a return but nothing happened.

I wonder if there's some way to get the folder action to run without removing focus from the Finder window. It's odd that it would even have to do that, since there's no other window involved.
__________________
iPhone 4S 64㎇ 6.1.3 | iPad 4th Gen 128㎇ 6.1.3 | MacBook Pro 13" Retina i7 2.9㎓/8㎇/768㎇ 10.8.4 |
Mac mini C2D 2.66㎓/4㎇/120㎇ SSD 10.8.2 | TV 160㎇ 3.0.2 | Thunderbolt Display | Airport Ex.
brianus is offline   0 Reply With Quote

Reply
MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Similar Threads
thread Thread Starter Forum Replies Last Post
Lag with Applications folder (Dock) "view as list" in 15" Retina Macbook Pro Cardsnk MacBook Pro 2 Jun 11, 2014 11:52 PM
Change "show item info" in Finder icon view to show size of folder instead of items? drought OS X Mavericks (10.9) 2 Jan 17, 2014 11:52 PM
Triggering folder action on dropbox folder? ronswanson Mac Programming 3 Aug 7, 2013 03:39 PM
Accidentally tried to copy a folder to a sub-folder within it.. Original folder Gone samth3mancgp OS X 10.8 Mountain Lion 3 Feb 9, 2013 07:04 PM
Redirecting home folder to win 2003 user network folder bardicverse Mac OS X 10.7 Lion 1 Jun 13, 2012 01:21 PM

Forum Jump

All times are GMT -5. The time now is 06:15 AM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2013, MacRumors.com, LLC