The code snippet you borrowed doesn't relate to what you're trying to achieve, so you can safely throw that away. Try to avoid looking for solutions that involve simulating clicks or keypresses, as these sorts of scripts are really case-specific, liable to break easily and frequently, and prohibit any additional interaction between the user and the computer whilst it is running. A `.dmg` file (or _disk image_) is an item on the filesystem, which means it can be manipulated using AppleScript. You don't even have to have the `.dmg` window open. It sounds like you already know the name of the file you wish to be opened. Let's say that when you double-click your `.dmg` file to _mount_ (open) it, the name of the disk that appears on your desktop (or in the sidebar of a Finder window) is `"my dmg"` (this may be different from the name of the `.dmg` file itself, but it may be the same). Let's then say that there's a file called `"some file.txt"` contained within the disk image that you wish to open. The path to this file will be located at: ***`/Volumes/my dmg/some file.txt`*** Therefore, your entire AppleScript that will open the file (as if the user had double-clicked on it) will be: ```AppleScript tell application id "com.apple.finder" to open the ¬ POSIX file "/Volumes/my dmg/some file.txt" ``` or alternatively: ```AppleScript tell application id "com.apple.finder" to open ¬ file "some file.txt" of disk "my dmg" ``` Both of these scripts are essentially identical.