Re: How to copy to clipboard
Re: How to copy to clipboard
- Subject: Re: How to copy to clipboard
- From: Pier Kuipers <email@hidden>
- Date: Fri, 27 Apr 2001 16:21:41 +0100
You don't actually need to copy anything to the clipboard to achieve
your aim. Simply get the finder to get the name of the startup disk,
the tell the File Sharing control panel to use that name; as follows:
tell application "Finder" to set myName to (name of startup disk as string)
tell application "File Sharing"
set computer name to myName
end tell
Or, the other way around, you could get the Finder to set the name of
the startup disk to whatever the computer name is in the File Sharing
CP. However, you will get an error if File Sharing is turned on, so
you should get the script to turn it off first:
tell application "File Sharing"
set myName to computer name
if file sharing is true then -- avoid error
set file sharing to false
end if
end tell
tell application "Finder" to set name of startup disk to myName
BTW, you'll also get an error if you try to turn off file sharing if
it's already off, hence the "if" statement.
Hope this helps,
Pier.
>
I need to copy the computer name to the clipboard and use following script:
>
>
set MyName to ""
>
tell application "File Sharing"
>
set MyName to computer name
>
quit
>
end tell
>
copy myName to the clipboard
--
Pier Kuipers
Visual ID
* the Media Asset Management solution *
2 Whitefriars
Aungier Street
Dublin 2
Tel. +353 1 476 7059
Mobile +353 87 294 3063
Fax +353 1 478 1366
ISDN +353 1 602 0754
http://www.visualid.com