Renaming files

I have two files one called “realmlist.wtf” and the other “funrealmlist.wtf” I want to make an applescript that has 2 buttons, one for fun and the other normal. If you click normal it does nothing and opens WoW, but if you choose fun, it changes the name of “funrealmlist” to “realmlist” and the other one to “funrealmlist” then on the next choice, it changes back. Is this possible?

Hi,

something like this


property fun : "funrealmlist.wtf"
property standard : "realmist.wtf"
property temp : "temp.wtf"

set baseFolder to path to desktop as text

set b to button returned of (display dialog "" buttons {"Normal", "Fun"})
if b is "Normal" then
	activate application "World of Warcraft" 
else
	tell application "Finder"
		set name of file (baseFolder & fun) to temp
		set name of file (baseFolder & standard) to fun
		set name of file (baseFolder & temp) to standard
	end tell
end if

It gives me a syntax error :o Expected variable name, class name or property but found application constant or consideration.
Thanks for your help

you probably have a scripting addition installed which causes the terminology clash
this should do it


property _fun : "funrealmlist.wtf"
property _standard : "realmist.wtf"
property _temp : "temp.wtf"

set baseFolder to path to desktop as text

set b to button returned of (display dialog "" buttons {"Normal", "Fun"})
if b is "Normal" then
	activate application "World of Warcraft"
else
	tell application "Finder"
		set name of file (baseFolder & _fun) to _temp
		set name of file (baseFolder & _standard) to _fun
		set name of file (baseFolder & _temp) to _standard
	end tell
end if

Thanks heaps!. One problem though, the files are in the JSYSTEM-Applications-World of Warcraft folder, how can I change it from the desktop to that?


.
set baseFolder to (path to applications folder as text) & "World of Warcraft:"
.

Thanks, but when I choose fun I get this error

If JSYSYTEM is not the startup disk, you must specify the whole path


.
set baseFolder to "JSYSYTEM:Applications:World of Warcraft:"
.

path to applications folder points to the application folder of the startup disk

It is renaming funrealmlist to temp.wtf when I choose fun?

Got it going. Thanks for the help!


property _fun : "funrealmlist.wtf"
property _standard : "realmlist.wtf"
property _temp : "temp.wtf"

set baseFolder to "JSYSYTEM:Applications:World of Warcraft:"
set b to button returned of (display dialog "Choose a realm" buttons {"WoWscape", "Insta 70"})
if b is "Normal" then
	activate application "World of Warcraft"
else
	tell application "Finder"
		set name of file (baseFolder & _fun) to _temp
		set name of file (baseFolder & _standard) to _fun
		set name of file (baseFolder & _temp) to _standard
	end tell
end if