Getting mounted disk in Mac OS X.

Hi!

I am working with Mac OS X and I am developing a script that installs a package but my problem is after mounting a disk image. Is there any wy that I can get the newly mounted disk?

I’m sorry, but I’m not sure what you mean by “get” the newly mounted disk. Get it where? What are you trying to do with it? If you can be more specific about the issue, we’ll be more likely to be able to give you a good answer.

I’m sorry to confuse you. What I mean is I want my script to automatically find the newly mounted volume from my Mac OS X.

After mounting a .dmg (disk image) file, I want my script to automatically find the mounted volume or disk.

Actually, I have already a script that answers this topic but I want to ask for the better.

Thanks.

This is what I did:


put "/Volumes/" into global volumes 	
put the folders of global volumes into global volumesFolder 	
repeat with each item of global volumesFolder 		
    if it is equal to "BootCD" then 			
         next repeat 		
   else if it is equal to "Drop Box" then 			
         next repeat 		
    else if it is equal to "Elan" then 			
         next repeat 		
   else if it is equal to "SITES" then 			
         next repeat 		
   else if it is equal to "Storage" then 			
         next repeat 		
   else if it is equal to "Test" then 			
        next repeat 		
   else  			
       put "/Volumes/" & it into global mounted_disk 	
       exit handler 		
   end if 	
 end repeat

Note: BootCD, Elan, Drop Box, SITES, Storage and Test are the volumes of my machine.

Elan:

This code would be a little more efficient:

global volumes
global volumesFolder
put "/Volumes/" into volumes 	
put the folders of volumes into volumesFolder 	
repeat with each item of volumesFolder 		
    if it is not in ("BootCD", "Elan", "Drop Box", "SITES", "Storage", "Test")
       put volumes & it into global mounted_disk 	
       exit handler 		
   end if 	
end repeat
  • Matt

Thanks Matt.