Re: Eject in Leopard
Re: Eject in Leopard
- Subject: Re: Eject in Leopard
- From: Takaaki Naganoya <email@hidden>
- Date: Mon, 12 Nov 2007 10:16:03 +0900
It works for me, too.
I have a test with an DVD-Video disk, USB memory and external hard
drive.
You'd better to try hexdump with the name of "NIKON D2X" and the
direct string parameter in AS.
<AppleScript>
--Mount "NIKON D2X" and run this script
--Choose "NIKON D2X"
tell application "Finder"
set aDiskList to name of every disk whose ejectable is true
set aDisk to choose from list aDiskList
set aText to (contents of aDisk)
end tell
set aText to aText as Unicode text
dumpStr(aText) of me --the string from Disk
set aText to "NIKON D2X"
dumpStr(aText) of me --the string write in AppleScript
on dumpStr(aText)
set aList to characters of aText
set dtPath to path to desktop as string
set outPath to dtPath & ".temp.txt"
set inPath to POSIX path of outPath
repeat with i in aList
set j to contents of i
write_to_file(j, outPath, false)
set hexT to do shell script "hexdump " & quoted form of inPath
--set hexT to do shell script "hexdump " & quoted form of inPath &
" | cut -b 9-"
display dialog "<< " & j & " >>" & return & hexT
end repeat
end dumpStr
on NumToHex(hexData, stringLength)
set hexString to {}
repeat with i from stringLength to 1 by -1
set hexString to ((hexData mod 16) as string) & hexString
set hexData to hexData div 16
end repeat
return (hexString as string)
end NumToHex
on write_to_file(this_data, target_file, append_data)
try
set the target_file to the target_file as text
set the open_target_file to open for access file target_file with
write permission
if append_data is false then set eof of the open_target_file to 0
write this_data to the open_target_file starting at eof
close access the open_target_file
return true
on error error_message
try
close access file target_file
end try
return error_message
end try
end write_to_file
</AppleScript>
On 2007/11/12, at 0:33, Claus Gerhardt wrote:
It works for me with an external hard drive. Maybe the spaces in
your name are a problem, try quoted form of "....".
Claus
On Nov 11, 2007, at 14:56, Jay Louvion wrote:
On 11.11.2007 10:00, "Takaaki Naganoya" <email@hidden> spake thus:
I think it should be .....
<AppleScript>
tell application "Finder"
eject disk "NIKON D2X"
end tell
</AppleScript>
Maybe, but even that does nothing. Not even an error out.
Does this command work for you in Leopard ?
Best,
j.
Jay Louvion
Studio Casagrande
3, rue Müller-Brun
1208 Geneva
T+4122 840 3272
F+4122 840 3271
www.studiocasagrande.com
P Please consider the environment before printing this email.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (applescript-
email@hidden)
Help/Unsubscribe/Update your Subscription:
40math.uni-heidelberg.de
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden
--
Takaaki Naganoya
Piyomaru Software
http://piyo.piyocast.com
email@hidden
PiyoCast Web (Podcasting with Music!)
http://www.piyocast.com
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden