So, how to implement hotkeys without add_callback?

Discuss your Lua playlist, album art and interface scripts.
roland1
Blank Cone
Blank Cone
Posts: 44
Joined: 01 May 2014 16:49

So, how to implement hotkeys without add_callback?

Postby roland1 » 01 May 2014 17:37

Hello forum, hello Lua fraction in special.
I guess Xubuntu has updated vlc to sth like 2.1+ and my extension (creating cutlists, which I use from time to time) broke:
"attempt to call field 'add_callback' (a nil value)"

What can I try? (downgrading is not an option)

Maybe someone is also willing to explain why it was removed. Does this feature disturb vlc even if not called in a script?

best regards

edit:
there was already a topic (I've not seen, sorry):
https://forum.videolan.org/viewtopic.php?f=29&t=115450

mederi
Big Cone-huna
Big Cone-huna
Posts: 1951
Joined: 15 Mar 2011 16:38
VLC version: 2.0.8
Operating System: Windows Vista/XP

Re: So, how to implement hotkeys without add_callback?

Postby mederi » 05 May 2014 14:37

You cannot implement hotkeys without add_callback in VLC-2.1+. You can only use dialog box with buttons in extension scripts.

roland1
Blank Cone
Blank Cone
Posts: 44
Joined: 01 May 2014 16:49

Re: So, how to implement hotkeys without add_callback?

Postby roland1 » 06 May 2014 19:40

Thx for response.

Then, is it possible to activate e.g. utton with alt+b when the dialog-box has focus?
(If this was to cryptic: Is there a way to give a button an alt+character hotkey (or similar)?)

mederi
Big Cone-huna
Big Cone-huna
Posts: 1951
Joined: 15 Mar 2011 16:38
VLC version: 2.0.8
Operating System: Windows Vista/XP

Re: So, how to implement hotkeys without add_callback?

Postby mederi » 07 May 2014 11:39

Perhaps you could use some external helper (AutoHotkey, AutoIt, VBS).
http://stackoverflow.com/questions/1601 ... -xpos-ypos

roland1
Blank Cone
Blank Cone
Posts: 44
Joined: 01 May 2014 16:49

Re: So, how to implement hotkeys without add_callback?

Postby roland1 » 07 May 2014 12:54

I am a big fan of autohotkey and I can read/interpret the input-devices on my Linux machine (at least, given read permission) but this would add too much complexity, IMHO.
If someone knows a way to bind alt+key to a button (as other windows are able to) (or any other internal solution) please share it.
In the meantime, I will search for sth more api stable:p
regards and thx to mederi for taking time and keeping up this forum
EDIT:
on my machine this works, i.e. alt+m activates MyButton (when dialog-box has focus):
----------------------------------
local dlg = vlc.dialog"my_dialog"
local button = dlg:add_button("&MyButton", my_callback, 1, 4, 4, 1)
----------------------------------
Now, I hope this feature remains some years in vlc.
This workaround provides at least restricted hotkey capabilities, but is not a full replacement for add_callback of course.

mederi
Big Cone-huna
Big Cone-huna
Posts: 1951
Joined: 15 Mar 2011 16:38
VLC version: 2.0.8
Operating System: Windows Vista/XP

Re: So, how to implement hotkeys without add_callback?

Postby mederi » 07 May 2014 21:09

Thank you for the information. Ampersand in the name of a button really does the trick.


Return to “Scripting VLC in lua”

Who is online

Users browsing this forum: No registered users and 3 guests