Page 1 of 1

Applescript: set display name: doesn't work

Posted: Sat May 07, 2005 11:54 am
by twopeak
Hello

Some time ago I made an Applescript that changes the name of every account.
it didn't work and I had been told it would probably work in .8

Still, it doesn't work. Is there any news on this? Is it supposed to work?

I tried with the different variants of the display name (like long display name, UID (probably not supposed)
Since every account class has the list object property, I assume I can do what I'm trying to do...
If it's not doable, will this be on the todo list or not?

Code: Select all

on substitute(var)
	tell application "Adium"
		if isset(var) then
			set newname to var
		else
			set ldn to display name of item 1 in accounts -- take name of first account
			display dialog "Give a new name" & var default answer ldn & return buttons {"Cancel", "Change Name"}
			set newname to {text returned of result} -- remember answers
		end if
		
		set display name of every item in accounts to newname -- remember new name
	end tell
end substitute

Posted: Tue May 10, 2005 8:45 pm
by sydoveton
Hi,

I have been able to achieve a certain result, it's not perfect but I hope it is a suitable alternative. Let me know what you think:-

Code: Select all

tell application "Adium"
	set myName to "Sy"
	set appendName to the text returned of (display dialog "Enter Text to Append to " & myName & ":" default answer "This is my witty Message")
	set newDisplayName to myName & " - " & appendName
	set noAcc to count of accounts
	
	repeat with noAcc from 1 to noAcc
		set display name of item noAcc in accounts to newDisplayName
	end repeat
	
	display dialog "Your display name has been changed to
" & newDisplayName
end tell
I'm sure you can adjust this to suit your needs, I have it sitting in my script menu so I can change it system wide. Obviously you need to change the variable myName. This will work for as many accounts as you have as it checks how many you have.

Hope it helps,
Sy

Posted: Wed May 11, 2005 8:16 pm
by twopeak
strangely this doesn't work for me.
I change it to reflect your script, and still, nothing happens

I have been trying several variants of the code...
This gives me headaches...

This works

Code: Select all

on substitute()
	tell application "Adium"
		set display name of item 1 in accounts to "test"
	end tell
end substitute
but then this won't:

Code: Select all

on substitute(var)
	tell application "Adium"
		set ldn to display name of item 1 in accounts -- take name of first account
		display dialog "newname: " & var & "oldname: " & ldn
		set display name of item 1 in accounts to var
		display dialog "name changed succesfully"
	end tell
end substitute
I will need to do some more testing on this, but like alot of students, it's exam-time.

I plan to have this finished by the end of my exams...