Jump to content
Zombie02

Embed AVI in Exe and use it

Recommended Posts

Hello Guys i am new to Autoit. I am currently writing a GUI which is displaying a avi. My question now is how can i use a avi i added with Autoit3wrapper

Thanks is advance

Zombie

Share this post


Link to post
Share on other sites

Look at the _GUICtrlAVI_* functions and see if they'll work for you.


If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites
2 hours ago, BrewManNH said:

Look at the _GUICtrlAVI_* functions and see if they'll work for you.

Unfortunately no the function should work Like the guictrlsetimage function

Share this post


Link to post
Share on other sites
2 hours ago, Zombie02 said:

Unfortunately no the function should work Like the guictrlsetimage function

Not sure what you're trying to say here. What function should work that way? If you're trying to embed a movie into a GUI, you can't just set it to a control, you have to create the control differently than say a picture or an icon.


If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites
Posted (edited)

It's simple like this:

#AutoIt3Wrapper_Res_File_Add=test_avi.avi, avi, 150

#include <GuiAVI.au3>
#include <GUIConstantsEx.au3>

Example()

Func Example()
    Local $hGUI, $hAVI

    ; Create GUI
    $hGUI = GUICreate("(Internal) AVI OpenEx", 300, 100)
    $hAVI = _GUICtrlAVI_Create($hGUI, "", -1, 10, 10)
    GUISetState(@SW_SHOW)

    ; Play the sample AutoIt AVI
;~  _GUICtrlAVI_OpenEx($hAVI, @SystemDir & "\Shell32.dll", 150)
    _GUICtrlAVI_OpenEx($hAVI, @ScriptFullPath, 150)

    ; Play the sample AutoIt AVI
    _GUICtrlAVI_Play($hAVI)

    ; Loop until the user exits.
    Do
    Until GUIGetMsg() = $GUI_EVENT_CLOSE

    ; Close AVI clip
    _GUICtrlAVI_Close($hAVI)

    GUIDelete()
EndFunc   ;==>Example

Note: It's modified example from helpfile for _GUICtrlAVI_OpenEx()

"C:\Program Files\Examples\Helpfile\_GUICtrlAVI_OpenEx.au3" 

 

EDIT:

Don't forget that to test it you have to run COMPILED exe file (not run au3 directly from Scite) and

you have to compile script using FULL Scite4AutoIt3 because of used #AutoIt3Wrapper_Res_File_Add directive

 

EDIT2: Here is simplified example without explicit call of _GUICtrlAVI_OpenEx()

#AutoIt3Wrapper_Res_File_Add=test_avi.avi, avi, 150

#include <GuiAVI.au3>
#include <GUIConstantsEx.au3>

$hGUI = GUICreate("(Internal) AVI Open", 300, 100)
$hAVI = _GUICtrlAVI_Create($hGUI, @ScriptFullPath, 150, 10, 10)
GUISetState(@SW_SHOW)

_GUICtrlAVI_Play($hAVI)

Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

_GUICtrlAVI_Close($hAVI)

Edited by Zedna
edit2

Share this post


Link to post
Share on other sites
6 hours ago, Zedna said:

It's simple like this:

#AutoIt3Wrapper_Res_File_Add=test_avi.avi, avi, 150

#include <GuiAVI.au3>
#include <GUIConstantsEx.au3>

Example()

Func Example()
    Local $hGUI, $hAVI

    ; Create GUI
    $hGUI = GUICreate("(Internal) AVI OpenEx", 300, 100)
    $hAVI = _GUICtrlAVI_Create($hGUI, "", -1, 10, 10)
    GUISetState(@SW_SHOW)

    ; Play the sample AutoIt AVI
;~  _GUICtrlAVI_OpenEx($hAVI, @SystemDir & "\Shell32.dll", 150)
    _GUICtrlAVI_OpenEx($hAVI, @ScriptFullPath, 150)

    ; Play the sample AutoIt AVI
    _GUICtrlAVI_Play($hAVI)

    ; Loop until the user exits.
    Do
    Until GUIGetMsg() = $GUI_EVENT_CLOSE

    ; Close AVI clip
    _GUICtrlAVI_Close($hAVI)

    GUIDelete()
EndFunc   ;==>Example

Note: It's modified example from helpfile for _GUICtrlAVI_OpenEx()

"C:\Program Files\Examples\Helpfile\_GUICtrlAVI_OpenEx.au3" 

 

EDIT:

Don't forget that to test it you have to run COMPILED exe file (not run au3 directly from Scite) and

you have to compile script using FULL Scite4AutoIt3 because of used #AutoIt3Wrapper_Res_File_Add directive

 

EDIT2: Here is simplified example without explicit call of _GUICtrlAVI_OpenEx()

#AutoIt3Wrapper_Res_File_Add=test_avi.avi, avi, 150

#include <GuiAVI.au3>
#include <GUIConstantsEx.au3>

$hGUI = GUICreate("(Internal) AVI Open", 300, 100)
$hAVI = _GUICtrlAVI_Create($hGUI, @ScriptFullPath, 150, 10, 10)
GUISetState(@SW_SHOW)

_GUICtrlAVI_Play($hAVI)

Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

_GUICtrlAVI_Close($hAVI)

 

test_avi.avi 20.31 kB · 1 download

Yes this was exactly what i was looking for.

Thank you for your help

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Similar Content

    • By Belini
      I am testing version 2.0.0.0 which runs on windows xp but could not send any command to the player using StdinWrite () does this player support slave mode? Is it possible to send commands to MPV as they are sent to Mplayer?
    • By Cipactli
      Have anybody succesfully played around with libmpv for mpv player to embed the player in gui ?
      Example of child gui.
      #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> Local $hGui, $mpv_pid Local $sStream = "http://distribution.bbb3d.renderfarming.net/video/mp4/bbb_sunflower_1080p_60fps_normal.mp4" $hGui = GUICreate("MPV Test", 640, 360, -1, -1) GUISetState(@SW_SHOW) $mpv_pid = Run(@ScriptDir & '\mpv.exe --wid="' & $hGui & '" "' & $sStream & '"') While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd MPV Player and Libmpv can be downloaded at https://mpv.srsfckn.biz/
       
      Best Regards
      -C
    • By Phoenixx177
      I have a script that is calling 2 browser windows in my GUI and loading up the appropriate URLs.  Tested alone it works fine.  I also have another script that launches a 3rd party application in the GUI.  When I try to modify my 2nd script so that it includes the two browser windows along with the GUI, the GUI loads but not the browser windows.  Can someone get a second set of eyes on the script below and tell me where my brain jumped track please?  Many Thanks.
      #include <GUIConstants.au3> #include <Constants.au3> #include <windowsconstants.au3> #include <IE.au3> Global $oIE_google = _IECreateEmbedded() Global $oIE_autoit = _IECreateEmbedded() Opt("GUIOnEventMode", 1) ; Change to OnEvent mode $mainWindow = GUICreate("Embed Cmd", 1280, 780, 10, 10) GUISetOnEvent($GUI_EVENT_CLOSE, "CLOSEClicked") GUISetState (@SW_SHOW) GUIRegisterMsg(0xF, "WM_PAINT") ; create a borderless window that is a child to the main window $embedWindow = GUICREATE("", 700, 400, 15, 15, $WS_POPUP, -1, $mainWindow) Global $google = GUICtrlCreateObj($oIE_google, 10, 10, 1000, 300) Global $autoit = GUICtrlCreateObj($oIE_autoit, 800, 10, 500, 300) _IENavigate($oIE_google, "http://www.google.com") _IENavigate($oIE_autoit, "http://www.bing.com") DllCall("user32.dll", "hwnd", "SetParent", "hwnd", $embedWindow, "hwnd", $mainWindow) ; launch the command prompt (black on white, without the operating system message) $pid = run("C:\Program Files (x86)\Cisco\Router Manager\Router Administration.exe") ProcessWait ($pid) ; get the handle of the cmd window as i cannot be certain that there will be only one instance of the cmd running with the same window title or class $cmdHandle = _ProcessGetHWnd($pid, 2) $hWndChild = $cmdHandle[1][1] ; make the command prompt window a child to the earlier created borderless child window DllCall("user32.dll", "hwnd", "SetParent", "hwnd", $hWndChild, "hwnd", $embedWindow) ; resize the command prompt window so that its bolder and title bar are outside the borderless child window ; giving the appearance of a borderless command prompt WinMove($hWndChild, '', 10, 500, 485, 206) ;WinMove($hWndChild, '', 10, 500) WinSetState($hWndChild, '', @SW_SHOW) WinSetState($embedWindow, '', @SW_SHOW) WinSetState($oIE_google, '', @SW_SHOW) WinSetState($oIE_autoit, '', @SW_SHOW) ; inifinite event loop While 1 ; sleep for 100 milliseconds (to not hog the cpu) sleep(100) ; end of event loop WEnd Func CLOSEClicked() ; take care of things to do when exiting Winkill($hWndChild) Exit EndFunc Func WM_PAINT($hWnd, $Msg, $wParam, $lParam) Sleep(100) DllCall("user32.dll", "int", "InvalidateRect", "hwnd", $hWnd, "ptr", 0, "int", 0) EndFunc ;==>WM_PAINT ;=============================================================================== ; ; Function Name: _ProcessGetHWnd ; Description: Returns the HWND(s) owned by the specified process (PID only !). ; ; Parameter(s): $iPid - the owner-PID. ; $iOption - Optional : return/search methods : ; 0 - returns the HWND for the first non-titleless window. ; 1 - returns the HWND for the first found window (default). ; 2 - returns all HWNDs for all matches. ; ; $sTitle - Optional : the title to match (see notes). ; $iTimeout - Optional : timeout in msec (see notes) ; ; Return Value(s): On Success - returns the HWND (see below for method 2). ; $array[0][0] - number of HWNDs ; $array[x][0] - title ; $array[x][1] - HWND ; ; On Failure - returns 0 and sets @error to 1. ; ; Note(s): When a title is specified it will then only return the HWND to the titles ; matching that specific string. If no title is specified it will return as ; described by the option used. ; ; When using a timeout it's possible to use WinWaitDelay (Opt) to specify how ; often it should wait before attempting another time to get the HWND. ; ; ; Author(s): Helge ; ;=============================================================================== Func _ProcessGetHWnd($iPid, $iOption = 1, $sTitle = "", $iTimeout = 2000) Local $aReturn[1][1] = [[0]], $aWin, $hTimer = TimerInit() While 1 ; Get list of windows $aWin = WinList($sTitle) ; Searches thru all windows For $i = 1 To $aWin[0][0] ; Found a window owned by the given PID If $iPid = WinGetProcess($aWin[$i][1]) Then ; Option 0 or 1 used If $iOption = 1 OR ($iOption = 0 And $aWin[$i][0] <> "") Then Return $aWin[$i][1] ; Option 2 is used ElseIf $iOption = 2 Then ReDim $aReturn[UBound($aReturn) + 1][2] $aReturn[0][0] += 1 $aReturn[$aReturn[0][0]][0] = $aWin[$i][0] $aReturn[$aReturn[0][0]][1] = $aWin[$i][1] EndIf EndIf Next ; If option 2 is used and there was matches then the list is returned If $iOption = 2 And $aReturn[0][0] > 0 Then Return $aReturn ; If timed out then give up If TimerDiff($hTimer) > $iTimeout Then ExitLoop ; Waits before new attempt Sleep(Opt("WinWaitDelay")) WEnd ; No matches SetError(1) Return 0 EndFunc ;==>_ProcessGetHWnd $StaticTxt = ControlGetText("Embed Cmd","",1007) MsgBox(1,"Static Text", $StaticTxt) GUISetState() While GUIGetMsg() <> -3 WEnd  
    • By wakillon
      Convert an animated Gif to an Avi file for use with GUICtrlCreateAvi function.
       
    • By wakillon
      An other tool for AutoIt Coders :
      Gif2Avi permit to convert an animated Gif to an Avi file for use with the (rarely used) GUICtrlCreateAvi function.
      Use an Avi file as loader or animation in a script (see StringFinder for example) is easier than use an animated gif.
      With this little tool you can also :
      _ Set the AVI file dimensions ( height will follow width changes for preserve ratio W/H )
      _ Change FPS (frames per second) 
      _ Try an other background color ( used in _GDIPlus_BitmapCreateHBITMAPFromBitmap function)
      _ Crop width and height (From the original dimension)

      Thanks to monoceres, Prog@ndy and UEZ for AVI functions.
      Source and compiled Version are available in the Download Section.
      May be the "GUICtrlCreateAvi" function will be a bit more used ! 
       
      Some Links for find or create loaders/spinners
      preloaders.net        loading.io      dribbble.com       chimply.com      tools.bit-hive.com
       
×
×
  • Create New...