1

I've been trying to hide the toolbar from a Fluid app application using applescript, but it doesn't seems to be working at all. I've also tried on Safari (fluid apps are built on top of safari web engine). I'm able to "click" on every menu item, but not on that one. The script seems to be finding the menu item there, as I tried to run another piece of code inside that conditional in specific.

So this is what i've been doing:

tell application "System Events"
    tell process "Test App"
        if menu item "Hide Status Bar" of menu "View" of menu bar 1 exists then
            click menu item "Hide Status Bar" of menu "View" of menu bar 1
        end if
        if menu item "Hide Bookmark Bar" of menu "View" of menu bar 1 exists then
            click menu item "Hide Bookmark Bar" of menu "View" of menu bar 1
        end if
        if menu item "Hide Tab Bar" of menu "View" of menu bar 1 exists then
            click menu item "Hide Tab Bar" of menu "View" of menu bar 1
        end if
        if menu item "Hide Toolbar" of menu "View" of menu bar 1 exists then
            click menu item "Hide Toolbar" of menu "View" of menu bar 1
        end if
    end tell
end tell

I'm not quite experienced on AppleScript by the way, so if I'm doing something wrong, please, correct me =]

Thanks in advance.

1

It the target app does not have focus then there is no menu item to click of its process.

Add tell application "Test App" to activate before trying to click a menu item.

tell application "Test App" to activate
tell application "System Events"
    tell process "Test App"
        if menu item "Hide Status Bar" of menu "View" of menu bar 1 exists then
            click menu item "Hide Status Bar" of menu "View" of menu bar 1
        end if
        if menu item "Hide Bookmark Bar" of menu "View" of menu bar 1 exists then
            click menu item "Hide Bookmark Bar" of menu "View" of menu bar 1
        end if
        if menu item "Hide Tab Bar" of menu "View" of menu bar 1 exists then
            click menu item "Hide Tab Bar" of menu "View" of menu bar 1
        end if
        if menu item "Hide Toolbar" of menu "View" of menu bar 1 exists then
            click menu item "Hide Toolbar" of menu "View" of menu bar 1
        end if
    end tell
end tell

Also note if there are any timing issues you may have to add a delay command after the activate command, e.g.: delay 1

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .