Показать полную графическую версию : Как передвинуть слайдер в медиапроигрывателе на n секунд вперед/назад?
Добрый день! Есть такой скрипт:
HotkeySet("{F1}","SetSlider")
$name="Медиа-проигрыватель VLC"
while 1
sleep(500)
wend
Func SetSlider($iSec)
; что тут написать, чтобы двигать контрол на $iSec секунд назад?
EndFunc
Доступ к контролу можно получить, написав в качестве ID "[CLASS:QWidget; INSTANCE:24]". Но какой функцией слайдер подвинуть и как узнать его текущую позицию я не знаю.
Прикрепляю принтскрин контрола.
P.S. Я тут заметил, что если плеер перезапустить, в АйДи контрола INSTANCE: меняется. Пока не берем это во внимание, считаем INSTANCE всегда равной 24 :)
А используя горячие клавиши не подходит?
Например так:
HotKeySet (http://www.autoitscript.com/autoit3/docs/functions/HotKeySet.htm)("{ESC}", "Quit")
HotKeySet (http://www.autoitscript.com/autoit3/docs/functions/HotKeySet.htm)("{F1}", "SetSlider")
While (http://www.autoitscript.com/autoit3/docs/keywords.htm#While) 1
Sleep (http://www.autoitscript.com/autoit3/docs/functions/Sleep.htm)(500)
WEnd (http://www.autoitscript.com/autoit3/docs/keywords.htm#WEnd)
Func (http://www.autoitscript.com/autoit3/docs/keywords.htm#Func) SetSlider()
ControlSend (http://www.autoitscript.com/autoit3/docs/functions/ControlSend.htm)("[CLASS:wxWindowClassNR]", "", "msctls_trackbar321", "+{Right}")
EndFunc (http://www.autoitscript.com/autoit3/docs/keywords.htm#EndFunc)
Func (http://www.autoitscript.com/autoit3/docs/keywords.htm#Func) Quit()
Exit (http://www.autoitscript.com/autoit3/docs/keywords.htm#Exit)
EndFunc (http://www.autoitscript.com/autoit3/docs/keywords.htm#EndFunc)
А если напрямую, тогда можно так:
#include <GUISlider.au3>
Global (http://www.autoitscript.com/autoit3/docs/keywords.htm#Global) $iSecs = 5
HotKeySet (http://www.autoitscript.com/autoit3/docs/functions/HotKeySet.htm)("{ESC}", "Quit")
HotKeySet (http://www.autoitscript.com/autoit3/docs/functions/HotKeySet.htm)("{F1}", "SetSlider")
While (http://www.autoitscript.com/autoit3/docs/keywords.htm#While) 1
Sleep (http://www.autoitscript.com/autoit3/docs/functions/Sleep.htm)(100)
WEnd (http://www.autoitscript.com/autoit3/docs/keywords.htm#WEnd)
Func (http://www.autoitscript.com/autoit3/docs/keywords.htm#Func) SetSlider()
$hVLC = ControlGetHandle (http://www.autoitscript.com/autoit3/docs/functions/ControlGetHandle.htm)("[CLASS:wxWindowClassNR]", "", "msctls_trackbar321")
_GUICtrlSlider_SetPos($hVLC, _GUICtrlSlider_GetPos($hVLC)+$iSecs)
ControlSend (http://www.autoitscript.com/autoit3/docs/functions/ControlSend.htm)("[CLASS:wxWindowClassNR]", "", "msctls_trackbar321", "^+{Right}")
EndFunc (http://www.autoitscript.com/autoit3/docs/keywords.htm#EndFunc)
Func (http://www.autoitscript.com/autoit3/docs/keywords.htm#Func) Quit()
Exit (http://www.autoitscript.com/autoit3/docs/keywords.htm#Exit)
EndFunc (http://www.autoitscript.com/autoit3/docs/keywords.htm#EndFunc)
А используя горячие клавиши не подходит? »
Не знаю почему, но у меня shift, alt, ctrl (и кстати буквы тоже) через автоит вообще не посылаются. Работают только цифры, F1-F12 и некоторые другие.
А если напрямую, тогда можно так: »
Не работает. Попробовал еще вписать туда "msgbox(0,0,_GUICtrlSlider_GetPos($hVLC))" - функция позицию слайдера не выдает, пишет 0. То ли в хэндле, то ли в слайдере дело... - пока не знаю, посмотрю еще вечером.
© OSzone.net 2001-2012
vBulletin v3.6.4, Copyright ©2000-2025, Jelsoft Enterprises Ltd.