Hi

At 11:28 AM +0000 1/3/01, Dave Cragg wrote:
>However, I'm now encouraged to experiment a little further with the
>"sysodsct" approach, and see how this might be exploited.

This is a bit like a new toy.

Using the method outlined in my previous mail, here's a way to get 
various information about a file on MacOS:

First, create field named "Script" and paste in the following 
AppleScript. (Watch out for unwanted line breaks in the e-mail. All 
lines begin with "set", "if", "else" or "end if" in the doInfo 
handler)

doInfo("xxxxx")

on doInfo(theFile)
   set theFileInfo to info for alias theFile
   set theText to "File name:" & tab & the name of theFileInfo & return
   set theText to theText & "Size:" & tab & the size of theFileInfo & return
   set theText to theText & "Creator:" & tab & the file creator of 
theFileInfo & return
   set theText to theText & "Type:" & tab & the file type of 
theFileInfo & return
   if the file type of theFileInfo is "APPL" then
     set theText to theText & "Version:" & tab & the short version of 
theFileInfo & return
   else
     set theText to theText & "Default App:" & tab & (the default 
application of theFileInfo as text) & return
   end if
   set theText to theText & "Created:" & tab & the creation date of 
theFileInfo & return
   set theText to theText & "Modified:" & tab & modification date of 
theFileInfo & return
   set theText to theText & "Locked:" & tab & (the locked of 
theFileInfo as string) & return
   set theText to theText & "Visible:" & tab & the visible of 
theFileInfo & return
end doInfo

Then create a button with the following two handlers:

on mouseUp
   answer file ""
   if it is not empty then
     put it into tFile
     replace "/" with ":" in tFile
     if char 1 of tFile is ":" then delete char 1 of tFile
     get field "script"
     if it is not empty then
       put it into tScript
       replace "xxxxx" with tFile in tScript
       runScript tScript
     end if
   end if
end mouseUp

on runScript pScript
   replace cr with NumToChar(13) in pScript
   send pScript to program "Finder" with "sysodsct"
   put the result into tOut
   replace NumToChar(13) with cr in tOut
   put tOut
end runScript

Click the button, select any file, and you should get a list of 
information about the file in the message box.

Cheers
Dave Cragg



Archives: http://www.mail-archive.com/metacard@lists.runrev.com/
Info: http://www.xworlds.com/metacard/mailinglist.htm
Please send bug reports to <[EMAIL PROTECTED]>, not this list.

Reply via email to