Scripting VLC Preferences pane


(Fred Jones) #1

I have UI browser and am trying to figure out how to script the VLC preferences pane I’m able to get to the preferences pane, but I’m just not getting how to select items on the preferences dialog. Here’s what I have so far, but it fails on trying to click a button. What I actually want to do is deselect the checkbox for “Blank Screens in Fullscreen Mode”. Trying to sneak up on how to work with Preferences.

use AppleScript version "2.4" -- Yosemite (10.10) or later
use scripting additions

on run
	activate application "VLC"
	tell application "System Events"
		tell process "VLC"
			click menu item "Preferences..." of menu 1 of menu bar item "VLC" of menu bar 1
			tell toolbar of window 1
				click button 2
			end tell
		end tell
	end tell
end run

#2

On my version of VLC 2.2.4 opening the Preferences… opens a modal dialog. UI Browser can’t get into the internal structure of VLC when a modal dialog is open. UI Browser examines the internal structures when you’re in screen mode. Normally the Mac watches for events from all kinds of things but when a modal dialog is open essentially what happens is the applications’s focus narrows down to what is going on in the dialog and doesn’t pay attention other things. UI Browser needs the applications’s help to see the structures in dialog. Until the dialog is closed UI Browser can’t talk to the application. Once the dialog is closed there’s no longer anything to be examined by UI Browser.

There is no easy way around that problem. Trying another video app is one way. Or you can look at the reason you need to set a UI object in the dialog and see if there is anyway to do things different such that there is no longer any need to set a value in the dialog.

Why do you need to change the the value for Black screens in Fullscreen mode?

Bill


(Fred Jones) #3

Bill,

Thanks for the feedback. For the script I’ve produced, it will help if I can preset about six very important preference options in VLC. For instance, the playlist window needs to be visible when a group of movies is playing to keep track of where the current movie is playing. If black screens is enabled, it blacks out the primary monitor (video playing on the second monitor). I don’t absolutely need it to do this, just trying to spiff up the app a little. Since I now know that I can’t script the preferences in VLC, I can abandon that idea.

And, this is just a stop gab solution while I develop a xojo app.

Thanks!