I need help learning how to use the AppleScript dictionary for VLC.

This is my first time trying to use an application’s appleScript dictionary.

Seeing some scripts that use the dictionary would help me to begin to understand it.

Any help has my thanks.

DJUNQUERA. I’m sure you know this but AppleScripts do not use the AppleScript dictionary. Instead, people who are writing AppleScripts use the dictionary as a reference.

Just by way of demonstration, say that I want to write a script that prompts the user for an audio file and then plays that audio in QuickTime Player. First, I need to select the audio file. All of the standard dialogs are in the Standard Additions dictionary, so I open that dictionary and search on “choose”. One of the displayed items is “choose file” which shows the following general description plus various options and properties.

Next, I have to load the QuickTime Player and open the audio file. So, I select the QuickTime Player dictionary and the first entry is open, which is defined as:

Finally I want to play the audio and so I search for play and find:

So, my script is as follows. I’ve intentionally omitted some code that normally would be included for the sake of simplicity.

set theAudio to (choose file) as text

tell application "QuickTime Player"
	open file theAudio
	play document 1
end tell

A few other matters of note are:

  • Almost all dictionaries contain a “standard suite” which includes items common to most dictionaries.

  • Some properties contain the notation R/O which indicates that the property can be read but not set.

  • Most commands indicate what is returned. The choose-file command returns an alias, and QuickTime Player’s open command returns a document.

  • The AppleScript dictionaries are not as up-to-date as one would hope, and that’s something to keep in mind.

Anyways, the important point, as noted above, is that the AppleScript dictionaries are reference works only. An additional reference work that I use a lot is the AppleScript Language Guide, the index of which can be found at the following link. It’s informative to compare the information provided for the choose-file command in this guide and in the Standard Additions dictionary.

https://developer.apple.com/library/archive/documentation/AppleScript/Conceptual/AppleScriptLangGuide/Index/index_of_book.html#//apple_ref/doc/uid/TP40000983-Index

Hi peavine:

:slight_smile: :slight_smile: :slight_smile: :slight_smile: :slight_smile:

Thank you very much for the time and knowledge you have used to help me.

You have clearly explained concepts that will be very important for me to continue learning.

My knowledge of AppleScript is very limited because I am self-taught and do not know a single word of English (this text that I write to you has been translated by Google Translate).

The only learning material has been the AppleScript Language Guide that you have recommended to me.

I just do simple scripts and continue to learn.

The trigger to try to learn how to use the Application Dictionaries was an elementary script that had the disadvantage of appearing in the front during its execution (something annoying and not very aesthetic).

tell application “VLC” to activate – put the window in front :frowning:
repeat 3 times
tell application “System Events” to key code 125 using {command down}
end repeat

Someone on this forum pointed out to me that the problem was easy to solve using application dictionary commands (volumeDown / volumeUp) and did not have the problem of getting to the front.

tell application “VLC”
volumeDown
volumeDown
volumeDown
volumeDown
end tell

That’s when I decided to start learning how application dictionaries work.

Again thank you very much for your help.
Receive my best wishes for you.