Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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.

share|improve this question
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. –  Aaron Miller May 31 '13 at 19:48
    
Thanks, I added that just now –  user1159454 May 31 '13 at 21:08
add comment

2 Answers 2

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.

share|improve this answer
    
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 –  user1159454 May 31 '13 at 21:39
    
Do you have the tell application "VLC" block nested within another tell block ? –  adayzdone May 31 '13 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... –  user1159454 Jun 1 '13 at 0:02
add comment

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.

share|improve this answer
    
This works, thanks! But do you know why the method that VLC says should work, doesn't? –  user1159454 May 31 '13 at 21:41
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.