Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 03/23/2022 in all areas

  1. MattyD

    Media Player Embedding

    Hi all, Not to encroach on CYCho's zPlayer - I've just gove to upload this and found another example at the top. (looks good by the way!) Mine is just a proof of concept anyhow. The main problem here is that when you load a video with the WMP control, there is no obvoius way to scale the video down from its native resoultion. After a lot of searching I found you can use SetObjectRects fuction on the IOleInPlaceObj interface - but in AutoIt we first need to create this. $oWMP = ObjCreate("WMPlayer.OCX") GUICtrlCreateObj($oWMP, 0, 0, 400, 400) $oIInPlaceObj = _CreateInPlaceObjInterface($oWMP) $oIInPlaceObj.SetObjectRects($pRect1, $pRect2) ;Resizes the control Func _CreateInPlaceObjInterface($oObject) Local $oIInPlaceObj, $tagIOleInPlaceObj $tagIOleInPlaceObj = _ "ContextSensitiveHelp none(int); " & _ "GetWindow none(ptr); " & _ "InPlaceDeactivate none(); " & _ "ReactivateAndUndo none(); " & _ "SetObjectRects none(ptr; ptr;); " & _ "UIDeactivate none();" $oIInPlaceObj = ObjCreateInterface($oObject, "{00000113-0000-0000-C000-000000000046}", $tagIOleInPlaceObj) If Not IsObj($oIInPlaceObj) Then Return SetError(1, False) Return $oIInPlaceObj EndFunc Hope this saves someone a bit of pain! Just for completeness, it looks like some people have solved the resizing problem by embedding the player in HTML. I haven't really looked at this method but it does seem to work! Anyway, here's a bare bones build-your-own media player example. (use the WMP_v1.au3 like a UDF) Function List: Limitations onEventMode is forced. only one instance of the player is supported. WMP ActiveX Control... _MP_Create($ix, $iy, $iw, $ih) _MP_Resize($ix, $iy, $iw, $ih) load a single media item _MP_LoadMedia($sPath) playlist _MP_PlaylistSelItem($iIndex) _MP_PlaylistAdd($sPath) GUI Controls.... _MP_CtrlCreatePlayPause($ix, $iy, $iw, $ih) _MP_CtrlCreateStop($ix, $iy, $iw, $ih) _MP_CtrlCreateRewind($ix, $iy, $iw, $ih) _MP_CtrlCreateFastFwd($ix, $iy, $iw, $ih) _MP_CtrlCreatePrevious($ix, $iy, $iw, $ih) _MP_CtrlCreateNext($ix, $iy, $iw, $ih) _MP_CtrlCreateShuffle($ix, $iy, $iw, $ih) _MP_CtrlCreateLoop($ix, $iy, $iw, $ih) _MP_CtrlCreateMute($ix, $iy, $iw, $ih) _MP_CtrlCreateVolume($ix, $iy, $iw, $ih) _MP_CtrlCreateFullScreen($ix, $iy, $iw, $ih) _MP_CtrlCreateTransport($ix, $iy, $iw, $ih) _MP_CtrlCreatePlayList($ix, $iy, $iw, $ih) Otherwise just call these... _MP_PlayPause() _MP_Stop() _MP_Rewind() _MP_FastFwd() _MP_Previous() _MP_Next() _MP_Shuffle() _MP_Loop() _MP_Mute() _MP_FullScreen() Demo.au3 WMP_v1.au3
    1 point
  2. is this related to: https://www.autoitscript.com/trac/autoit/ticket/3870 ? regexptitle and regexpclass should be somehow fixed in the comming Au3.3.16.1 (Hope soon). It is quite possible that it is fixed but waitng for realease: https://www.autoitscript.com/trac/autoit/ticket/3866
    1 point
  3. XP 32 bit: $r1 = -1 $r2 = -1 $r3 = -1 ( both, 3.3.14.5 and 3.3.16.0 ) Edit: same in XP64SP2.
    1 point
  4. In addition to @Exit's good advice, I would double check to make sure your Anti-virus software isn't interfering with the script execution.
    1 point
  5. I have one other Folding quirky things that I found somewhat strange in the current release: This: Folds to this in the current release: ...which I think really should be: Agree?
    1 point
  6. do not use SciTE Lite but the full version from Jos and try again.
    1 point
  7. this: For $i=0 To UBound($L2StreakMemory,1)-1   For $i=0 To UBound($G2StreakMemory,1)-1 Local $lostStreak = 0 Local $wonStreak = 0 should be: For $i=1 To UBound($L2StreakMemory,1)-1 Local $lostStreak = 1 Local $wonStreak = 1   For $i=1 To UBound($G2StreakMemory,1)-1
    1 point
  8. See this thread for the prior discussion and solution to this issue.
    1 point
  9. ad777

    Input and Function

    just add after if .....:['] see below: While 1 Local $WorkToDo = InputBox("WorkList", "What you want to run", "Notepad", "", _ -1, -1, 0, 0) MsgBox($MB_SYSTEMMODAL, "", $WorkToDo) ; Display the result. If $WorkToDo = 'Notepad' Then MsgBox($MB_SYSTEMMODAL, "", $WorkToDo) ; Display the result. Notepad() ElseIf $WorkToDo = 'PowerPoint' Then MsgBox($MB_SYSTEMMODAL, "", $WorkToDo) ; Display the result. PowerPoint() ElseIf $WorkToDo = 'Word' Then MsgBox($MB_SYSTEMMODAL, "", $WorkToDo) ; Display the result. Word() ElseIf $WorkToDo = 'Load_Data' Then MsgBox($MB_SYSTEMMODAL, "", $WorkToDo) ; Display the result. ; La_Pucelle_d_Orleans() ElseIf $WorkToDo = 'Mozilla' Then MsgBox($MB_SYSTEMMODAL, "", $WorkToDo) ; Display the result. Mozilla() Else Sleep(300) EndIf WEnd
    1 point
  10. Hi @Danp2 , just here to say thank you for this !!
    1 point
  11. mylise

    Twain UDF

    I have not used Autoit for a while but a recent project required me to automate two scanners using 32 bits drivers. The C++ program could not access these directly as I am using a 64 bit compiler. So the simplest solution was to execute an external program that will interface with the scanners using Twain. The available programs did not give me the control I wanted so I searched for a library I could interface with in Autoit. The library is called EZTwain Classic Library, http://www.eztwain.com/eztwain1.htm but it seems that you can not download the zip? but I have found an earlier version online. I have converted about 80% of the available functions. The rest I did not see a need for. The Twain low level access "_EZTwain_CallMgr" and "_EZTwain_CallDS" functions are limited The Manufacturer's interface will show up when using function " _EZTwain_DeviceUserInterface($hWnd)" but it hangs when you ask to scan Here is the simplest way to scan and save as a BMP file. #include <twain_udf.au3> $ezDebug = 1 ;obtain console debug messages _EZTwain_Start() ;load Easy Twain Classic library _EZTwain_LoadSourceManager() ;load source ;_EZTwain_DeviceSelect() ; use to open GUI to select Twain device _EZTwain_DeviceOpen() ; open default Twain device ;_EZTwain_DeviceSetDPI(600) ;used to get image DPI _EZTwain_DeviceAcquire_File("d:\test.bmp") ; Scan image and save as a BMP file ;$hDIB = _EZTwain_DeviceAcquire_DIB() ; Used to scan file and save in memory as DIB image _EZTwain_Stop() ; Clean up and unload DLL It is not fully tested. EZTW32.dll eztwain_example.au3 twain_enum.au3 twain_struct.au3 twain_udf.au3
    1 point
  12. mylise

    Twain UDF

    Had to fix small issues to UDF files to get some of the low level functions to work correctly. I only show the get operations here but you can also set using _EZTwain_SetCapValue function and $MSG_SET operation. #include <twain_udf.au3> $ezDebug = 1 ;obtain console debug messages _EZTwain_Start() ;load Easy Twain Classic library _EZTwain_LoadSourceManager() ;load source _EZTwain_DeviceOpen() ; open default Twain device ;------------------------------------------------------------------- ; Using low level Capabilities get operation $tTemp = DllStructCreate("word;") $pTemp = DllStructGetPtr($tTemp) _EZTwain_GetCapValue($ICAP_BITDEPTH,$TWTY_UINT16,$pTemp) ConsoleWrite("Bit Depth returned value = " & DllStructGetData($tTemp,1) & @CRLF) _EZTwain_GetCapValue($ICAP_BITORDER,$TWTY_UINT16,$pTemp) ConsoleWrite("Bit Order returned value = " & DllStructGetData($tTemp,1) & @CRLF) _EZTwain_GetCapValue($ICAP_COMPRESSION,$TWTY_UINT16,$pTemp) ConsoleWrite("Image Compression returned value = " & DllStructGetData($tTemp,1) & @CRLF) _EZTwain_GetCapValue($ICAP_PIXELFLAVOR,$TWTY_UINT16,$pTemp) ConsoleWrite("Pixel Flavor returned value = " & DllStructGetData($tTemp,1) & @CRLF) _EZTwain_GetCapValue($ICAP_PIXELTYPE,$TWTY_UINT16,$pTemp) ConsoleWrite("Pixel Type returned value = " & DllStructGetData($tTemp,1) & @CRLF) _EZTwain_GetCapValue($ICAP_PLANARCHUNKY,$TWTY_UINT16,$pTemp) ConsoleWrite("Planar chunky returned value = " & DllStructGetData($tTemp,1) & @CRLF) _EZTwain_GetCapValue($ICAP_SUPPORTEDSIZES,$TWTY_UINT16,$pTemp) ConsoleWrite("Supported Sizes returned value = " & DllStructGetData($tTemp,1) & @CRLF) _EZTwain_GetCapValue($ICAP_UNITS,$TWTY_UINT16,$pTemp) ConsoleWrite("Units returned value = " & DllStructGetData($tTemp,1) & @CRLF) _EZTwain_GetCapValue($ICAP_XFERMECH,$TWTY_UINT16,$pTemp) ConsoleWrite("Transfer Mechanism returned value = " & DllStructGetData($tTemp,1) & @CRLF) _EZTwain_GetCapValue($CAP_DUPLEX,$TWTY_UINT16,$pTemp) ConsoleWrite("Device Duplex returned value = " & DllStructGetData($tTemp,1) & @CRLF) $tTemp = DllStructCreate("long;") $pTemp = DllStructGetPtr($tTemp) _EZTwain_GetCapValue($ICAP_PHYSICALHEIGHT,$TWTY_FIX32,$pTemp) ConsoleWrite("Physical Height returned value = " & _EZTwain_Fix32ToFloat(DllStructGetData($tTemp,1)) & @CRLF) _EZTwain_GetCapValue($ICAP_PHYSICALWIDTH,$TWTY_FIX32,$pTemp) ConsoleWrite("Physical Width returned value = " & _EZTwain_Fix32ToFloat(DllStructGetData($tTemp,1)) & @CRLF) _EZTwain_GetCapValue($ICAP_XRESOLUTION,$TWTY_FIX32,$pTemp) ConsoleWrite("X Resolution returned value = " & _EZTwain_Fix32ToFloat(DllStructGetData($tTemp,1)) & @CRLF) _EZTwain_GetCapValue($ICAP_YRESOLUTION,$TWTY_FIX32,$pTemp) ConsoleWrite("Y Resolution returned value = " & _EZTwain_Fix32ToFloat(DllStructGetData($tTemp,1)) & @CRLF) $tTemp = DllStructCreate("boolean;") $pTemp = DllStructGetPtr($tTemp) _EZTwain_GetCapValue($CAP_DEVICEONLINE,$TWTY_BOOL,$pTemp) ConsoleWrite("DEVICEONLINE returned value = " & DllStructGetData($tTemp,1) & @CRLF) _EZTwain_GetCapValue($CAP_DUPLEXENABLED,$TWTY_BOOL,$pTemp) ConsoleWrite("Duplex enabled returned value = " & DllStructGetData($tTemp,1) & @CRLF) ;------------------------------------------------------------------ ; Examples of Operation Triplets to obtain twain device identity $tTemp = DllStructCreate($tagTW_IDENTITY) $pTemp = DllStructGetPtr($tTemp) _EZTwain_CallDS($DG_CONTROL,$DAT_IDENTITY,$MSG_GET,$pTemp) For $i = 0 To 12 ConsoleWrite( $ezIdentity[$i] & " = " & DllStructGetData($tTemp, $i+1) & @CRLF) Next _EZTwain_CallMgr($DG_CONTROL,$DAT_IDENTITY,$MSG_GETDEFAULT,$pTemp) For $i = 0 To 12 ConsoleWrite( $ezIdentity[$i] & " = " & DllStructGetData($tTemp, $i+1) & @CRLF) Next _EZTwain_CallMgr($DG_CONTROL,$DAT_IDENTITY,$MSG_GETFIRST,$pTemp) For $i = 0 To 12 ConsoleWrite( $ezIdentity[$i] & " = " & DllStructGetData($tTemp, $i+1) & @CRLF) Next _EZTwain_CallMgr($DG_CONTROL,$DAT_IDENTITY,$MSG_GETNEXT,$pTemp) For $i = 0 To 12 ConsoleWrite( $ezIdentity[$i] & " = " & DllStructGetData($tTemp, $i+1) & @CRLF) Next _EZTwain_Stop() ; Clean up and unload DLL twain_enum.au3 twain_struct.au3 twain_udf.au3
    1 point
  13. Nine

    Media Player Embedding

    Here my take on your great find. Hope you don't mind. Thanks again. #include <Constants.au3> #include <GUIConstantsEx.au3> #include <StructureConstants.au3> #include <WindowsConstants.au3> Opt("MustDeclareVars", True) Example() Func Example() Local $oPlayer = ObjCreate("WMPlayer.OCX") GUICreate("Embedded Web control Test", 600, 200) GUICtrlCreateObj($oPlayer, 0, 0, 400, 100) $oPlayer.Settings.Volume = 100 $oPlayer.uiMode = "none" $oPlayer.stretchToFit = True Local $sFullPath = "C:\Applications\AutoIt\WASApi\Don Henley - The Boys of Summer.mp3" $oPlayer.URL = $sFullPath While $oPlayer.playState = 9 Sleep(50) WEnd If $oPlayer.playState <> 3 Then Exit MsgBox($MB_SYSTEMMODAL, "Error", $sFullPath & " cannot be played") ResizeOCX($oPlayer, 0, 0, 400, 100) GUISetState() While True Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop EndSwitch If $oPlayer.playState <> 3 Then ExitLoop WEnd EndFunc ;==>Example Func ResizeOCX($oObject, $iLeft, $iTop, $iRight, $iBottom) Local Const $tagIOleInPlaceObj = _ "ContextSensitiveHelp none(int); " & _ "GetWindow none(ptr); " & _ "InPlaceDeactivate none(); " & _ "ReactivateAndUndo none(); " & _ "SetObjectRects none(ptr; ptr;); " & _ "UIDeactivate none();" Local Static $oIInPlace = ObjCreateInterface($oObject, "{00000113-0000-0000-C000-000000000046}", $tagIOleInPlaceObj) Local $tRect = DllStructCreate($tagRECT) $tRect.Left = $iLeft $tRect.Top = $iTop $tRect.Right = $iRight $tRect.Bottom = $iBottom Local $pRect = DllStructGetPtr($tRect) $oIInPlace.SetObjectRects($pRect, $pRect) EndFunc ;==>ResizeOCX
    1 point
  14. @r2du-soft take a look on Au3.3.3.16.0
    1 point
  15. Hello. This should work. #ifndef UNICODE #define UNICODE #endif #include <iostream> #include<windows.h> using namespace std; int main() { int var1=10; int var2=20; std::wstring s = L"Var1 = " + std::to_wstring(var1) + L"\r\nVar2 = " + std::to_wstring(var2); MessageBox(NULL, s.c_str(),L"Title",MB_OK); return 0; } Saludos
    1 point
×
×
  • Create New...