getting the Real name of CDs from RR
Ken Ray
kray at sonsothunder.com
Thu Dec 30 13:30:12 EST 2004
On 12/30/04 7:57 AM, "Alejandro Tejada" <capellan2000 at yahoo.com> wrote:
> on Wed, 29 Dec 2004
> Ken Ray wrote:
>
>> You could switch to that drive and get a "dir" under
>> shell(); the first line
>> says "Volume in drive <letter> is <name>", and you
>> can parse it from that.
>>
>> Something like this:
>>
>> on mouseUp
>> answer GetCDName("D:")
>> end mouseUp
>>
>> function GetCDName pLetter
>> set the hideConsoleWindows to true
>> put shell(pLetter & " & dir") into temp
>> return last word of line 1 of temp
>> end GetCDName
>
> Hi Ken,
>
> Thanks a lot for this function!!! :-)
>
> Now i suspect that this machine has
> a damaged installation of Windows 98
> because this code does not produce
> any result...
Sorry, you can't concatenate commands through shell() in Win98 AFAIK; so
you'd need to do this as a batch file:
function GetCDName pLetter
set the hideConsoleWindows to true
if the shellCommand is "cmd" then
put shell(pLetter & " & dir") into temp
if line 1 of temp is empty then delete line 1 of temp
return last word of line 1 of temp
else
-- Win98, etc.
put pLetter & cr & "dir" into url("file:c:/temp.bat")
put shell("c:\temp.bat") into tResult
delete file "c:/temp.bat"
return last word of line 6 of temp
end if
end GetCDName
Try that and let me know if it works,
Ken Ray
Sons of Thunder Software
Web site: http://www.sonsothunder.com/
Email: kray at sonsothunder.com
More information about the use-livecode
mailing list