|
|
#1 |
|
ApplescriptEditor; Renaming folders
Hello applescript users!
There is most likely a very simple answer to this, but i cannot find code that allows you to tell applescript to change the name of "FolderA" to "BFolder" (as an example). Here is a sample scenario that i want to use it in: Code:
tell application "Finder" activate if exists folder "Macintosh HD:Users:USERNAME:Library:Application Support:FolderA" then --(*rename "FolderA" to "BFolder"*) else --(*ETC*) end if end tell -- (*TEXTHERE*) is just there to note what i want there. The (*ETC*) is other code that is unnecessary in the scenario. Thanks everyone! CountrySeacow |
|
|
|
0
|
|
|
#2 |
|
Hi, try this:
Code:
tell application "Finder" set x to "Macintosh HD:Users:USERNAME:Library:Application Support:FolderA" if exists folder x then set name of folder x to "BFolder" else --(*ETC*) end if end tell |
|
|
|
0
|
|
|
#3 | |
|
Quote:
I tried using the following code, with "FolderA" present on the desktop Code:
tell application "Finder" set x to "Macintosh HD:Users:USERNAME:Desktop:FolderA" if exists folder x then set name of folder x to "BFolder" else display dialog "it doesnt exist" end if end tell it will either tell my it cant make "Macintosh HD:Users:USERNAME:Desktop:FolderA" into type, or it will say "it doesnt exist" Last edited by CountrySeacow; Dec 9, 2012 at 02:44 PM. |
||
|
|
0
|
|
|
#4 |
|
Try this :
Code:
tell application "Finder" set x to (path to desktop as text) & "FolderA" if exists folder x then set name of folder x to "BFolder" else display dialog "it doesnt exist" end if end tell
__________________
Space Corps Directive 34124 |
|
|
|
0
|
|
|
#5 | |
|
Quote:
Hey, does that "(path to desktop as text) & "FolderA"" apply when ever you are trying to connect to the desktop? I have another thread on that. Here my other thread: http://forums.macrumors.com/showthread.php?t=1503702 Thanks again! |
||
|
|
0
|
|
|
#6 | |
|
Quote:
|
||
|
|
0
|
|
|
#7 | ||
|
Quote:
Quote:
Code:
path to application support from user domain path to application support from local domain
__________________
Space Corps Directive 34124 |
|||
|
|
0
|
|
|
#8 | |
|
Quote:
Code:
set x to folder "Application Support" of folder "Library" of home Do you see anything wrong with that statement, or will it usually work. So far it has worked with me, but im just a novice. |
||
|
|
0
|
|
|
#9 |
|
As you noticed there's usually more than one way to accomplish what you want. Use whatever you think is the easiest for you.
__________________
Space Corps Directive 34124 |
|
|
|
0
|
|
|
#10 |
|
|
0
|
![]() |
|
«
Previous Thread
|
Next Thread
»
| Thread Tools | Search this Thread |
| Display Modes | |
|
|
All times are GMT -5. The time now is 01:25 PM.







Linear Mode
