Zooming a Finder Window (Clicking Button)

I am trying to zoom a window in the Finder but I can't make this script work. Basically I have a folder that I open up and I want to resize the window to fit the contents (just like hitting the Green button on a window in the Finder).
I get an error saying: "System Events got an error: NSReceiverEvaluationScriptError: 4".
Here is my script so far:
+tell application "System Events"+
+tell process "Finder"+
+tell window 1+
+click button 2+
+end tell+
+end tell+
+end tell+
Can anyone see just what I am missing?
Am I going about this the wrong way? Been spending hours Googling for an answer to something that seems so simple.

Windows are numbered in the order that they are layered, with number 1 being the frontmost, 2 being the next one back, etc. When you click on an item in column view, you get a new column, not a new window. I am guessing that you have the Finder preference set to open folders in a new window, in which case double-clicking on a folder will open it in a new window. In that case the new (front) window will be number 1, and the previous front window will be number 2, although both will have the same name, which may be where the confusion is coming from. The name of a Finder window (whatever the number) is the currently selected folder, or in the case of files or multiple selections, the containing folder, so there can be several windows with the same name if they are targeted at the same folder.

Similar Messages

  • Hide/Show Finder Window "Bars" Button?

    Snow leopard had a really useful feature associated with Finder windows that allowed all of the various bars (Tool, Side, Path, Status) to be activated/deactivated at one time. Lion took this away (but allowed those features to be active/inactve independently, which while useful does require more work.
    What I would like to be able to do is somehow add that brilliant one-click option back. I think I can do this with Applescript or Automator, but am not sure if it is possible to add the script to the Actions menu (or better yet a button on the title bar, wishfully thought).
    Anybody have a solution?
    Thanks.

    Regards,
    Colin R.

  • Finder Window Won't Pop Up / Restore

    Mavericks latest
    Macbook Pro Retina
    The sequence of events is this:
    Use the Finder
    Minimise the Finder window, clicking on the Orange blob
    Click on the Finder in the dock to bring back the window - doesn't appear
    Click on the Finder window menu, see screen shot
    If I click on the window with the diamond (called "aImages" above) the window will appear
    If I click on the WIndow with the check mark/tick, the window will not appear
    I also get this with Safari too.
    Things I tried:
    Keep up to date with Mavericks
    Clean Mavericks install - I wiped my Machine and restored just the apps I used and dumped all the accumulated junk
    I'm quite fed up with this - been happening since the first install of Mavericks.

    Hi,
    Did you try a simple reboot of your Mac?
    Sometimes this will help ...
    Dimaxum

  • Zoom level when opening a pdf in Preview from a Finder "find" window

    I do a Finder search, and the search window shows a bunch of pdf files. If I double click on one, it opens in Preview with the Finder search term highlighted in the pdf text-very nice. But the zoom level of the pdf is very high, like 300%. So I always need to zoom back out to 100% to see the context of the found term. Is there a way to change this default behavior?
    Another point is that once I open one of the pdf's, it vanishes from the Finder window. Although this might make sense in some ways, because, after all, I've already had a look at the file, it's often not the behavior I want. In particular, it's hard to know what the next pdf is that I was going to open, when the one I just looked at is no longer in the list. I should also point out that not all pdf's vanish in this way, but most do. I can't see any pattern.

    Hi,
    You mentioned that "JavaScript in the PDF can hide toolbar buttons."
    According to the Javascript docs for Acrobat 7 the App.HideToolbarButton function only runs at AppInit.  Which means that I would have to have the javascript in a file.  How can I do that from within the document?  Is there another way to to do set this from our web application?
    Rob

  • After installing Mavericks I can no longer save a new word document or pdf by typing the name of the destination folder in the Finder window.  The save button greys out.  Solutions anyone?

    After installing Mavericks I can no longer save a new word document or pdf by typing the name of the destination folder in the Finder window.  The save button greys out.  Solutions anyone?

    Please follow these directions to delete the Mail "sandbox" folders. In OS X 10.9 there are two sandboxes, while in 10.8 there is only one. If you're running a version older than 10.8, this comment isn't applicable.
    Back up all data.
    Triple-click anywhere in the line below on this page to select it:
    ~/Library/Containers/com.apple.mail
    Right-click or control-click the highlighted line and select
              Services ▹ Reveal
    from the contextual menu.* A Finder window should open with a folder named "com.apple.mail" selected. If it does, move the selected folder—not just its contents—to the Desktop. Leave the Finder window open for now.
    Log out and log back in. Launch Mail and test. If the problem is resolved, you may have to recreate some of your Mail settings. You can then delete the folder you moved and close the Finder window.
    This action will delete any custom Mail stationery that you have created. If you want to preserve it, ask for instructions.
    If you still have the problem, quit Mail again and put the folder back where it was, overwriting the one that may have been created in its place. Repeat with this line:
    ~/Library/Containers/com.apple.MailServiceAgent
    Caution: If you change any of the contents of the sandbox, but leave the folder itself in place, Mail may crash or not launch at all. Deleting the whole sandbox will cause it to be rebuilt automatically.
    *If you don't see the contextual menu item, copy the selected text to the Clipboard by pressing the key combination  command-C. In the Finder, select
              Go ▹ Go to Folder...
    from the menu bar and paste into the box that opens by pressing command-V. You won't see what you pasted because a line break is included. Press return.

  • Open a finder window with NSMenuItem button

    Hi there fellow Developers,
    In my application I'm trying to open a finder window from inside my app through a NSMenuItem button. The finder window cannot be blank or the standard one that is opened once you click on the finder icon. It must be the one I chose to open. I looked around for examples or at least some sample code, but I couldn't find any. How can I carry out this process?
    Thanks,
            Tom M.

    Hi Shai,
    Following are the details
    VC Server Version 700.15.0.1.
    We are using version 7.0.
    Regards
    Joga

  • How can I change to location of pictures folder? I want to use a backup hardrive to store my photos and music on but still want to be able to go to the finder and click the photos/music button. How can I do this.

    I want to use a backup hardrive to store my photos and music on but still want to be able to go to the finder and click the photos/music button. In windows i would just change the properties of the given library folder. How can I do this in Lion?

    Move "~/Pictures", or if just iPhoto pictures, "~/Pictures/iPhoto Library", to the new location.
    If you moved iPhoto, open iPhoto with the option key held, like Tony T1 writes. Select "Other Library" and navigate to the new location.
    To add the new location to the sidebar in Finder, just drag it onto the sidebar.
    Same process for iTunes, or whole music folder.

  • When i click on 'Show all in Finder' after searching for anything on spotlight, NOTHING happens! No Finder window opens up and the spotlight dropdown menu just shuts! Please help!

    When i click on 'Show all in Finder' after searching for anything on spotlight, NOTHING happens! NO Finder window opens up and the spotlight dropdown menu just shuts! Please help!

    I'm having the same problem in other places as well, for example when i downloaded Easyfind right now, clicking the small magnifying glass button on the right of the file name (shown below) would usually open up finder highlighting the file, but now nothing happens when i click on that button!
    Is there a solution for this, as this was a very useful feature which i used ALL the time?

  • Unix command to click button on dialog box and close windows?

    I administer an elementary school computer lab of 35 eMacs all with OS 10.4.7 and with ARD 3.0. Our network server configuration requires a mounted server on each desktop in order to administer certain software packages we use. Every morning at start-up I have to walk around and manually click "Connect" on the dialog boxes. Then, with this configuration, each time a server is mounted, it opens up a Finder Window on the host machine so I've got to walk around and close windows on all the machines. I'm sure there must be an AppleScript or Unix command that I can set up to do these two tasks but I've not found it (or learned how to write it) in a few days of searching. Any suggestions?
    Thanks,
    Dan

    OK guys,
    I just succeeded in saving the AppleScript command as an application. I put it in the Login Items just after the servers. It worked beautifully! No more open windows exposing sensitive files to the risks of elementary students (how come the mounted volumes always appear on the desktop even when the "hide" button is checked?). It would be great if the mounted volumes were not showing at least in a setting like a school computer lab.
    Now, I'm still dealing with the mounting process requiring me to manually click on "Connect" every time. The Student account doesn't even have a password just to make such things easier. Still the process displays this:
    (Oh well, I guess I can't insert a ScreenShot.)
    Here's what it says: Connect to the file server "server name."
    Connect as: Registered User
    Name: "account name"
    √Remember password in keychain
    (and then two buttons) Cancel or Connect
    That's where I'm at right now. My district Tech. Support folks say that there's no way to avoid the dialog box but John seems to do it OK. They also pointed me to an online source (www.bombich.com) that I haven't yet checked out.
    Thanks again,
    Dan

  • Why doesn't clicking on a Finder window always bring it to the front

    Right now on my screen I have two Finder windows. One is partially covered by the other.
    Clicking on the rear window does not bring it to the front. I've seen this happen many times already.
    Why wouldn't it come to the front and cover the current front window?
    Thanks,
    doug

    Start Firefox in <u>[[Safe Mode|Safe Mode]]</u> to check if one of the extensions (Firefox/Tools > Add-ons > Extensions) or if hardware acceleration is causing the problem (switch to the DEFAULT theme: Firefox/Tools > Add-ons > Appearance).
    *Do NOT click the Reset button on the Safe Mode start window.
    *https://support.mozilla.org/kb/Safe+Mode
    *https://support.mozilla.org/kb/Troubleshooting+extensions+and+themes

  • I want to upload from my iphone playlist to my laptop (Windows 8) why is it so hard to find the right buttons to press????

    i want to upload from my iphone playlist to my laptop (Windows 8) why is it so hard to find the right buttons to press????

    Review these Knowledge Base articles... they may help you:
    Synchronizing media using BlackBerry Desktop Software on a Mac computer
    BlackBerry Desktop Software Mac does not display evens and albums from iPhoto 9.4.2
    1. If any post helps you please click the below the post(s) that helped you.
    2. Please resolve your thread by marking the post "Solution?" which solved it for you!
    3. Install free BlackBerry Protect today for backups of contacts and data.
    4. Guide to Unlocking your BlackBerry & Unlock Codes
    Join our BBM Channels (Beta)
    BlackBerry Support Forums Channel
    PIN: C0001B7B4   Display/Scan Bar Code
    Knowledge Base Updates
    PIN: C0005A9AA   Display/Scan Bar Code

  • Mail "New Message" window retreats to background after drag and drop attachment from Finder to Mail "New Message", click, and Finder window stays in foreground even when not in focus

    Hi, I'm surprised I can't quickly find if anyone else is having this issue. For me it has been going on since Lion on my 13" MacBook Pro 2011 and it's still persisting in Mavericks, and even still now that I've "downgraded" to a 15" MacBook Pro 2010 with Mavericks.  The behavior is odd and difficult to explain concisely. Basically, when I want to add an attachment to Mail, I'll Cmd+Tab over to Finder click and drag and Cmd+Tab back to Mail, and drop the attachment. At first it looks fine, but when I click in the New Message window where I just dropped the attachment, to move the cursor, it retreats to the background and the Mail Main Window comes to the foreground. Then, if I click on that, the Finder window that I just used comes to the foreground. Sometimes if I switched to another app before going to Finder to select the drag and drop, that other app window will appear in the foreground instead. If I click on the other app window that is now in the foreground, then the Finder window that was last used will come to the foreground. The only thing that seems to fix this switch-a-roo effect is Cmd+Tab-ing back and forth a few times, or click on the window "frame" at the top to move the window around.
    The way to prevent this is to have my Mail Message window visible in the foreground side by side with the Finder window when the drag and drop occurs (this is a tedious extra step if mulitple windows are open, or to use the add attachment command in the menu within Mail. But it sure is annoying buggy behavior.
    Thanks
    Daniel

    Yep, I get exactly the same thing when using Thunderbird mail client on my 2011 iMac running Lion. I've been putting up with it for at least a year, maybe longer.
    For me it appeared to start after a Thunderbird update, so I figured that was the cause and couldn't find a solution at the time. However I've now noticed it starting to happen in Apple Motion 4 when dragging files from Finder into a DropZone in my animations. Motion remains the active program but the Finder window sits on top until I Cmd-tab out to a third open program (ie not Finder) and back to Motion again.
    This is the first indicator I've had that it's an OS X issue.
    Be great to find a solution as D&D is by far my preferred way of adding attachments to emails and similar tasks.

  • How do you close a finder window on an iMac running Mountain Lion by double clicking on the top of the window like I can on my Macbook Air?

    When I bought my Macbook Air in 2011, ( leopard on purchase - now mountain lion) I discovered how to close open Finder windows by double clicking at the top of the window. I have just bought an iMac (mountain lion) and for the life of me cant find out how to do the same. Finder preferences are no help. Can anyone out there be of some?
    Thanks in advance

    I know what you are referring to. In both cases, the window is minimized, but on your MacBook Air, your Finder window is minimized onto the Finder icon, and on the iMac, on the right side of the Dock.
    To change this on your iMac, open System Preferences > Dock, and mark "Minimize windows into application icon"

  • In the finder window, column view, I double click on icon, eg. a spread sheet,  and document will not open since I updated to OSXv10.8.2. Help anyone?

    In the finder window, column view, I double click on icon, eg. a spread sheet,  and document will not open since I updated to OSXv10.8.2. Help anyone?

    Hi Ron,
    Highlight one in the Finder & do as Get Info on it, what does open With say to use?
    What did you update 10.8.2 from exactly? 10.6.8 maybe?

  • The wheel click button does not open a new window since the latest update (9.0.1)

    Hi
    I just want to report this bug in hope it will be fixed asap
    The wheel click button does not open a new window since the latest update (9.0.1)
    Thank you

    Middle-click or click the scroll-wheel on a hyperlink has always opened a '''new Tab'''. Any chance you had an add-on that changed that action, and now that add-on is disabled or incompatible?

Maybe you are looking for