Jump to content

Leaderboard

Popular Content

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

  1. Next Beta available... the testcode now look like this:
    3 points
  2. 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
    2 points
  3. Uploaded new Beta which will change the color from Pre-Processor style.au3.11 to Line Comment style.au3.1 when an ";" is encountered.
    2 points
  4. You're right, my blindness. Sorry.
    2 points
  5. I think RichEdit has been my favorite thing I've ever discovered on AutoIt lol. In my quest to add in more html tags to my _StringToRichEditArray I needed a way to do href! There was an example I found that I followed but it didn't format correctly and didn't work 100% but it gave me a good base. Think I'll tackle inserting an image next, not looking forward to that. If anyone has an idea on how to do it let me know. Known issues (these will cause the hyperlink to lose the +li attribute after the RichEdit is updated): The hyperlink and friendly text are appended/inserted (directly adjacent to a non whitespace) but the hyperlink is not a valid hyperlink. Changing the char color for the control causes the hyperlink to lose it's hyperlink color (the light blue). Fix for Issue 1: Use the full URL for the hyperlink (https://www.autoitscript.com/site/ instead of www.autoitscript.com/site) Use any hyperlink with any friendly text that does not have www at the beginning (Hyperlink: www.google.com, Friendly Text: google.com) Use any hyperlink with any, or no, friendly text, but have a whitespace to the left of the hyperlink. Fix for Issue 2: I have no fix. Updated RichEdit Hyperlink.au3 Demo Original Post, outdated: Had a problem with inserting/appending hyperlinks that pointed to the local computer. (C:\Windows\)
    1 point
  6. LiquidNitrogen

    Tic-Tac-Toe

    This is a Tic-Tac-Toe game i made for Fun. It Worked better than i thought it would but has one or two small bugs. I plan on adding a Human Vs. Computer Mode. Tell me what you think about it. Tic-Tac-Toe.rar
    1 point
  7. Please try the current Beta with the following changes: #Region & #EndRegion will have the LineComment color for everything behind the directive (style.au3.1) #Comment block folding fix (i hope) #SPECIALS will have the LineComment color for everything behind the directive (so style.au3.1 in stead of style.au3.12) This should be the first 3 items in the list.
    1 point
  8. @SkysLastChance This was the intented reply on using functions. Your solution was written a little more complex so I rewrote it to below, you still have to test but hopefully some usefull learning points. I was confused in some areas what your intention is with sheet1 so maybe some errors but hopefully with the names of the variables you understand what I rewrote. You do not have to activate sheets to work with them you just can make references to worksheets which will in general be quicker. #include <Array.au3> #include <excel.au3> Global $oExcel ;File List One - Four Local $aFileList1[]= ["A" ,"B" ,"C" ,"D"] Local $aFileList2[] = ["E" ,"F" ,"G"] Local $aFileList3[] = ["H" ,"I"] Local $aFileList4[] = ["J" ,"K" ,"L" ,"M" ,"N" ,"O" ,"P" ,"Q" ,"R" ,"S" ,"T" ,"U"] example3() func example3() $oExcel== _Excel_Open() If @error Then Exit Local $aListList[] = [$aFileList1, $aFileList2, $aFileList3, $aFileList4] For $i = 0 To UBound($aListList) -1 for $filename in $aListList[$i] mergeWorkbook($filename,"C:\Users\username\Desktop\Test\Combined " & $i) next next _Excel_Close($oExcel) endfunc func mergeWorkbook($wbSourceFileName, $wbDestinationFileName) ;~ Global $aExcelData[0][20] Local $oDestinationWorkbook = _Excel_BookNew($oExcel) Local $oDestinationSheet1Worksheet=$oDestinationWorkbook.Worksheets("Sheet1") ;~ $oExcel.ActiveSheet.Name = "Sheet1" _Excel_SheetAdd($oDestinationWorkbook, -1, False, 1, "Facilites") Local $oDestionationFacilitesWorksheet=$oDestinationWorkbook.worksheets("Facilites") ;~ $oDestinationWorkbook.Sheets("Sheet1").Activate ;~ Global $DestinationiLastRow = $oDestinationWorkbook.ActiveSheet.UsedRange.Rows.Count Local $DestinationiLastRow = $oDestinationSheet1Worksheet.UsedRange.Rows.Count ;~ Global $oWorkbook, $aRangeRead $oSourceWorkbook = _Excel_BookOpen($oExcel, $wbSourceFileName, True, True) If @error Then MsgBox(0,"Error",$wbSourceFileName & " is missing. Push Okay to Continue") ;~ ContinueLoop return SetError(1, 10, "Some return value") EndIf ;~ Local $iLastRow = $oWorkbook.ActiveSheet.UsedRange.Rows.Count ;~ The activesheet can be anything make explicit named reference local $sourceWorksheet=$oSourceWorkbookworksheets("Sheet1") Local $iLastRow = $sourceWorksheet.UsedRange.Rows.Count ;~ If $i = 0 Then ;This is used to get the header from the first row and not the other sheets after. if ($oDestionationFacilitesWorksheet.usedrange.rows.count =0) $aCopyPaste = _Excel_RangeCopyPaste($sourceWorksheet, $sourceWorksheet.Usedrange.Columns("A:T"),$oDestionationFacilitesWorksheet.Range("A" & $DestinationiLastRow)) Else $aCopyPaste = _Excel_RangeCopyPaste($sourceWorksheet, $sourceWorksheet.Range("A2:T" & $iLastRow),$oDestionationFacilitesWorksheet.Range("A" & $DestinationiLastRow)) EndIf ;~ $oSourceWorkbook.Sheets("Facilites").Activate ;~ $oDestinationWorkbook.Sheets("Facilites").Activate $oSourceFacilitesWorksheet=$oSourceWorkbook.Sheets("Facilites") $oDestinationFacilitesWorksheet=$oDestinationWorkbook.Sheets("Facilites") $aCopyPaste = _Excel_RangeCopyPaste($oSourceFacilitesWorksheet, $oSourceFacilitesWorksheet.Range("A1"),$oSourceFacilitesWorksheet.Range("A" & $i + 1)) ;~ $oDestinationWorkbook.Sheets("Sheet1").Activate $DestinationiLastRow = $oDestinationSheet1Worksheet.UsedRange.Rows.Count + 1 _Excel_BookClose($oSourceWorkbook, False) _Excel_BookSaveAs($oDestinationWorkbook,$wbDestinationFileName) If @error Then Exit MsgBox($MB_SYSTEMMODAL, "_Excel_BookSaveAs", "Error saving workbook to '" & "'." & @CRLF & "@error = " & @error & ", @extended = " & @extended) EndFunc
    1 point
  9. https://www.codeproject.com/Articles/1228123/The-Art-of-WIN-Programming-the-Elusive-Control-Spy
    1 point
  10. @minhuy as to your question asked here: Please take a look here: and here:
    1 point
  11. czardas

    Tic-Tac-Toe

    You should not use the Global keyword inside functions - use Local instead. There are a few tic-tac-toe examples on this forum including one I made myself. Perhaps looking at these will give you some ideas on building your AI engine.
    1 point
  12. Maybe it's not the best solution, but I got it working with _GUICtrlListBox_ItemFromPoint() #include <GUIConstantsEx.au3> #include <Misc.au3> #include <GUIListBox.au3> $hGUI = GUICreate("Test", 500, 500) Global $hListX = 10, $hListY = 10 $hList = GUICtrlCreateList("", $hListX, $hListY, 480, 300) GUICtrlSetData($hList, "Line 1|Line 2|Line 3") $hListContext = GUICtrlCreateContextMenu($hList) $hListContextItem = GUICtrlCreateMenuItem("Menu item", $hListContext) $hListContextUnselect = GUICtrlCreateMenuItem("Unselect me", $hListContext) GUICtrlCreateEdit("some text", 10, 310, 480, 180) $WM_CONTEXTMENU = 123 GUIRegisterMsg($WM_CONTEXTMENU, "_WM_CONTEXTMENU") ;display context menu only when list is in focus and selected an item GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $hListContextItem MsgBox(0,'',GUICtrlRead($hList, getSelectedItem())) Case $hListContextUnselect _GUICtrlListBox_SetCurSel($hList, -1) EndSwitch WEnd Func getSelectedItem() Local $index = -1 If (_WinAPI_GetFocus() = GUICtrlGetHandle($hList)) And GUICtrlRead($hList) Then $index = _GUICtrlListBox_GetCurSel($hList) EndIf Return $index EndFunc ;==>getSelectedFile Func _WM_CONTEXTMENU($hwnd, $iMsg, $wParam, $lParam) #forceref $hWnd, $iMsg, $wParam, $lParam If $wParam <> GUICtrlGetHandle($hList) Then Return $GUI_RUNDEFMSG Local $cursor = GUIGetCursorInfo($hGUI) Local $index = _GUICtrlListBox_ItemFromPoint($hList, $cursor[0] - $hListX - 2, $cursor[1] - $hListY - 2) If $index == -1 Then Return 0 _GUICtrlListBox_SetCurSel($hList, $index) Return $GUI_RUNDEFMSG EndFunc ;==>_WM_CONTEXTMENU Maybe there is a better way?
    1 point
×
×
  • Create New...