Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 07/10/2022 in all areas

  1. I got some failures when using curl without the -k and/or -A switches... For convenience I use a little UDF with curl 'read' and 'get' functions inside, and I need them to work in as many cases as possible Reason why I also use -o instead of -O (matter of versatility)
    1 point
  2. I've made changes today that the openpath properties aren't used anymore but rather read the appropriate registry key for the extra user include directories specified here: Keyname:"HKEY_CURRENT_USER\SOFTWARE\AutoIt v3\AutoIt" Valuename:"Include" Making config much easier and avoids any discrepancies. I am now going to look at making a cachefile per specified extra user include directory in stead of what I have now which is one for all, and storing that into the props["SciteUserHome"] making it also work in portable mode and when included into a Sourcefile by using the directive (I hope) ... needs some thinking & testing time.
    1 point
  3. @mikell just to let you know the minimal switches I just tried for a successful file download, using curl Local $url = "https://www.autoitscript.com/autoit3/scite/download/Au3Stripper.zip" Local $cmd = "C:\curl\curl.exe -O " & $url Local $iPID = Run($cmd, "", @SW_HIDE, 2) ; 2 = $STDOUT_CHILD ProcessWaitClose($iPID) Local $output = StdoutRead($iPID) The script downloads Au3Stripper.zip and saves it with the same name in the script folder because of the -O switch : -O, --remote-name Write output to a local file named like the remote file we get [...] But if we had to download this file : Local $url = "https://www.autoitscript.com/cgi-bin/getfile.pl?autoit3/autoit-v3.zip" Then it would download only a 1KB zip file (instead of 17Mb !) because of the missing switch -L . In this case, the proper syntax should be : Local $cmd = "C:\curl\curl.exe -O -L " & $url So it seems always good to include the -L switch (as you indicated), no matter the url : -L, --location (HTTP) If the server reports that the requested page has moved to a different location [...] this option will make curl redo the request on the new place. I avoided the -k (--insecure) switch after I read this in the help file : WARNING: using this option makes the transfer insecure. Without the -s/--silent switch, we can see nice progress lines in AutoIt console, great Finally, the -A/--user-agent <agent string> will certainly be useful depending on the site, but I just wanted to test the minimal mandatory switches needed for a successful download. Both versions of Curl did it : the old "curl_7_46_0_openssl_nghttp2_x86" I told you about, and the recent "curl-7.83.1_7-win32-mingw.zip" (may 2022) Also, as you guessed, I found the following info written on the official curl website : Microsoft ships curl too : curl is also shipped by Microsoft as part of Windows 10 and 11. You definitely knew all this but it's very new for me ! Have a great sunday and thanks for making us discover curl
    1 point
  4. Note that the WIMStruct is a file structure and as such cannot be handled as an AutoIt DllStruct. The reference to the WIMStruct file structure is a pointer. The code below is AutoIt code to obtain this pointer from the wimlib_create_new_wim() function. Also note that the DllCall() function returns an array (as opposed to a simple variable). The code here is 64 bit code: #AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 -w 7 #AutoIt3Wrapper_UseX64=Y Opt( "MustDeclareVars", 1 ) WimLib() Func WimLib() Local $hWimLib = DllOpen( "libwim-15-64.dll" ) If $hWimLib = -1 Then Return ConsoleWrite( "ERR: libwin-15-64.dll open" & @CRLF ) ConsoleWrite( "OK : libwin-15-64.dll open" & @CRLF ) Local $aRet, $tWIMStruct = DllStructCreate( "ptr" ) ; Pointer storage for WIMStruct pointer $aRet = DllCall( $hWimLib, "int:cdecl", "wimlib_create_new_wim", _ "int", 2, _ ; ctype "struct*", $tWIMStruct ) ; Store WIMStruct pointer If $aRet[0] Or @error Then Return ConsoleWrite( "ERR: wimlib_create_new_wim" & @CRLF & _ "$aRet[0] = " & $aRet[0] & @CRLF & _ "@error = " & @error & @CRLF ) ConsoleWrite( "OK : wimlib_create_new_wim" & @CRLF ) Local $pWIMStruct = DllStructGetData( $tWIMStruct, 1 ) ; Get WIMStruct pointer from storage ConsoleWrite( "$pWIMStruct = " & $pWIMStruct & @CRLF ) $hWimLib = 0 EndFunc Output: OK : libwin-15-64.dll open OK : wimlib_create_new_wim $pWIMStruct = 0x0000000000909530
    1 point
  5. Hi @kurtykurtyboy You are welcome Feedback always helps me know where to focus my efforts on a project So the most direct approach to your goal is not possible. AutoIt3 only accepts user functions with it's event functions. I tried setting a getter on the main object and giving the object itself as the second argument to GUICtrlSetOnEvent, to no avail. I did find a workaround though, let me know what you think #include "AutoItObject_Internal.au3" #include <GUIConstantsEx.au3> #include <WinAPISysWin.au3> Opt("GUIOnEventMode", 1) Global $hGUI = GUICreate("MyGUI", 400, 350, 763, 317) GUISetOnEvent($GUI_EVENT_CLOSE, "_onExitMain") Global $Button_1 = _objButton("Button 1", 140, 100, 91, 41) ;~ GUICtrlSetOnEvent($Button_1.hwnd, _button1ClickEvent) _main() Func _main() GUISetState(@SW_SHOWNORMAL) While 1 Sleep(100) WEnd EndFunc ;==>_main ;'traditional' event function Func _button1ClickEvent() $Button_1.click() EndFunc Func _onExitMain() $Button_1 = 0 GUIDelete() Exit EndFunc ;==>_onExitMain Func _objButton($sCaption, $iLeft, $iTop, $iWidth, $iHeight) Local $oIDispatch = IDispatch() $oIDispatch.caption = $sCaption $oIDispatch.hwnd = GUICtrlCreateButton($sCaption, $iLeft, $iTop, $iWidth, $iHeight) ConsoleWrite($oIDispatch.hwnd&@CRLF) ;$oIDispatch.__defineGetter("click", _objButton_click) GUICtrlSetOnEvent($oIDispatch.hwnd, _objButton_click2) _WinAPI_SetProp(GUICtrlGetHandle($oIDispatch.hwnd), "IDispatch", Ptr($oIDispatch)) Return $oIDispatch EndFunc ;event function built into the button object Func _objButton_click($oSelf) ConsoleWrite("Click Caption: " & $oSelf.parent.caption & @CRLF) EndFunc ;event function for the button object Func _objButton_click2() $pIDispatch = _WinAPI_GetProp(@GUI_CtrlHandle, "IDispatch"); Retrive IDispatch pointer If $pIDispatch = 0 Then Return; Pointer not available, return from function Local $oIDispatch = ObjCreateInterface($pIDispatch, $__AOI_IID_IDispatch, Default, True); Convert pointer back to object __AOI_AddRef($pIDispatch);When using ObjCreateInterface multiple times on the same ptr, AutoIt3 seems to not AddRef +1 (or it may be a bug in AutoItObject_Internal) ConsoleWrite("Click Caption: " & $oIDispatch.caption & @CRLF) EndFunc ;From https://www.autoitscript.com/forum/topic/207492-help-needed-image-viewer-with-zoom-and-translate/ Func _WinAPI_SetProp($hWnd, $sProp, $pData) Return DllCall("user32.dll", "bool", "SetPropW", "hwnd", $hWnd, "wstr", $sProp, "ptr", $pData)[0] EndFunc ;From https://www.autoitscript.com/forum/topic/207492-help-needed-image-viewer-with-zoom-and-translate/ Func _WinAPI_GetProp($hWnd, $sProp) Return DllCall("user32.dll", "ptr", "GetPropW", "hwnd", $hWnd, "wstr", $sProp)[0] EndFunc I did originally try to use _WinAPI_SetWindowLong with $GWL_USERDATA, but it seems AutoIt3 uses that itself 😡 edit: you COULD call $oIDispatch.click() within _objButton_click2, if you want custom functions associated with the click getter.
    1 point
  6. 1 point
  7. ... and I want people to refrain from joining and posting this shit in a forum that has nothing to do with it !
    1 point
×
×
  • Create New...