Kajoe Posted February 11, 2021 Posted February 11, 2021 (edited) Dear Forum; I have been searching for days to make a good working GUI script with .mp4 file. But I want the .mp4 file to repeat in a loop. mp4 plays in screen, but after mp4 is finished, it is not repeating. I want to repeat it during the whole script. I searched and searched, but can't find an option for repeating. I think the wmp player needs a repeat input during use of script, but Windows does not have that command line for it. Another problem is starting the script. When script starts you see shortly a black empty background before video in GU starts to play. Is there an option to start withoiut the background startingscreen from wmp? My script is attached. By the way, I tried folowing script link too, Video plays good but does not repeat the mp4 too. Thanks for your help. Kajoe AutoitRepeat problem.rar Edited February 11, 2021 by Kajoe
Kajoe Posted February 11, 2021 Author Posted February 11, 2021 The best working mp4 script I have is the one attached below. I used the template from Belini above. In this I only need the repeat function for GUI mp4. Thank you very much. The same test video is used as in example above. Test UDF GUI forum .au3
Belini Posted February 11, 2021 Posted February 11, 2021 (edited) @Kajoe, you need to take the length of the video and put it in a loop to repeat when the run time is longer than the time of your video #include <Sound.au3> Global $count = 0 $aSound = _SoundOpen(@ScriptDir & "\Voorbeeld.mp4") $time = _SoundLength($aSound, 2) _SoundPlay($aSound) $count = TimerInit() HotKeySet("{esc}", "quit") While 1 Sleep(10) If TimerDiff($count) > $time Then _SoundPlay($aSound) $count = TimerInit() EndIf WEnd Func quit() Exit EndFunc ;==>quit Edited February 11, 2021 by Belini My Codes: Virtual Key Code UDF: http://www.autoitscript.com/forum/topic/138246-virtual-key-code-udf/ GuiSplashTextOn.au3: http://www.autoitscript.com/forum/topic/143542-guisplashtexton-udf/ Menu versions of Autoit: http://www.autoitscript.com/forum/topic/137435-menu-versions-of-autoit/#entry962011 Selects first folder of letters: ]http://www.autoitscript.com/forum/topic/144780-select-folders-by-letter/#entry1021708/spoiler] List files and folders with long addresses.: http://www.autoitscript.com/forum/topic/144910-list-files-and-folders-with-long-addresses/#entry102 2926 Program JUKEBOX made in Autoit:some functions:http://www.youtube.com/watch?v=WJ2tC2fD5Qs Navigation to search:http://www.youtube.com/watch?v=lblwOFIbgtQ
Kajoe Posted February 11, 2021 Author Posted February 11, 2021 (edited) Hi Belini. Thank you very much for very quick reply. Do you mean that I have to calculate the time of the Voorbeeld.mp4 file? And put that in a loop? How do I put it in a loop. I tried to add : ' <param name=".settings.setMode("Loop", True)", but that gives fault message By the way, I do not have sound in video. Only video Best regards, Kajoe Edited February 11, 2021 by Kajoe
Belini Posted February 11, 2021 Posted February 11, 2021 (edited) just use while 1 for infinite loop #include <GUIConstants.au3> #include <Sound.au3> #include <wmp.au3> Opt ("GUIOnEventMode", 1) $ Form1 = GUICreate ("AForm1", 518, 439, 192, 125) GUISetOnEvent ($ GUI_EVENT_CLOSE, "quit") $ wmp = _wmpcreate (1, 8, 8, 425, 425); cria objeto _wmpvalue ($ wmp, "nocontrols"); oculta os controles GUISetState (@SW_SHOW) $ aSound = _SoundOpen (@ScriptDir & "\ Voorbeeld.mp4") $ time = _SoundLength ($ aSound, 2) $ count = TimerInit () _wmploadmedia ($ wmp, @ScriptDir & "\ Voorbeeld.mp4"); carrega mídia HotKeySet ("{esc}", "quit") Enquanto 1; Loop infinito Sono (10) If TimerDiff ($ count)> $ time Then _wmploadmedia ($ wmp, @ScriptDir & "\ Voorbeeld.mp4"); carrega mídia $ count = TimerInit () MsgBox (4096, '', $ aSound) Fim se Aplique Func quit () Saída EndFunc you can use the video.au3 udf also which i consider to be the best Edited February 11, 2021 by Belini My Codes: Virtual Key Code UDF: http://www.autoitscript.com/forum/topic/138246-virtual-key-code-udf/ GuiSplashTextOn.au3: http://www.autoitscript.com/forum/topic/143542-guisplashtexton-udf/ Menu versions of Autoit: http://www.autoitscript.com/forum/topic/137435-menu-versions-of-autoit/#entry962011 Selects first folder of letters: ]http://www.autoitscript.com/forum/topic/144780-select-folders-by-letter/#entry1021708/spoiler] List files and folders with long addresses.: http://www.autoitscript.com/forum/topic/144910-list-files-and-folders-with-long-addresses/#entry102 2926 Program JUKEBOX made in Autoit:some functions:http://www.youtube.com/watch?v=WJ2tC2fD5Qs Navigation to search:http://www.youtube.com/watch?v=lblwOFIbgtQ
Kajoe Posted February 11, 2021 Author Posted February 11, 2021 Hi Belini; Thanks again. I am going to give it a try and wil let you know. Great support.
Kajoe Posted February 11, 2021 Author Posted February 11, 2021 (edited) Dear Belini; with apenas use while 1 para loop infinito file above I got lots of errors in script. And when I look at that script it is for GUI to leave GUI open until time inintiated. Isn't it? That wat not what I ment in my question. GUI screen works perfectly with the script I have attaced, but mp4 is only 10 seconds long. And I want to repeat the voorbeeld.mp4 untill gui screen stopt by initiated script. So I need to replay "voorbeeld.mp4) constantly in GUI, until GUI screen closes automaticly by script. Edited February 11, 2021 by Kajoe
Belini Posted February 11, 2021 Posted February 11, 2021 Another example using UDF video.au3 without using a timer and without putting it in the loop #include "video.au3" Global $idS, $count Example() HotKeySet("{esc}", "quit") While 1 Sleep(1000) $count += 1 If $count = 30 Then ExitLoop WEnd quit() Func Example() Local $time, $gui $gui = GUICreate("Example", 600, 200, -1, -1) GUISetState(@SW_SHOW) $idS = _Video_Open(@ScriptDir & "\" & "Voorbeeld.mp4", $gui, 0, 0, 600, 200) $time = _Video_Length($idS, 1) _Video_Play($idS) AdlibRegister("Repeat", $time) EndFunc ;==>Example Func Repeat() _Video_Seek($idS, 0) _Video_Play($idS) EndFunc ;==>Repeat Func quit() _Video_Close($idS) AdlibUnRegister("Repeat") Exit EndFunc ;==>quit My Codes: Virtual Key Code UDF: http://www.autoitscript.com/forum/topic/138246-virtual-key-code-udf/ GuiSplashTextOn.au3: http://www.autoitscript.com/forum/topic/143542-guisplashtexton-udf/ Menu versions of Autoit: http://www.autoitscript.com/forum/topic/137435-menu-versions-of-autoit/#entry962011 Selects first folder of letters: ]http://www.autoitscript.com/forum/topic/144780-select-folders-by-letter/#entry1021708/spoiler] List files and folders with long addresses.: http://www.autoitscript.com/forum/topic/144910-list-files-and-folders-with-long-addresses/#entry102 2926 Program JUKEBOX made in Autoit:some functions:http://www.youtube.com/watch?v=WJ2tC2fD5Qs Navigation to search:http://www.youtube.com/watch?v=lblwOFIbgtQ
Kajoe Posted February 11, 2021 Author Posted February 11, 2021 Hi Belini; I tried your last sript, but video is not visisble. I have video.au3 attached in scriptdir.
Belini Posted February 11, 2021 Posted February 11, 2021 I forgot to put $ WS_CLIPCHILDREN in creating the Gui expandcollapse popup#include <WindowsConstants.au3> #include "video.au3" Global $idS, $count Example() HotKeySet("{esc}", "quit") While 1 Sleep(1000) $count += 1 If $count = 30 Then ExitLoop WEnd quit() Func Example() Local $time, $gui $gui = GUICreate("Example", 600, 200, -1, -1, $WS_CLIPCHILDREN) GUISetState(@SW_SHOW) $idS = _Video_Open(@ScriptDir & "\" & "Voorbeeld.mp4", $gui, 0, 0, 600, 200) $time = _Video_Length($idS, 1) _Video_Play($idS) AdlibRegister("Repeat", $time) EndFunc ;==>Example Func Repeat() _Video_Seek($idS, 0) _Video_Play($idS) EndFunc ;==>Repeat Func quit() _Video_Close($idS) AdlibUnRegister("Repeat") Exit EndFunc ;==>quit My Codes: Virtual Key Code UDF: http://www.autoitscript.com/forum/topic/138246-virtual-key-code-udf/ GuiSplashTextOn.au3: http://www.autoitscript.com/forum/topic/143542-guisplashtexton-udf/ Menu versions of Autoit: http://www.autoitscript.com/forum/topic/137435-menu-versions-of-autoit/#entry962011 Selects first folder of letters: ]http://www.autoitscript.com/forum/topic/144780-select-folders-by-letter/#entry1021708/spoiler] List files and folders with long addresses.: http://www.autoitscript.com/forum/topic/144910-list-files-and-folders-with-long-addresses/#entry102 2926 Program JUKEBOX made in Autoit:some functions:http://www.youtube.com/watch?v=WJ2tC2fD5Qs Navigation to search:http://www.youtube.com/watch?v=lblwOFIbgtQ
Kajoe Posted February 11, 2021 Author Posted February 11, 2021 Hi Belini. Stil the same. No video. Did you test it with the example mp4 I had attached?
Belini Posted February 11, 2021 Posted February 11, 2021 (edited) Quote Hi Belini. Stil the same. No video. Did you test it with the example mp4 I had attached? yes I tested it with the video you posted expandcollapse popup#include <WindowsConstants.au3> #include "video.au3" Global $idS, $count, $number = 1; Make tests from 1 to 7 Example() HotKeySet("{esc}", "quit") While 1 Sleep(1000) $count += 1 If $count = 30 Then ExitLoop WEnd quit() Func Example() Local $time, $gui $gui = GUICreate("Example", 600, 200, -1, -1, $WS_CLIPCHILDREN) GUISetState(@SW_SHOW) $idS = _Video_Open(@ScriptDir & "\" & "Voorbeeld.mp4", $gui, 0, 0, 600, 200) $time = _Video_Length($idS, 1) _Video_execute($idS, 0, $number) AdlibRegister("Repeat", $time) EndFunc ;==>Example Func Repeat() _Video_Seek($idS, 0) _Video_execute($idS, 0, $number) EndFunc ;==>Repeat Func _Video_execute($string = '', $mod = 0, $opt = 1) If $mod = 1 Then $string = "play " & $string & " fullscreen" Else $string = "play " & $string EndIf Switch $opt Case 1 DllCall("C:\WINDOWS\system32\winmm.dll", 'long', 'mciSendString', 'str', $string, 'str', '', 'int', 0, 'ptr', 0); mciSendString Case 2 DllCall("C:\WINDOWS\system32\winmm.dll", "int", "mciSendString", "str", $string, "str", "", "long", 0, "long", 0); mciSendString Case 3 DllCall("C:\WINDOWS\system32\winmm.dll", "int", "mciSendString", "str", $string, "str", "", "int", 0, "hwnd", 0); mciSendString Case 4 DllCall("C:\WINDOWS\system32\winmm.dll", 'long', 'mciSendStringA', 'str', $string, 'str', '', 'int', 0, 'ptr', 0); mciSendStringA Case 5 DllCall("C:\WINDOWS\system32\winmm.dll", "int", "mciSendStringA", "str", $string, "str", "", "long", 0, "long", 0); mciSendStringA Case 6 DllCall("C:\WINDOWS\system32\winmm.dll", "dword", "mciSendStringW", "wstr", $string, "wstr", "", "uint", 0, "ptr", 0); mciSendStringW Case 7 DllCall("C:\WINDOWS\system32\winmm.dll", "int", "mciSendStringW", "wstr", $string, "wstr", "", "long", 0, "long", 0); mciSendStringW EndSwitch EndFunc ;==>_Video_execute Func quit() _Video_Close($idS) AdlibUnRegister("Repeat") Exit EndFunc ;==>quit do tests by changing the number from 1 to 7, one of them should work for you Edited February 11, 2021 by Belini My Codes: Virtual Key Code UDF: http://www.autoitscript.com/forum/topic/138246-virtual-key-code-udf/ GuiSplashTextOn.au3: http://www.autoitscript.com/forum/topic/143542-guisplashtexton-udf/ Menu versions of Autoit: http://www.autoitscript.com/forum/topic/137435-menu-versions-of-autoit/#entry962011 Selects first folder of letters: ]http://www.autoitscript.com/forum/topic/144780-select-folders-by-letter/#entry1021708/spoiler] List files and folders with long addresses.: http://www.autoitscript.com/forum/topic/144910-list-files-and-folders-with-long-addresses/#entry102 2926 Program JUKEBOX made in Autoit:some functions:http://www.youtube.com/watch?v=WJ2tC2fD5Qs Navigation to search:http://www.youtube.com/watch?v=lblwOFIbgtQ
Nine Posted February 11, 2021 Posted February 11, 2021 Doesn't work for me either. There is no error on open, but _Video_Lenght return Null. “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy
Kajoe Posted February 11, 2021 Author Posted February 11, 2021 With new script still no video. Maybe the Windows standard winm.dll is not good working for this script. And I tried to replace it with the one that you had posted in other thread, but windows does not allow to change the dll file.
Belini Posted February 11, 2021 Posted February 11, 2021 (edited) Here on my windows 7 _Video_Length () returns 9984 ms and _Video_play() opens with image, try with the change I made in _mciSendString() https://mega.nz/file/4EsiFRpY#UHFmL-OqM046KjILvUo9gCIqkXATiVD__3mcrC-IvVk Edited February 11, 2021 by Belini My Codes: Virtual Key Code UDF: http://www.autoitscript.com/forum/topic/138246-virtual-key-code-udf/ GuiSplashTextOn.au3: http://www.autoitscript.com/forum/topic/143542-guisplashtexton-udf/ Menu versions of Autoit: http://www.autoitscript.com/forum/topic/137435-menu-versions-of-autoit/#entry962011 Selects first folder of letters: ]http://www.autoitscript.com/forum/topic/144780-select-folders-by-letter/#entry1021708/spoiler] List files and folders with long addresses.: http://www.autoitscript.com/forum/topic/144910-list-files-and-folders-with-long-addresses/#entry102 2926 Program JUKEBOX made in Autoit:some functions:http://www.youtube.com/watch?v=WJ2tC2fD5Qs Navigation to search:http://www.youtube.com/watch?v=lblwOFIbgtQ
Kajoe Posted February 11, 2021 Author Posted February 11, 2021 Thank you very much. I have tested it, but got an error again. I have Windows 10.
Belini Posted February 11, 2021 Posted February 11, 2021 change the Example() function and post what was written by consolewrite() Func Example() Local $time, $gui $gui = GUICreate("Example", 600, 200, -1, -1, $WS_CLIPCHILDREN) GUISetState(@SW_SHOW) $idS = _Video_Open(@ScriptDir & "\" & "Voorbeeld.mp4", $gui, 0, 0, 600, 200) ConsoleWrite('Id = ' & $idS & @crlf) $time = _Video_Length($idS, 1) ;MsgBox(4096, 'Time', $idS) ConsoleWrite('Time = ' & $time & ' ms' & @crlf) _Video_play($idS) AdlibRegister("Repeat", $time) EndFunc ;==>Example My Codes: Virtual Key Code UDF: http://www.autoitscript.com/forum/topic/138246-virtual-key-code-udf/ GuiSplashTextOn.au3: http://www.autoitscript.com/forum/topic/143542-guisplashtexton-udf/ Menu versions of Autoit: http://www.autoitscript.com/forum/topic/137435-menu-versions-of-autoit/#entry962011 Selects first folder of letters: ]http://www.autoitscript.com/forum/topic/144780-select-folders-by-letter/#entry1021708/spoiler] List files and folders with long addresses.: http://www.autoitscript.com/forum/topic/144910-list-files-and-folders-with-long-addresses/#entry102 2926 Program JUKEBOX made in Autoit:some functions:http://www.youtube.com/watch?v=WJ2tC2fD5Qs Navigation to search:http://www.youtube.com/watch?v=lblwOFIbgtQ
Kajoe Posted February 11, 2021 Author Posted February 11, 2021 +>Setting Hotkeys...--> Press Ctrl+Alt+Break to Restart or Ctrl+BREAK to Stop. Id = ylsplduaic Time = ms +>20:40:21 AutoIt3.exe ended.rc:0 +>20:40:21 AutoIt3Wrapper Finished. >Exit code: 0 Time: 31.44
Belini Posted February 11, 2021 Posted February 11, 2021 (edited) there can only be some problem with winm.dll on windows 10 because it works well on windows 7 and windows xp then you need to find another way to play videos without using winm.dll Func Example() Local $time, $gui $gui = GUICreate("Example", 600, 200, -1, -1, $WS_CLIPCHILDREN) GUISetState(@SW_SHOW) $idS = _Video_Open(@ScriptDir & "\" & "Voorbeeld.mp4", $gui, 0, 0, 600, 200) ConsoleWrite('Id = ' & $idS & @crlf) $time = _Video_Length($idS, 1) ;MsgBox(4096, 'Time', $idS) ConsoleWrite('Time = ' & $time & ' ms' & @crlf) _Video_play($idS) if Number($time) = 0 then $time = 9984 AdlibRegister("Repeat", $time) EndFunc ;==>Example try like this to see if at least open the video Edited February 11, 2021 by Belini My Codes: Virtual Key Code UDF: http://www.autoitscript.com/forum/topic/138246-virtual-key-code-udf/ GuiSplashTextOn.au3: http://www.autoitscript.com/forum/topic/143542-guisplashtexton-udf/ Menu versions of Autoit: http://www.autoitscript.com/forum/topic/137435-menu-versions-of-autoit/#entry962011 Selects first folder of letters: ]http://www.autoitscript.com/forum/topic/144780-select-folders-by-letter/#entry1021708/spoiler] List files and folders with long addresses.: http://www.autoitscript.com/forum/topic/144910-list-files-and-folders-with-long-addresses/#entry102 2926 Program JUKEBOX made in Autoit:some functions:http://www.youtube.com/watch?v=WJ2tC2fD5Qs Navigation to search:http://www.youtube.com/watch?v=lblwOFIbgtQ
Kajoe Posted February 11, 2021 Author Posted February 11, 2021 I am going to try to copy your winm.dll on my windows 10 and test again. Than it is shure that this dll is the problem. Thank you very much for support. I really apreaciate it. Best regards, Kajoe
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now