0

I'm trying to get the name of the current file playing in VLC. Applescript SHOULD be able to do this with VLC 2 and on (it's in the dictionary, "name of current item") however it keeps not compiling, because it "expected end of line but found identifier."

What's going on?

Edit: Here is the part of the code that's not working

tell application "VLC"
get name of current item
end tell

DOUBLE EDIT: Whole script

tell application "VLC"
    set clipname to get name of current item
end tell

set oldDelim to AppleScript's text item delimiters
set AppleScript's text item delimiters to "."

--set clipname to text item 1 of clipname

set AppleScript's text item delimiters to oldDelim

return clipname

EDIT EDIT EDIT: Something weird is happening. I swear when I opened one of my applescripts before, it rightfully said "current time" with no problems. But when I opened it again, it said <<class AACT>>, and won't let me type current time instead.

EDIT EDIT EDIT EDIT: It just did it again. When I quit and reopened applescript, it showed up/worked like it should.

1
  • 1
    Welcome to Super User! When asking for assistance with code that doesn't work, such as the Applescript mentioned here, it's very helpful to include in your question an excerpt which shows the part that's not working, so that people trying to answer your question know what they're dealing with. May 31, 2013 at 19:48

2 Answers 2

1

That part of your code is correct. The problem is somewhere else. Test it by cutting the snippet above out and it should still not compile.

3
  • I tried a new script with JUST the part that was in the post, but it keeps highlighting "item" and giving an error. I'll reupdate with the entire script May 31, 2013 at 21:39
  • Do you have the tell application "VLC" block nested within another tell block ?
    – adayzdone
    May 31, 2013 at 22:51
  • No, the tell block is the only block in the application. It works now, referenced in edit 5, but I can't figure out why... Jun 1, 2013 at 0:02
1

Try this:

 tell application "VLC"    
  activate   
  set currVideo to name of window 1  
  display dialog currVideo
end tell

or this:

tell application "VLC"
activate
set clipname to get name of item 1 of window 1
display dialog clipname
end tell

If you open the Dictionary for VLC app, you will see that the "window" element has a property "name", which I have used to fetch the name.

1
  • This works, thanks! But do you know why the method that VLC says should work, doesn't? May 31, 2013 at 21:41

You must log in to answer this question.

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