
timmalos
Active Members-
Posts
76 -
Joined
-
Last visited
Everything posted by timmalos
-
Hey. I'm currently trying to build a mini game (trivia). Can't tell you the full reasons I do this with AutoIt but let's say it has to be So I took few samples from GDI god @UEZ and I'm almost there. Goal is simple, I'll ask where is a country for example, and players have to click somewhere and "guess" the location, then I'll take the nearest proposals to get scores. (Kinda Geoguessr) Pls do not comment my way to check for simple clicks, it really only is a poc for now I tried few mins only. But to be really sure this is doable, I'm struggling on the way to put my icon exactly where the user pressed. (Because of zooms/etc coordonates are not that easy) So if someone can help me to understand the correct locations I should set for my "icon" when usr click on a location, thanks a lot ! I include the two images if you want to run it. #include <GUIConstantsEx.au3> #include <Misc.au3> #include <Screencapture.au3> #include <WindowsConstants.au3> Global $sx, $z = 10, $sy, $mc2, $f, $scroll_x, $scroll_y Global Const $gdip_x = 0, $gdip_y = 0, $zmin = 5, $zmax = 15, $bg_c = "404040" Global Const $gdip_w = 1280, $gdip_h = 720 Global $bW = $gdip_w, $bH = $gdip_h Global Const $hGUI = GUICreate("GDI+ Test", $gdip_w, $gdip_h) GUISetState() Global Const $dll = DllOpen("user32.dll") _GDIPlus_Startup() Global Const $hGraphic = _GDIPlus_GraphicsCreateFromHWND($hGUI) Global Const $hBuffer_Bmp = _GDIPlus_BitmapCreateFromGraphics($gdip_w, $gdip_h, $hGraphic) Global Const $hContext = _GDIPlus_ImageGetGraphicsContext($hBuffer_Bmp) _GDIPlus_GraphicsSetPixelOffsetMode($hContext, 2) ;~ _GDIPlus_GraphicsSetCompositingQuality($hContext, 2) _GDIPlus_GraphicsSetInterpolationMode($hContext, 7) Global $hMatrix = _GDIPlus_MatrixCreate() _GDIPlus_MatrixTranslate($hMatrix, $gdip_w / 2, $gdip_h / 2) ;Global Const $hHBitmap = _ScreenCapture_Capture("", 0, 0, $gdip_w, $gdip_h) ;~ Global Const $hBmp = _GDIPlus_BitmapCreateFromHBITMAP($hHBitmap) Global $hBmp = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\worldmap.jpg") _AddText2Img($hBmp, "Where is France ?",20,20,"Comic Sans MS",150,0xFF00FFFF) Draw2Graphic($hBmp) Zoom(2) GUIRegisterMsg($WM_MOUSEWHEEL, "_Mousewheel") Do $mc2 = MouseGetPos() $t=TimerInit() $pressed = false While _IsPressed("01", $dll) $mc3 = MouseGetPos() If $mc2[0] <> $mc3[0] Or $mc2[1] <> $mc3[1] Then $scroll_x = ($sx + ($mc3[0] - $mc2[0]) / ($z ^ 2 / 32)) $scroll_y = ($sy + ($mc3[1] - $mc2[1]) / ($z ^ 2 / 32)) Draw2Graphic($hBmp) Zoom(2) EndIf Sleep(10) $pressed = True WEnd $sx = $scroll_x $sy = $scroll_y If $pressed And TimerDiff($t) <= 500 Then ; Someone clicked ConsoleWrite("Clicked ! " & @CRLF) _AddPing2Img($hBmp,$mc2[0]*5400/1920, $mc2[1]*2700/1080) ;<----- Here we need to get correct coordinates. (Trying 5400/1920 cause my image was 5400 large and my screen only 1920. But ofc not working :D Zoom(2) EndIf Until GUIGetMsg() = $GUI_EVENT_CLOSE _GDIPlus_MatrixDispose($hMatrix) ;_WinAPI_DeleteObject($hHBitmap) _GDIPlus_GraphicsDispose($hGraphic) _GDIPlus_GraphicsDispose($hContext) _GDIPlus_BitmapDispose($hBuffer_Bmp) _GDIPlus_BitmapDispose($hBmp) _GDIPlus_Shutdown() GUIDelete() DllClose($dll) Exit Func _AddText2Img($hImage, $sText, $iX = 5, $iY = 70, $sFontName = "Comic Sans MS", $fSize = 22, $iColor = 0xF00F5000) Local Const $hGraphic = _GDIPlus_ImageGetGraphicsContext($hImage) _GDIPlus_GraphicsSetSmoothingMode($hGraphic, 4) _GDIPlus_GraphicsSetTextRenderingHint($hGraphic, 3) Local Const $hBrush = _GDIPlus_BrushCreateSolid($iColor) Local Const $hFormat = _GDIPlus_StringFormatCreate() _GDIPlus_StringFormatSetAlign($hFormat, 1) ;center text horizontally Local Const $hFamily = _GDIPlus_FontFamilyCreate($sFontName) Local Const $hFont = _GDIPlus_FontCreate($hFamily, $fSize) Local Const $aDim = _GDIPlus_ImageGetDimension($hImage) Local Const $tLayout = _GDIPlus_RectFCreate($iX, $iY, $aDim[0], $aDim[1]) _GDIPlus_GraphicsDrawStringEx($hGraphic, $sText, $hFont, $tLayout, $hFormat, $hBrush) _GDIPlus_FontDispose($hFont) _GDIPlus_FontFamilyDispose($hFamily) _GDIPlus_StringFormatDispose($hFormat) _GDIPlus_BrushDispose($hBrush) _GDIPlus_GraphicsDispose($hGraphic) EndFunc Func _AddPing2Img($hImage, $iX = 5, $iY = 70) Local $hBmp2 = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\icon.jpg") Local Const $hGraphic = _GDIPlus_ImageGetGraphicsContext($hImage) _GDIPlus_GraphicsDrawImageRect($hGraphic, $hBmp2, $iX, $iY,100,100) _GDIPlus_GraphicsDispose($hGraphic) EndFunc Func Draw2Graphic($hImage) Local $w, $h _GDIPlus_GraphicsClear($hContext, "0xFF" & $bg_c) If $bW <= $gdip_w And $bH <= $gdip_h Then $f = 1 _GDIPlus_GraphicsDrawImageRect($hContext, $hImage, $gdip_w / 2 - $bW / 2 - $scroll_x, $gdip_h / 2 - $bH / 2 - $scroll_y, $bW, $bH) Else If $bW >= $bH Then $f = $bW / $gdip_w Else $f = $bH / $gdip_h EndIf $w = Floor($bW / $f) $h = Floor($bH / $f) If $w > $gdip_w Then $f = $bW / $gdip_w ElseIf $h > $gdip_h Then $f = $bH / $gdip_h EndIf _GDIPlus_GraphicsDrawImageRect($hContext, $hImage, $gdip_w / 2 - $w / 2 - $scroll_x, $gdip_h / 2 - $h / 2 - $scroll_y, $w, $h) EndIf EndFunc ;==>Draw2Graphic Func Zoom($zoom_dir) Switch $zoom_dir Case -1 _GDIPlus_MatrixDispose($hMatrix) $hMatrix = _GDIPlus_MatrixCreate() _GDIPlus_MatrixTranslate($hMatrix, $gdip_w / 2, $gdip_h / 2) _GDIPlus_MatrixScale($hMatrix, 1 / $f, 1 / $f) $scroll_x = 0 $scroll_y = 0 Case 0 If $z > $zmin Then _GDIPlus_MatrixScale($hMatrix, 0.85, 0.85) $z -= 0.15 EndIf Case 1 If $z <= $zmax Then _GDIPlus_MatrixScale($hMatrix, 1.15, 1.15) $z += 0.15 EndIf Case 2 _GDIPlus_MatrixScale($hMatrix, 1, 1) EndSwitch _GDIPlus_GraphicsSetTransform($hContext, $hMatrix) _GDIPlus_GraphicsClear($hContext, "0xFF" & $bg_c) ;~ _GDIPlus_GraphicsDrawImage($hContext, $hBmp, -$bW / 2 + $scroll_x, -$bH / 2 + $scroll_y) _GDIPlus_GraphicsDrawImageRect($hContext, $hBmp, -$bW / 2 + $scroll_x, -$bH / 2 + $scroll_y, $gdip_w, $gdip_h) _GDIPlus_GraphicsDrawImageRect($hGraphic, $hBuffer_Bmp, $gdip_x, $gdip_y, $gdip_w, $gdip_h) EndFunc ;==>Zoom Func _Mousewheel($hWnd, $iMsg, $wParam, $lParam) Switch $wParam Case 0xFF880000 ;mouse wheel up Zoom(0) Return 0 Case 0x00780000 Zoom(1) Return 0 EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>_Mousewheel
-
Hey. Still same issue end of 2021. AutoIt is the only tool that runs issues with this Google Drive sync setup. I'm able to compile C,Java and any script without any issue but AutoIt just runs and returns immediately without any error. Quite boring since this was what we wanted to use as a "repo" for multiple users, we have to download files locally then recopy behind, leading to possible mistakes. (That git will handle)
-
Autoit-Socket-IO - Networking in AutoIt made simple!
timmalos replied to tarretarretarre's topic in AutoIt Example Scripts
That's what I was afraid of. Wasn't able to really look inide the _IO funcitons but I was hoping since it exists multiple Socket IO clients on other languages than JS. Thanks anyway for your answer. -
Autoit-Socket-IO - Networking in AutoIt made simple!
timmalos replied to tarretarretarre's topic in AutoIt Example Scripts
I don't manage to make it working with a Socket.IO server using NodeJs and an AutoIt Client using this library. Do I make something wrong ? AutoIt Client : #AutoIt3Wrapper_Change2CUI=Y #include "..\socketIO.au3" ; Connect to server _Io_DevDebug(True) Global $socket = _Io_Connect(@IPAddress1, 8082, True) If Not @error Then ConsoleWrite("Successfully connected to server" & @CRLF) Else ConsoleWrite("Failed to open socket:" & @error & @CRLF) Exit EndIf ; ------------- ; All events are registered here ; ------------- _Io_on("message", callback_serverHasGreetedUs) _Io_on("disconnect", callback_WeDisconnectedFromServer) ; Start main loop While _Io_Loop($socket) ;_Io_Emit($socket, "message", "Hello from client!") Sleep(500) WEnd ; ------------- ; All event callbacks are defined here ; ------------- Func callback_serverHasGreetedUs(ByRef $socket, $message) MsgBox(0, "The Client", "Message received from server: " & $message & @CRLF & "Press OK to send something back to the server") _Io_Emit($socket, "message from client", "Hello from client!") EndFunc ;==>callback_serverHasGreetedUs Func callback_WeDisconnectedFromServer($socket) MsgBox(0, "The Client", "Lost connection to server... Aborting!") Exit EndFunc ;==>callback_WeDisconnectedFromServer Node.Js server : var io = require('socket.io')(8082); // Quand un client se connecte, on le note dans la console io.sockets.on('connection', function (socket) { socket.emit('message', 'You are connected!'); console.log('Someone connected !'); }); I connect successfully, disconnect succesfully but unable to retrieve any message from client to server or server to client. -
WebDriver UDF (W3C compliant version) - 2024/09/21
timmalos replied to Danp2's topic in AutoIt Example Scripts
For websites having a lot of frames, I created this functions to look for elements without caring about frames. Sharing if this can be of any interest for someone :) _WD_SearchTextInFrames is the simple one, you use it with any text keyword and returns 0 or 1 _WD_SearchInFrames with same format than _WD_FindElement except you don't care about the frames. StayInFrameContainingResult is important there , by default it's false : Even if you find your element in your page, we go back to the page you were (leaving frame) so you won't be able to act with your element after without going back into your frame. If true, we don't leave the frame, meaning you can interact with the element, but you'll have to manually leave the frame yourself after, using __WD_FrameLeave() and _WD_IsWindowTop() ;RETURN 0 si text not found, 1 if found Func _WD_SearchTextInFrames($sSession,$KeyWord,$result=0) If $result = 1 Then return 1 Local $nbFrames = _WD_GetFrameCount($sSession) If $nbFrames > 0 Then For $i = 0 to $nbFrames -1 If $result = 0 Then _WD_FrameEnter($sSession, $i) $result = _WD_SearchTextInFrames($sSession,$KeyWord,$result) _WD_FrameLeave($sSession) EndIf Next EndIf If $result = 0 Then $result = _WD_Search($sSession,$KeyWord) Return $result EndFunc ; Return values .: Success - Element ID(s) returned by web driver ; Failure - "" Func _WD_SearchInFrames($sSession, $sStrategy, $sSelector,$StayInFrameContainingResult=False, $sStartElement = "", $lMultiple = False,$result="") If $result <> "" Then return $result Local $nbFrames = _WD_GetFrameCount($sSession) If $nbFrames > 0 Then For $i = 0 to $nbFrames -1 If $result = "" Then _WD_FrameEnter($sSession, $i) $result = _WD_SearchInFrames($sSession,$sStrategy, $sSelector, $StayInFrameContainingResult, $sStartElement, $lMultiple,$result) If $result="" OR $StayInFrameContainingResult=False Then _WD_FrameLeave($sSession) EndIf EndIf Next EndIf If $result = "" Then $result = _WD_FindElement($sSession, $sStrategy, $sSelector, $sStartElement, $lMultiple) Return $result EndFunc ;Look for any keyword in page source, can be anything including html ;RETURN 0 si non trouvé, 1 si trouvé Func _WD_Search($sSession,$KeyWord) $html = _WD_GetSource($sSession) If StringInStr($html, $KeyWord) Then Return 1 Return 0 EndFunc -
Hey all. From http://www.softwareishard.com/blog/har-export-trigger/ : "Basic automated HAR export is already supported by Firefox 41+ and all the user needs to do is set devtools.netmonitor.har.enableAutoExportToFile preference to enable it. As soon as this pref is true, a new HAR file is created automatically for every loaded page and stored in <your-firefox-profile-dir>/har/logs directory. " What would be the good settings to put to capabilities so that it would work with this API? THanks a lot for you help,
-
WebDriver UDF (W3C compliant version) - 2024/09/21
timmalos replied to Danp2's topic in AutoIt Example Scripts
Hey all. Not sure I should post this there, but since ages when automatizing tests with AutoIt I ran into the simple issue that I always lack the possibility to retrieve the HTTP code returned by the request in my navigator. When you do heavy automations, it's painfull to need to retrive from JS (or other ways) an URI and then do another HTTP request manually in your script to check the HTTP statuscode. (Making another request, and possibly not the same answer than what you had in your navigator). Looking into this library instead of the old deprecated FF.au3 (with Mozrepl), I saw sadly it's still true and WebDriver specification dosn't allow us to retrieve this HTTP statuscode. However I was able this time to find another way to retrieve it, by parsing FF logs, so I share it if someone else need that. This works with FF only, but there is a way to do the same thing with Chrome if needed ( All you need to do is tell chrome driver to do "Network.enable". This can be done by enabling Performance logging). I modified a little bit _WD_Option (see attached) to allow set another option : _WD_Option('FFLogFile', _TempFile(@ScriptDir&"\fflogs\")) If this value is set, I simply set two environment variables before the start of Firefox, thus I'm able to read FF logs, parse them and retrieve from them my HTTP Statuscode. Func _WD_GetHTTPStatusCode_FFOnly($URI) Local Const $sFuncName = "_WD_GetLastHTTPStatusCode" Local $uriID = "" $sFilePath = $_WD_Firefox_LogFile If $sFilePath = "" Then Return SetError(__WD_Error($sFuncName, $_WD_ERROR_InvalidValue, "You need to set option of LogFile in order to be able to retrieve HTTP statuscode")) Local $hFileOpen = FileOpen($sFilePath, 0) If $hFileOpen = -1 Then Return SetError(__WD_Error($sFuncName, $_WD_ERROR_InvalidValue, "Unable to open FF log file")) EndIf Local $sFileRead = FileRead($hFileOpen) ; this is how the log looks like when the request starts ; I have to get the id of the request using a regular expression ; and use that id later to get the response ; ; 2017-11-02 14:14:01.170000 UTC - [Main Thread]: D/nsHttp nsHttpChannel::BeginConnect [this=000000BFF27A5000] ; 2017-11-02 14:14:01.170000 UTC - [Main Thread]: D/nsHttp host=api.ipify.org port=-1 ; 2017-11-02 14:14:01.170000 UTC - [Main Thread]: D/nsHttp uri=https://api.ipify.org/?format=text Local $pattern = "(?is)BeginConnect \[this=(.*?)\](?:.*?)uri=([^\]]+?)\R" $aRet = StringRegExp($sFileRead,$pattern,3) For $i = 1 To UBound($aRet) - 1 Step 2 If $aRet[$i] = $URI Then $uriID = $aRet[$i-1] ContinueLoop EndIf Next If $uriID = "" THen Return SetError(__WD_Error($sFuncName, $_WD_ERROR_InvalidValue, "Unable to find related URI in FF logs to retrieve HTTP statuscode")) ; this is how the response looks like in the log file ; ProcessResponse [this=000000CED8094000 httpStatus=200] ; I will use another regular espression to get the httpStatus ; ; 2017-11-02 14:45:39.296000 UTC - [Main Thread]: D/nsHttp nsHttpChannel::OnStartRequest [this=000000CED8094000 request=000000CED8014BB0 status=0] ; 2017-11-02 14:45:39.296000 UTC - [Main Thread]: D/nsHttp nsHttpChannel::ProcessResponse [this=000000CED8094000 httpStatus=200] Local $pattern = "(?is)ProcessResponse \[this="&$uriID&" httpStatus=(.*?)\]"; $aRet = StringRegExp($sFileRead,$pattern,1) FileClose($hFileOpen) Return $aRet[0] EndFunc And simple example : $URI = "http://www.autoitscript.com/404/" _WD_Navigate($sSession, $URI) MsgBox(0,"",_WD_GetHTTPStatusCode_FFOnly($URI)) $URI = "https://www.autoitscript.com/forum/topic/191990-webdriver-udf-w3c-compliant-version-08042018/" _WD_Navigate($sSession, $URI) MsgBox(0,"",_WD_GetHTTPStatusCode_FFOnly($URI)) wd_core.au3 -
Anyone got knowledge on this?
-
Hey all. I'm a little stuck starting with COM interfacing with Microsoft OneNote. The msdn doc is there : https://msdn.microsoft.com/en-us/library/office/jj680118.aspx?f=255&MSPPError=-2147217396 I found, with the OleViewer what I need to access : // Generated .IDL file (by the OLE/COM Object Viewer) // // typelib filename: 3 [ uuid(0EA692EE-BB50-4E3C-AEF0-356D91732725), version(1.1), helpstring("Microsoft OneNote 15.0 Object Library"), custom(DE77BA64-517C-11D1-A2DA-0000F8773CE9, 134218339), custom(DE77BA63-517C-11D1-A2DA-0000F8773CE9, 2147483647), custom(DE77BA65-517C-11D1-A2DA-0000F8773CE9, Created by MIDL version 8.00.0611 at Mon Jan 18 19:14:07 2038 ), custom(0F21F359-AB84-41E8-9A78-36D110E6D2F9, Microsoft.Office.Interop.OneNote.dll) ] library OneNote { // TLib : // TLib : OLE Automation : {00020430-0000-0000-C000-000000000046} importlib("stdole2.tlb"); // Forward declare all types defined in this typelib interface IQuickFilingDialog; interface IQuickFilingDialogCallback; interface IApplication; interface Windows; interface Window; dispinterface IOneNoteEvents; typedef [uuid(552E0E02-B287-4EC6-9CC0-4BA019EE5EA1)] enum { hsSelf = 0, hsChildren = 1, hsNotebooks = 2, hsSections = 3, hsPages = 4 } HierarchyScope; typedef [uuid(41C8F6EA-0AF0-4A4F-99E9-5EB01EBFC9A3)] enum { heNone = 0, heNotebooks = 1, heSectionGroups = 2, heSections = 4, hePages = 8 } HierarchyElement; typedef [uuid(4DB67B4F-CC7D-45B5-88FE-569AE5798FF2)] enum { rrtNone = 0, rrtFiling = 1, rrtSearch = 2, rrtLinks = 3 } RecentResultType; typedef [uuid(B5EB9D34-5278-4D8A-AE1F-2F88EA56BBCE)] enum { cftNone = 0, cftNotebook = 1, cftFolder = 2, cftSection = 3 } CreateFileType; typedef [uuid(D6E78E55-7EE7-4A31-BF3E-B01E819599BA)] enum { piBasic = 0, piBinaryData = 1, piSelection = 2, piFileType = 4, piBinaryDataSelection = 3, piBinaryDataFileType = 5, piSelectionFileType = 6, piAll = 7 } PageInfo; typedef [uuid(D6166973-3665-4EDB-94B0-77C65C34B51C)] enum { pfOneNote = 0, pfOneNotePackage = 1, pfMHTML = 2, pfPDF = 3, pfXPS = 4, pfWord = 5, pfEMF = 6, pfHTML = 7, pfOneNote2007 = 8 } PublishFormat; typedef [uuid(E195F3E3-8EC3-4A67-81FE-DDBEC2B42D3F)] enum { slBackUpFolder = 0, slUnfiledNotesSection = 1, slDefaultNotebookFolder = 2 } SpecialLocation; typedef [uuid(452D048E-7F61-4258-94B9-A39E19C290DA)] enum { flEMail = 0, flContacts = 1, flTasks = 2, flMeetings = 3, flWebContent = 4, flPrintOuts = 5 } FilingLocation; typedef [uuid(82FC5A95-FEB7-4242-95E1-369C5DFE3F49)] enum { fltNamedSectionNewPage = 0, fltCurrentSectionNewPage = 1, fltCurrentPage = 2, fltNamedPage = 4 } FilingLocationType; typedef [uuid(226CC8E6-1ED0-4770-A7F1-A80BB4DDF07B)] enum { npsDefault = 0, npsBlankPageWithTitle = 1, npsBlankPageNoTitle = 2 } NewPageStyle; typedef [uuid(B67BC7E1-91B9-4F50-8471-77C76F8D63D6)] enum { dlDefault = 0xffffffff, dlNone = 0, dlLeft = 1, dlRight = 2, dlTop = 3, dlBottom = 4 } DockLocation; typedef [uuid(68555133-B62F-4490-9D66-9E9BFC68F6C6)] enum { xs2007 = 0, xs2010 = 1, xs2013 = 2, xsCurrent = 2 } XMLSchema; typedef [uuid(1ECC88B3-6D2B-4EDD-8DD5-BB11E5D34C09)] enum { tcsExpanded = 0, tcsCollapsed = 1 } TreeCollapsedStateType; typedef [uuid(13F18B04-E76F-42E0-97E6-8B6ABF38B484)] enum { nfoLocal = 1, nfoNetwork = 2, nfoWeb = 4, nfoNoWacUrl = 8 } NotebookFilterOutType; [ odl, uuid(1D12BD3F-89B6-4077-AA2C-C9DC2BCA42F9), helpstring("IQuickFilingUI Interface"), dual, oleautomation ] interface IQuickFilingDialog : IDispatch { [id(00000000), propget] HRESULT Title([out, retval] BSTR* bstrTitle); [id(00000000), propput] HRESULT Title([in] BSTR bstrTitle); [id(0x00000001), propget] HRESULT Description([out, retval] BSTR* bstrDescription); [id(0x00000001), propput] HRESULT Description([in] BSTR bstrDescription); [id(0x00000002), propget] HRESULT CheckboxText([out, retval] BSTR* bstrText); [id(0x00000002), propput] HRESULT CheckboxText([in] BSTR bstrText); [id(0x00000003), propget] HRESULT CheckboxState([out, retval] VARIANT_BOOL* pfChecked); [id(0x00000003), propput] HRESULT CheckboxState([in] VARIANT_BOOL pfChecked); [id(0x00000004), propget] HRESULT WindowHandle([out, retval] uint64* pHWNDWindow); [id(0x00000005), propget] HRESULT TreeDepth([out, retval] HierarchyElement* pTreeDepth); [id(0x00000005), propput] HRESULT TreeDepth([in] HierarchyElement pTreeDepth); [id(0x00000006), propget] HRESULT ParentWindowHandle([out, retval] uint64* pHWNDParentWindow); [id(0x00000006), propput] HRESULT ParentWindowHandle([in] uint64 pHWNDParentWindow); [id(0x00000007), propget] HRESULT Position([out, retval] tagPOINT* pPoint); [id(0x00000007), propput] HRESULT Position([in] tagPOINT pPoint); [id(0x00000008)] HRESULT SetRecentResults( [in] RecentResultType recentResults, [in] VARIANT_BOOL fShowCurrentSection, [in] VARIANT_BOOL fShowCurrentPage, [in] VARIANT_BOOL fShowUnfiledNotes); [id(0x0000000a)] HRESULT AddButton( [in] BSTR bstrText, [in] HierarchyElement allowedElements, [in] HierarchyElement allowedReadOnlyElements, [in] VARIANT_BOOL fDefault); [id(0x0000000b)] HRESULT Run([in] IQuickFilingDialogCallback* piCallback); [id(0x0000000c), propget] HRESULT SelectedItem([out, retval] BSTR* pbstrSelectedNodeID); [id(0x0000000d), propget] HRESULT PressedButton([out, retval] unsigned long* pButtonIndex); [id(0x0000000e), propput] HRESULT TreeCollapsedState([in] TreeCollapsedStateType rhs); [id(0x0000000f), propput] HRESULT NotebookFilterOut([in] NotebookFilterOutType rhs); [id(0x00000010)] HRESULT ShowCreateNewNotebook(); [id(0x00000011)] HRESULT AddInitialEditor(BSTR initialEditor); [id(0x00000012)] HRESULT ClearInitialEditors(); [id(0x00000013)] HRESULT ShowSharingHyperlink(); }; typedef struct tagtagPOINT { long x; long y; } tagPOINT; [ odl, uuid(627EA7B4-95B5-4980-84C1-9D20DA4460B1), helpstring("IQuickFilingDialogCallback Interface"), dual, oleautomation ] interface IQuickFilingDialogCallback : IDispatch { [id(0x60020000)] HRESULT OnDialogClosed([in] IQuickFilingDialog* dialog); }; [ odl, uuid(452AC71A-B655-4967-A208-A4CC39DD7949), helpstring("IApplication Interface"), dual, oleautomation ] interface IApplication : IDispatch { [id(0x60020000)] HRESULT GetHierarchy( [in] BSTR bstrStartNodeID, [in] HierarchyScope hsScope, [out] BSTR* pbstrHierarchyXmlOut, [in, optional, defaultvalue(2)] XMLSchema xsSchema); [id(0x60020001)] HRESULT UpdateHierarchy( [in] BSTR bstrChangesXmlIn, [in, optional, defaultvalue(2)] XMLSchema xsSchema); [id(0x60020002)] HRESULT OpenHierarchy( [in] BSTR bstrPath, [in] BSTR bstrRelativeToObjectID, [out] BSTR* pbstrObjectID, [in, optional, defaultvalue(0)] CreateFileType cftIfNotExist); [id(0x60020003)] HRESULT DeleteHierarchy( [in] BSTR bstrObjectID, [in, optional, defaultvalue(00:00:00)] DATE dateExpectedLastModified, [in, optional, defaultvalue(0)] VARIANT_BOOL deletePermanently); [id(0x60020004)] HRESULT CreateNewPage( [in] BSTR bstrSectionID, [out] BSTR* pbstrPageID, [in, optional, defaultvalue(0)] NewPageStyle npsNewPageStyle); [id(0x60020005)] HRESULT CloseNotebook( [in] BSTR bstrNotebookID, [in, optional, defaultvalue(0)] VARIANT_BOOL force); [id(0x60020006)] HRESULT GetHierarchyParent( [in] BSTR bstrObjectID, [out] BSTR* pbstrParentID); [id(0x60020007)] HRESULT GetPageContent( [in] BSTR bstrPageID, [out] BSTR* pbstrPageXmlOut, [in, optional, defaultvalue(0)] PageInfo pageInfoToExport, [in, optional, defaultvalue(2)] XMLSchema xsSchema); [id(0x60020008)] HRESULT UpdatePageContent( [in] BSTR bstrPageChangesXmlIn, [in, optional, defaultvalue(00:00:00)] DATE dateExpectedLastModified, [in, optional, defaultvalue(2)] XMLSchema xsSchema, [in, optional, defaultvalue(0)] VARIANT_BOOL force); [id(0x60020009)] HRESULT GetBinaryPageContent( [in] BSTR bstrPageID, [in] BSTR bstrCallbackID, [out] BSTR* pbstrBinaryObjectB64Out); [id(0x6002000a)] HRESULT DeletePageContent( [in] BSTR bstrPageID, [in] BSTR bstrObjectID, [in, optional, defaultvalue(00:00:00)] DATE dateExpectedLastModified, [in, optional, defaultvalue(0)] VARIANT_BOOL force); [id(0x6002000b)] HRESULT NavigateTo( [in] BSTR bstrHierarchyObjectID, [in, optional, defaultvalue("")] BSTR bstrObjectID, [in, optional, defaultvalue(0)] VARIANT_BOOL fNewWindow); [id(0x6002000c)] HRESULT NavigateToUrl( [in] BSTR bstrUrl, [in, optional, defaultvalue(0)] VARIANT_BOOL fNewWindow); [id(0x6002000d)] HRESULT Publish( [in] BSTR bstrHierarchyID, [in] BSTR bstrTargetFilePath, [in, optional, defaultvalue(0)] PublishFormat pfPublishFormat, [in, optional, defaultvalue("")] BSTR bstrCLSIDofExporter); [id(0x6002000e)] HRESULT OpenPackage( [in] BSTR bstrPathPackage, [in] BSTR bstrPathDest, [out] BSTR* pbstrPathOut); [id(0x6002000f)] HRESULT GetHyperlinkToObject( [in] BSTR bstrHierarchyID, [in] BSTR bstrPageContentObjectID, [out] BSTR* pbstrHyperlinkOut); [id(0x60020010)] HRESULT FindPages( [in] BSTR bstrStartNodeID, [in] BSTR bstrSearchString, [out] BSTR* pbstrHierarchyXmlOut, [in, optional, defaultvalue(0)] VARIANT_BOOL fIncludeUnindexedPages, [in, optional, defaultvalue(0)] VARIANT_BOOL fDisplay, [in, optional, defaultvalue(2)] XMLSchema xsSchema); [id(0x60020011)] HRESULT FindMeta( [in] BSTR bstrStartNodeID, [in] BSTR bstrSearchStringName, [out] BSTR* pbstrHierarchyXmlOut, [in, optional, defaultvalue(0)] VARIANT_BOOL fIncludeUnindexedPages, [in, optional, defaultvalue(2)] XMLSchema xsSchema); [id(0x60020012)] HRESULT GetSpecialLocation( [in] SpecialLocation slToGet, [out] BSTR* pbstrSpecialLocationPath); [id(0x60020013)] HRESULT MergeFiles( [in] BSTR bstrBaseFile, [in] BSTR bstrClientFile, [in] BSTR bstrServerFile, [in] BSTR bstrTargetFile); [id(0x60020014)] HRESULT QuickFiling([out, retval] IQuickFilingDialog** ppiDialog); [id(0x60020015)] HRESULT SyncHierarchy([in] BSTR bstrHierarchyID); [id(0x60020016)] HRESULT SetFilingLocation( [in] FilingLocation flToSet, [in] FilingLocationType fltToSet, [in] BSTR bstrFilingSectionID); [id(0x00000064), propget] HRESULT Windows([out, retval] Windows** ppONWindows); [id(0x00000066), propget, hidden] HRESULT Dummy1([out, retval] VARIANT_BOOL* pBool); [id(0x60020019)] HRESULT MergeSections( [in] BSTR bstrSectionSourceId, [in] BSTR bstrSectionDestinationId); [id(0x00000068), propget] HRESULT COMAddIns([out, retval] IDispatch** ppiComAddins); [id(0x00000069), propget] HRESULT LanguageSettings([out, retval] IDispatch** ppiLanguageSettings); [id(0x6002001c)] HRESULT GetWebHyperlinkToObject( [in] BSTR bstrHierarchyID, [in] BSTR bstrPageContentObjectID, [out] BSTR* pbstrHyperlinkOut); }; [ odl, uuid(6D4B9C3E-CC05-493F-85E2-43D1006DF96A), helpstring("List of our Windows Interface"), dual, oleautomation ] interface Windows : IDispatch { [id(00000000), propget] HRESULT Item( [in] unsigned long Index, [out, retval] Window** Item); [id(0x00000001), propget] HRESULT Count([out, retval] unsigned long* Count); [id(0xfffffffc), propget] HRESULT _NewEnum([out, retval] IUnknown** _NewEnum); [id(0x00000003), propget] HRESULT CurrentWindow([out, retval] Window** ppCurrentWindow); }; [ odl, uuid(8E8304B8-CBD1-44F8-B0E8-89C625B2002E), helpstring("Window Interface"), dual, oleautomation ] interface Window : IDispatch { [id(00000000), propget] HRESULT WindowHandle([out, retval] uint64* pHWNDWindow); [id(0x00000001), propget] HRESULT CurrentPageId([out, retval] BSTR* pbstrPageObjectId); [id(0x00000002), propget] HRESULT CurrentSectionId([out, retval] BSTR* pbstrSectionObjectId); [id(0x00000003), propget] HRESULT CurrentSectionGroupId([out, retval] BSTR* pbstrSectionObjectId); [id(0x00000004), propget] HRESULT CurrentNotebookId([out, retval] BSTR* pbstrNotebookObjectId); [id(0x00000009)] HRESULT NavigateTo( [in] BSTR bstrHierarchyObjectID, [in, optional, defaultvalue("0")] BSTR bstrObjectID); [id(0x0000000a), propget] HRESULT FullPageView([out, retval] VARIANT_BOOL* pIsFullPageView); [id(0x0000000a), propput] HRESULT FullPageView(VARIANT_BOOL pIsFullPageView); [id(0x0000000b), propget] HRESULT Active([out, retval] VARIANT_BOOL* pIsActive); [id(0x0000000b), propput] HRESULT Active(VARIANT_BOOL pIsActive); [id(0x0000000d), propget] HRESULT DockedLocation([out, retval] DockLocation* pDockLocation); [id(0x0000000d), propput] HRESULT DockedLocation(DockLocation pDockLocation); [id(0x0000000e), propget] HRESULT Application([out, retval] IApplication** ppiApp); [id(0x0000000f), propget] HRESULT SideNote([out, retval] VARIANT_BOOL* pIsSideNote); [id(0x00000010)] HRESULT NavigateToUrl([in] BSTR bstrUrl); [id(0x00000011)] HRESULT SetDockedLocation( [in] DockLocation DockLocation, [in] tagPOINT ptMonitor); }; [ uuid(E2E1511D-502D-4BD0-8B3A-8A89A05CDCAE), helpstring("IOneNoteEvents Interface"), nonextensible ] dispinterface IOneNoteEvents { properties: methods: [id(0x00000001)] void OnNavigate(); [id(0x00000002)] void OnHierarchyChange([in] BSTR bstrActivePageID); }; [ uuid(D7FAC39E-7FF1-49AA-98CF-A1DDD316337E), version(1.0), helpstring("Application Class") ] coclass Application { [default] interface IApplication; [default, source] dispinterface IOneNoteEvents; }; typedef [uuid(D3F5A756-4BAC-4D3D-9BAF-90935121AAA6)] enum { hrMalformedXML = 0x80042000, hrInvalidXML = 0x80042001, hrCreatingSection = 0x80042002, hrOpeningSection = 0x80042003, hrSectionDoesNotExist = 0x80042004, hrPageDoesNotExist = 0x80042005, hrFileDoesNotExist = 0x80042006, hrInsertingImage = 0x80042007, hrInsertingInk = 0x80042008, hrInsertingHtml = 0x80042009, hrNavigatingToPage = 0x8004200a, hrSectionReadOnly = 0x8004200b, hrPageReadOnly = 0x8004200c, hrInsertingOutlineText = 0x8004200d, hrPageObjectDoesNotExist = 0x8004200e, hrBinaryObjectDoesNotExist = 0x8004200f, hrLastModifiedDateDidNotMatch = 0x80042010, hrGroupDoesNotExist = 0x80042011, hrPageDoesNotExistInGroup = 0x80042012, hrNoActiveSelection = 0x80042013, hrObjectDoesNotExist = 0x80042014, hrNotebookDoesNotExist = 0x80042015, hrInsertingFile = 0x80042016, hrInvalidName = 0x80042017, hrFolderDoesNotExist = 0x80042018, hrInvalidQuery = 0x80042019, hrFileAlreadyExists = 0x8004201a, hrSectionEncryptedAndLocked = 0x8004201b, hrDisabledByPolicy = 0x8004201c, hrNotYetSynchronized = 0x8004201d, hrLegacySection = 0x8004201e, hrMergeFailed = 0x8004201f, hrInvalidXMLSchema = 0x80042020, hrFutureContentLoss = 0x80042022, hrTimeOut = 0x80042023, hrRecordingInProgress = 0x80042024, hrUnknownLinkedNoteState = 0x80042025, hrNoShortNameForLinkedNote = 0x80042026, hrNoFriendlyNameForLinkedNote = 0x80042027, hrInvalidLinkedNoteUri = 0x80042028, hrInvalidLinkedNoteThumbnail = 0x80042029, hrImportLNTThumbnailFailed = 0x8004202a, hrUnreadDisabledForNotebook = 0x8004202b, hrInvalidSelection = 0x8004202c, hrConvertFailed = 0x8004202d, hrRecycleBinEditFailed = 0x8004202e, hrAppInModalUI = 0x80042030 } Error; [ uuid(DC67E480-C3CB-49F8-8232-60B0C2056C8E), version(1.0), helpstring("Application2 Class") ] coclass Application2 { [default] interface IApplication; [default, source] dispinterface IOneNoteEvents; }; }; So far, I didn't manage to be able to interact with it : There is my code (based on same issue someone had in 2011 #AutoIt3Wrapper_UseX64=n #include <Array.au3> #include "AutoItObject\AutoItObject.au3" ;=============================================================================== ;interface "OneNoteIApplication" Global Const $sCLSID_OneNoteApplication = "{0039FFEC-A022-4232-8274-6B34787BFC27}" Global Const $sIID_IOneNoteApplication = "{2DA16203-3F58-404F-839D-E4CDE7DD0DED}" ; Definition Global $dtagIOneNoteWindows = $dtagIDispatch Global $dtagIOneNoteApplication = $dtagIDispatch & _ "GetHierarchy hresult(bstr;dword;bstr*);" & _ "UpdateHierarchy hresult(bstr);" & _ "OpenHierarchy hresult(bstr;bstr;bstr*;dword);" & _ "DeleteHierarchy hresult(bstr;double);" & _ "CreateNewPage hresult(bstr;bstr*;dword);" & _ "CloseNotebook hresult(bstr);" & _ "GetHierarchyParent hresult(bstr;bstr*);" & _ "GetPageContent hresult(bstr;bstr*;dword);" & _ "UpdatePageContent hresult(bstr;double);" & _ "GetBinaryPageContent hresult(bstr;bstr;bstr*);" & _ "DeletePageContent hresult(bstr;bstr;dword);" & _ "NavigateTo hresult(bstr;bstr;bool);" & _ "Publish hresult(bstr;bstr;dword;bstr);" & _ "OpenPackage hresult(bstr;bstr;bstr*);" & _ "GetHyperlinkToObject hresult(bstr;bstr;bstr*);" & _ "FindPages hresult(bstr;bstr;bstr*;bool;bool);" & _ "FindMeta hresult(bstr;bstr;bstr*;bool);" & _ "GetSpecialLocation hresult(dword;bstr*);" ; List Global $ltagIOneNoteApplication = $ltagIDispatch & _ "GetHierarchy;" & _ "UpdateHierarchy;" & _ "OpenHierarchy;" & _ "DeleteHierarchy;" & _ "CreateNewPage;" & _ "CloseNotebook;" & _ "GetHierarchyParent;" & _ "GetPageContent;" & _ "UpdatePageContent;" & _ "GetBinaryPageContent;" & _ "DeletePageContent;" & _ "NavigateTo;" & _ "Publish;" & _ "OpenPackage;" & _ "GetHyperlinkToObject;" & _ "FindPages;" & _ "FindMeta;" & _ "GetSpecialLocation;" ;=============================================================================== _AutoItObject_StartUp() Global $objOneNote = ObjCreate("OneNote.Application") Global $pOneNote = _AutoItObject_IDispatchToPtr($objOneNote) _AutoItObject_IUnknownAddRef($objOneNote) Global $oOneNote = _AutoItObject_WrapperCreate($pOneNote, $dtagIOneNoteWindows) ;~ Global $oOnenote = ObjCreateInterface($sCLSID_OneNoteApplication,$sIID_IOneNoteApplication,$dtagIOneNoteApplication,True) ;~ ; Check if object is created: If Not IsObj($oOneNote) Then MsgBox(48, "Error", "Object not created. Something is wrong.") Exit EndIf $aCall = $oOneNote.GetTypeInfoCount(0) $iTypeInfoCount = $aCall[1] ConsoleWrite("$iTypeInfoCount = " & $iTypeInfoCount & @CRLF) $Window = $oOneNote.Windows ;~ ConsoleWrite("Test = " & $Window.CurrentPageId & @CRLF) $str = "onenote:///R:\Software\OneNote%20EOD\EOD%20Scrum\Sprint%20136.one#section-id={D2EB7AEB-362B-490A-9CE0-0B9316DF0DAD}&end" $hBSTR = DllCall("oleaut32.dll", "ptr", "SysAllocString", "wstr", $str) $aCall = $oOnenote.NavigateToUrl($hBSTR[0]) Can someone help me to go in the good direction? I'm a little lost with what's needed, (CLSID and IID whereas I have only a UUID and can't find a good starting doc online) Thanks a lot,
-
Problem accessing COM interface via DllCall()
timmalos replied to Rainer2's topic in AutoIt General Help and Support
Hey guys. I run into the exact same issue , so I update a little this topic in any case situation has changed since this time. I tried with the new ObjCreateInterface without having more success. _AutoItObject_StartUp() ;~ Global $oOnenote = ObjCreateInterface($sCLSID_OneNoteApplication,$sIID_IOneNoteApplication,$dtagIOneNoteApplication,True) Global $objOneNote = ObjCreate("Onenote.Application") Global $pOneNote = _AutoItObject_IDispatchToPtr($objOneNote) _AutoItObject_IUnknownAddRef($objOneNote) Global $oOneNote = _AutoItObject_WrapperCreate($pOneNote, $dtagIOneNoteApplication) ; Check if object is created: If Not IsObj($oOneNote) Then MsgBox(48, "Error", "Object not created. Something is wrong.") Exit EndIf $aCall = $oOneNote.GetTypeInfoCount(0) $iTypeInfoCount = $aCall[1] ConsoleWrite("$iTypeInfoCount = " & $iTypeInfoCount & @CRLF) This works well. ($iTypeInfoCount = 1) However, Issue is : how to be able to retrieve (and send) BSTR in this situation? Meaning, how to get this code work without Autoit crashing ? $aCall = $oOneNote.GetHierarchy("", 3, "") ;$sHierarchy = $aCall[3] ;ConsoleWrite("Hierarchy = " & $sHierarchy & @CRLF) -
Hello all. In case this is interesting few of you, I share my AMCP 2.1 protocol UDF in AutoIT. This protocol is used by CasparCG server, which is a Windows and Linux software used to play out professional graphics, audio and video to multiple outputs as a layerbased real-time compositor. It has been in 24/7 broadcast production since 2006. It's free and opensource. The UDF I share allows communication between an AutoIt based client and the CasparCG, based on following documentation : http://casparcg.com/wiki/CasparCG_2.1_AMCP_Protocol If you want more details on CasparCG : official WebSite or have a look to this video I'm currently building a full Client based on AutoIt, with many features like drag-and-drop layers, but sadly I can't share it right now, might come later. Don't hesitate to ask questions if you have any or need a basic example. The only requirement for this UDF is the other Event-driven TCP UDF by Kip AMCP_shared.au3 TCP.au3
-
Create Menu Item from right corner instead of left
timmalos replied to timmalos's topic in AutoIt GUI Help and Support
Found the way to do it _GUICtrlMenu_SetItemType(_GUICtrlMenu_GetMenu($hYourGUI), 1, $MFT_RIGHTJUSTIFY) -
Hey all. I don't know if this is doable, but I would like to be able to create one of my menu items from the right corner instead of the left one. For example in this attached screenshot (http://imgur.com/a/AX3X0) I would like to put a new Item right-aligned (in yellow on the screenshot) instead of just after Help menu. Is there any way? Thanks a lot,
-
[SOLVED] GDI+ graphics and Clicks
timmalos replied to timmalos's topic in AutoIt General Help and Support
Hey all. Managed to find a solution with the right keyword : "z-order". This makes the trick : GUICtrlSetState(-1, $GUI_ONTOP) EDIT : Just saw InunoTaishou answer which works well without needing the text controls, I'll use your solution , thanks ! -
Hey all. I'm trying to know when my user clicks on a Rect drawn via GDI+. Everything is almost working except I have a strange behaviour in the "order" clicks are fired. I created a simplified code to help : #include <GDIPlus.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <StaticConstants.au3> #include <WinAPI.au3> #include <Array.au3> Opt("GUIOnEventMode", 1) ;0=disabled, 1=OnEvent mode enabled _GDIPlus_Startup() Global $hGUI, $hGraphics Global $iWidth = 1024, $iHeight = 762 createGUI() draw() While 1 Sleep(10) WEnd Func createGUI() $hGUI = GUICreate("Current CasparCG Output", $iWidth,$iHeight) GUISetOnEvent($GUI_EVENT_CLOSE, "SpecialEvents") GUISetBkColor(0x000000) GUISetState(@SW_SHOW) $hGraphics = _GDIPlus_GraphicsCreateFromHWND($hGUI) _GDIPlus_GraphicsSetSmoothingMode($hGraphics, $GDIP_SMOOTHINGMODE_HIGHQUALITY) ;sets the graphics object rendering quality (antialiasing) EndFunc ;==>Example Func draw() ;_WinAPI_draw($hGUI,"","",BitOR($RDW_ERASE,$RDW_INVALIDATE,$RDW_UPDATENOW)) _GDIPlus_GraphicsClear($hGraphics) $hFamily = _GDIPlus_FontFamilyCreate("Arial") $hFont = _GDIPlus_FontCreate($hFamily, 15, 1) $hPen = _GDIPlus_PenCreate(0xFFFEDCFF, 2) ;color format AARRGGBB (hex) $hFormat = _GDIPlus_StringFormatCreate() _GDIPlus_StringFormatSetAlign($hFormat, 1) _GDIPlus_StringFormatSetLineAlign($hFormat, 1) $hBrushString = _GDIPlus_BrushCreateSolid(0xFFFFFFFF) Local $hBrush = _GDIPlus_BrushCreateSolid(0xFFFF00FF) ;color format AARRGGBB (hex) For $i = 1 to 2 Local $x = 0.25 Local $y = 0.25 Local $w = 0.5 Local $h = 0.5 Local $title = "Layer "&$i If $x >= -1 And $x <= 1 Then $x *= $iWidth If $y >= -1 And $y <= 1 Then $y *= $iHeight If $w >= -1 And $w <= 1 Then $w *= $iWidth If $h >= -1 And $h <= 1 Then $h *= $iHeight $hItem = GUICtrlCreateLabel("", $x,$y,$w,$h) GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT) GUICtrlSetOnEvent($hItem,"_gui_layer_clicked") ConsoleWrite("Created label with handle="&$hItem&" $i= " & $i&@CRLF) _GDIPlus_GraphicsFillRect($hGraphics, $x, $y, $w, $h,$hBrush) _GDIPlus_GraphicsDrawRect($hGraphics, $x, $y, $w, $h,$hPen) $tLayout = _GDIPlus_RectFCreate($x, $y, $w, $h) $aInfo = _GDIPlus_GraphicsMeasureString($hGraphics, $title, $hFont, $tLayout, $hFormat) _GDIPlus_GraphicsDrawStringEx($hGraphics, $title, $hFont, $aInfo[0], $hFormat, $hBrushString) Next _GDIPlus_BrushDispose($hBrush) _GDIPlus_PenDispose($hPen) _GDIPlus_FontDispose($hFont) _GDIPlus_StringFormatDispose($hFormat) _GDIPlus_FontFamilyDispose($hFamily) _GDIPlus_BrushDispose($hBrushString) Return 1 EndFunc Func _gui_layer_clicked() ConsoleWrite("Clicked on " & @GUI_CtrlId&@CRLF) EndFunc Func SpecialEvents() Select Case @GUI_CtrlId = $GUI_EVENT_CLOSE ; Clean up resources _GDIPlus_GraphicsDispose($hGraphics) _GDIPlus_Shutdown() Exit EndSelect EndFunc ;==>SpecialEvents What happens there : We have two rectangles, with the one labelled "2" is front and, the one labelled "1" in background. However when we click, the fired label is the one created first (in the background) and not the second one (in the front). Is it normal ? If yes, is there any way to change this order ? If I create another label after a first one on the same coords, I would the second one to be fired instead of the first one (This is a simplified code I can't just invert the label order creation easily) Thanks for your help
-
Hello all . i'm trying to build a tool to generate some pictures/graphs automatically based on some variables. I have completed the first part and I'm struggling now on what I thought would be the easiest part : In my tool there is a "preview" button, which helps to display on a new children GUI the generated picture. What I do in simplified : Global $g_hGraphics = _GDIPlus_GraphicsCreateFromHWND($g_hGUI) ;Then, I'll add multiple objects to this graphic, for example $Temp = _GDIPlus_ImageLoadFromFile($temp[1]) _GDIPlus_GraphicsDrawImage($g_hGraphics,$temp) I'm then able to have a preview GUI showing all my elements perfectly. This works but now I want to be able to really generate it and have a ".png" file written to disk. What I tried without success: $g_hBitmap = _GDIPlus_BitmapCreateFromGraphics($previewWidth, $previewHeight, $g_hGraphics) _GDIPlus_ImageSaveToFile($g_hBitmap,$OUTPUTDIR & "\generated\test-"&@HOUR&@MIN&@SEC&".png") But what I write to file is a transparent PNG without anything. I'm pretty sure I'm missing something obvious there, I need your help NB : If this change your answer, my goal will be to generate transparent png, meaning I'll add multiple objects/pictures/texts on a transparent png background and if there are some "transparent holes" I need them to be transparent in the generated png. Thanks a lot for any help ! Tim
-
Hello all. I'm trying to do something simple, but I can't manage to find where to start since I can have multiple possibilities and not sure what is the best one : Taking screen capture (I can do that) On this capture, I'll look for 10 particular regions that will give me 10 images of 40px * 40px (I can do that) Then what I want is for each of these regions, find on my library of ~140 images which one is the closest one to my region (= the match) What do you think is the best approach ? Ican easily do step 1 and 2, however for the third step : I can't use memcmp because they won't be exactly the same (original library can differ a very little bit from what I'll get from my screen capture) There is no text, only drawing Should I do a pixelSum of what I get on screen and do the same via GDIPlus for each of my images in the library? Thanks a lot, Tim
-
Pin my program to Windows 8 TaskBar
timmalos replied to timmalos's topic in AutoIt General Help and Support
Well, I kinda disagree with you on the "stupid thing" since at work most of us have a networked drive they use to access shared storage with some programs etc... Yes the drive letter can change (and yet I'm more subject to have my local disk dead than losing this networked drive on a SAN) and in this case it won't run, but you can delete a program in your local C:\ drive and it won't run either I don't see why Windows set this limitation. Anyway thanks for the tip with a random program, makes the work for me ! -
Pin my program to Windows 8 TaskBar
timmalos replied to timmalos's topic in AutoIt General Help and Support
I may have found my issue, maybe not related to AutoIt I have to do more tests. This program is located on a network drive R:\. If I copy it to my Desktop for example I can see the Pin option. So might be a Windows related issue with network drives. I'll try to find another way. Anyway thanks guys for your help. -
Pin my program to Windows 8 TaskBar
timmalos replied to timmalos's topic in AutoIt General Help and Support
Fixed title sorry for the typo. It's not an au3 file since it's compiled. I'm speaking of my .exe executable program. Included a screenshot so that you can see I don't have any Pin option, only the Exit button. Am I the only one to have this issue on WIndows 8.1? -
Hello guys. I have a little issue and I can't find any answer sadly so I'm opening this post. I created a tool with AutoIt, but sadly on Windows 8.1 I can't pin it to my taskbar, I have no idea why. If I take any other program for example Firefox, when it's started and I do a right click on the icon in the taskbar I can have a nice menu and just below "Exit window" I have an option "Pin this program to the TaskBar" (or Unpin if already clicked), but with my AutoIt script (compiled) I have only the Exit button. Do you know if there is a Windows option to add to GuiCtrlCreateGui() or anything I can do to be able to pin my program to the windows 8.1 taskbar? Thank you very much, Tim
-
GuiCreate on previous position
timmalos replied to timmalos's topic in AutoIt General Help and Support
Ok I 'll look in this direction cause I would like my app to stay portable and simple -
GuiCreate on previous position
timmalos replied to timmalos's topic in AutoIt General Help and Support
Okay, so there is no way to use the Microsoft history cache as some other windows do I guess? (From CCleaner for example I can delete this cache and all windows lose their saved position) -
Hey guys. I think I make a mistake somewhere but I got a trouble. I have multiple screens and I would like my window created with GuiCreate to Re-open where I closed it previously. Right now, the windows is always opened on my main screen and not where I moved it the previous time I executed it. I would like to use the history 's position of windows like any other window. $Form1 = GUICreate("Filter LDAP Creator", 362, 685,-1,-1,BitOR($GUI_SS_DEFAULT_GUI, $WS_OVERLAPPEDWINDOW),$WS_EX_APPWINDOW) Is that possible ? Thanks !