Leaderboard
Popular Content
Showing content with the highest reputation on 03/17/2022 in all areas
-
Uploaded a new version of the SciTE4AutoIt3.exe v21.316.1639.1
argumentum and one other reacted to Jos for a topic
Think I found that one... try current Beta. ps: Also disables the EXPAND keywords lexer option for keywords that are in the ABBREVIATIONS table and exits in a Directive line. EDIT2: I broke the EXPAND...stay tuned. Fixed2 points -
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.au31 point
-
What's New in Version v1.1.4 Corrected _HTTPAPI_HttpSendHttpResponse function header. Added the ability for _HTTPAPI_HttpSendHttpResponse() to recognize and process a redirect response. This is achieved by setting $iStatusCode to 301 or 302 and setting $sReason to the target location URL. ( @mrwilly, thanks for the suggestion ) Added a redirect example to the example script.1 point
-
Uploaded a new version of the SciTE4AutoIt3.exe v21.316.1639.1
argumentum reacted to Jos for a topic
Finally got something working that I had on my Wishlist for a while: dynamically add any defined FUNC name in the current script to the au3.keywords.user.udfs list for the period the file is being edited. I had to make a minor change to SciTE to allow me to do the "reloadproperties:" director command from lua after adding the list of available FUNCs. The list will be refreshed each time you change FileTab/Save the File/Open a File. To play with this you need tp update your SciTE.exe and AutoItTools.lua from the Beta directory.1 point -
@Nine 2022-04-08 EDIT: Please use: https://github.com/Danp2/au3WebDriver/archive/refs/heads/master.zip with this example: #include "wd_helper.au3" #include "wd_capabilities.au3" # HOW TO TEST: ; At first run choose [Yes] to create new session Chrome running instance ; At second run choose [No] to attach to active Chrome running instance # TODO: ; https://github.com/operasoftware/operachromiumdriver/blob/master/docs/desktop.md --remote-debugging-port=port Global $_MY__WD_SESSION Global $__g_sDownloadDir = "" _Test() Exit Func _Test() Local $iAnswer = MsgBox($MB_YESNO + $MB_TOPMOST + $MB_ICONQUESTION + $MB_DEFBUTTON2, "Question", _ "Open new sesion ?" & @CRLF & "[ NO ] = Try attach to active Chrome instance") If $iAnswer = $IDYES Then _Testing_CreateSession() Return ; do not process next functions Else _Testing_AttachSession() _WD_Navigate($_MY__WD_SESSION, 'https://www.google.com/') EndIf $iAnswer = MsgBox($MB_YESNO + $MB_TOPMOST + $MB_ICONQUESTION + $MB_DEFBUTTON2, "Question", _ "Do you want to test ?" & @CRLF & "[ NO ] = Refresh - prevent expiration") If $iAnswer = $IDYES Then _Testing_WD_Navigate() Else _Testing_Refreshing() EndIf ; CleanUp _WD_DeleteSession($_MY__WD_SESSION) _WD_Shutdown() EndFunc ;==>_Test Func _Testing_CreateSession() $_MY__WD_SESSION = _MY__WD_SetupChrome(False, $__g_sDownloadDir, False) EndFunc ;==>_Testing_CreateSession Func _Testing_AttachSession() $_MY__WD_SESSION = _MY__WD_SetupChrome(False, $__g_sDownloadDir, True) EndFunc ;==>_Testing_AttachSession Func _Testing_Refreshing() While 1 ;~ _WD_Navigate($_MY__WD_SESSION, '') _WD_Action($_MY__WD_SESSION, 'REFRESH') Local $iAnswer = MsgBox($MB_YESNO + $MB_TOPMOST + $MB_ICONQUESTION + $MB_DEFBUTTON2, "Question", "Finish refreshing?" & @CRLF & "[No] = Refresh - prevent expiration", 60) If $iAnswer = $IDYES Then Return WEnd EndFunc ;==>_Testing_Refreshing Func _Testing_WD_Navigate() _WD_Navigate($_MY__WD_SESSION, 'https://www.autoitscript.com/forum') EndFunc ;==>_Testing_WD_Navigate Func _MY__WD_SetupChrome($b_Headless, $s_Download_dir = Default, $bTryAttach = False) If $s_Download_dir = Default Then $s_Download_dir = '' ElseIf $s_Download_dir Then If FileExists($s_Download_dir) = 0 Then $s_Download_dir = '' EndIf _WD_UpdateDriver('chrome') If @error Then Return SetError(@error, @extended, '') _WD_Option('Driver', 'chromedriver.exe') _WD_Option('Port', 9515) _WD_CapabilitiesStartup() Local $s_AttachOption = (($bTryAttach) ? ("") : (" --remote-debugging-port=9222")) _WD_Option('DriverParams', '--log trace' & $s_AttachOption) _WD_CapabilitiesAdd('firstMatch', 'chrome') _WD_CapabilitiesAdd('goog:chromeOptions', 'w3c', True) If $bTryAttach Then _ _WD_CapabilitiesAdd('goog:chromeOptions', 'debuggerAddress', 'localhost:9222') If $b_Headless Then _ _WD_CapabilitiesAdd('args', '--headless') If $s_Download_dir Then _ _WD_CapabilitiesAdd('prefs', 'download.default_directory', $s_Download_dir) _WD_CapabilitiesDump(@ScriptLineNumber & ' :WebDriver:Capabilities:') _WD_Startup() If @error Then Return SetError(@error, @extended, '') Local $s_Capabilities = _WD_CapabilitiesGet() Local $WD_SESSION = _WD_CreateSession($s_Capabilities) Return SetError(@error, @extended, $WD_SESSION) EndFunc ;==>_MY__WD_SetupChrome It produce: { "capabilities":{ "firstMatch":[ { "goog:chromeOptions":{ "w3c":true, "debuggerAddress":"localhost:9222" } } ] } } But I get: Maybe you will be able to find out what I missed. Thank you in advance. mLipok1 point
-
it turned out, that the option "--remote-debugging-address" can only be used for the headless mode ("--headless") and is intended to be used for tests when the browser runs in a docker container and not for remote debugging. Nah. Not true, I am running without --headless and it is working just fine.1 point
-
@mLipok end result working is : '{"capabilities": {"alwaysMatch": {"goog:chromeOptions": {"w3c": true, "debuggerAddress": "localhost:9222"}}}}'1 point
-
@mLipok, Been thinking a little about your other idea and tested with resetting the LEXER to DEFAULT after it encounters an '=' on a #PreProsessor/#Special keyword and this is the result: So basically the lexer is reset and it will try to lex what it finds. As you can see it will also recognize internal functions and UDFs and color them accordingly. Even a #cs & #ce will be colored without it having consequences for the rest of the code since it is not the first directive on the line. Not sure whether it will break anything else yet, so give it a try.1 point
-
I actually made the change in au3stripper as that is more consistent the the directive can contain multiple func names. API and properties are also updated in Beta.1 point
-
AutoIt v3.3.16.0 has been released. Thanks to @jpm and the MVPs who were responsible for the majority of code in this version. Download it here. Complete list of changes: History1 point
-
Try this: #include <GDIPlus.au3> #include <GUIConstantsEx.au3> #include <GuiRichEdit.au3> #include <WindowsConstants.au3> Example() Func Example() Local $hGui, $iMsg, $idBtnExit, $hRichEdit $hGui = GUICreate("Example (" & StringTrimRight(@ScriptName, StringLen(".exe")) & ")", 520, 550, -1, -1) $hRichEdit = _GUICtrlRichEdit_Create($hGui, "This is a test.", 10, 10, 500, 490, _ BitOR($ES_MULTILINE, $WS_VSCROLL, $ES_AUTOVSCROLL)) $idBtnExit = GUICtrlCreateButton("Exit", 10, 510, 40, 30) GUISetState(@SW_SHOW) _GUICtrlRichEdit_InsertText($hRichEdit, "Inserting image..." & @LF & @LF) _GUICtrlRichEdit_InsertText($hRichEdit, @LF & "JPG image scaled:" & @LF & @LF) _GUICtrlRichEdit_InsertBitmap($hRichEdit, "c:\Program Files (x86)\AutoIt3\Examples\GUI\mslogo.jpg", "\qc", "\picw6747\pich1058\picwgoal6690\pichgoal1860\") ;\qc = centered _GUICtrlRichEdit_InsertText($hRichEdit, @LF & @LF & "PNG image:" & @LF & @LF) _GUICtrlRichEdit_InsertBitmap($hRichEdit, "c:\Program Files (x86)\AutoIt3\Examples\GUI\Torus.png") _GUICtrlRichEdit_InsertText($hRichEdit, @LF & @LF & "Done.") While True Switch GUIGetMsg() Case $GUI_EVENT_CLOSE, $idBtnExit _GUICtrlRichEdit_Destroy($hRichEdit) ; needed unless script crashes GUIDelete() Exit EndSwitch WEnd EndFunc ;==>Example Func _GUICtrlRichEdit_InsertBitmap($hWnd, $sFile, $sFormatFunctions = "\", $sBitmapFunctions = "\", $iBgColor = Default) ;coded by UEZ build 2016-02-16 If Not FileExists($sFile) Then Return SetError(0, 0, 1) If Not _WinAPI_IsClassName($hWnd, $__g_sRTFClassName) Then Return SetError(0, 0, 2) _GDIPlus_Startup() Local $hImage = _GDIPlus_ImageLoadFromFile($sFile) If @error Then _GDIPlus_Shutdown() Return SetError(0, 0, 3) EndIf Local Const $aDim = _GDIPlus_ImageGetDimension($hImage) Local Const $hBitmap = _GDIPlus_BitmapCreateFromScan0($aDim[0], $aDim[1]), $hGfx = _GDIPlus_ImageGetGraphicsContext($hBitmap) If $iBgColor = Default Then $iBgColor = 0xFF000000 + _WinAPI_SwitchColor(_GUICtrlRichEdit_GetBkColor($hWnd)) EndIf _GDIPlus_GraphicsClear($hGfx, $iBgColor) _GDIPlus_GraphicsDrawImageRect($hGfx, $hImage, 0, 0, $aDim[0], $aDim[1]) _GDIPlus_GraphicsDispose($hGfx) Local $binStream = _GDIPlus_StreamImage2BinaryString($hBitmap, "BMP") If @error Then _GDIPlus_ImageDispose($hImage) _GDIPlus_ImageDispose($hBitmap) _GDIPlus_Shutdown() Return SetError(0, 0, 4) EndIf Local $binBmp = StringMid($binStream, 31) Local Const $binRtf = "{\rtf1\viewkind4" & $sFormatFunctions & " {\pict{\*\picprop}" & $sBitmapFunctions & "dibitmap " & $binBmp & "}\par}" ;check out http://www.biblioscape.com/rtf15_spec.htm _GUICtrlRichEdit_AppendText($hWnd, $binRtf) $binStream = 0 $binBmp = 0 _GDIPlus_ImageDispose($hImage) _GDIPlus_ImageDispose($hBitmap) _GDIPlus_Shutdown() Return 1 EndFunc ;==>_GUICtrlRichEdit_InsertBitmap Func _GDIPlus_StreamImage2BinaryString($hBitmap, $sFormat = "JPG", $iQuality = 80, $bSave = False, $sFileName = @ScriptDir & "\Converted.jpg") ;coded by UEZ 2013 build 2014-01-25 (based on the code by Andreik) Local $sImgCLSID, $tGUID, $tParams, $tData Switch $sFormat Case "JPG" $sImgCLSID = _GDIPlus_EncodersGetCLSID($sFormat) $tGUID = _WinAPI_GUIDFromString($sImgCLSID) $tData = DllStructCreate("int Quality") DllStructSetData($tData, "Quality", $iQuality) ;quality 0-100 Local $pData = DllStructGetPtr($tData) $tParams = _GDIPlus_ParamInit(1) _GDIPlus_ParamAdd($tParams, $GDIP_EPGQUALITY, 1, $GDIP_EPTLONG, $pData) Case "PNG", "BMP", "GIF", "TIF" $sImgCLSID = _GDIPlus_EncodersGetCLSID($sFormat) $tGUID = _WinAPI_GUIDFromString($sImgCLSID) Case Else Return SetError(1, 0, 0) EndSwitch Local $hStream = _WinAPI_CreateStreamOnHGlobal() ;http://msdn.microsoft.com/en-us/library/ms864401.aspx If @error Then Return SetError(2, 0, 0) _GDIPlus_ImageSaveToStream($hBitmap, $hStream, DllStructGetPtr($tGUID), DllStructGetPtr($tParams)) If @error Then Return SetError(3, 0, 0) Local $hMemory = _WinAPI_GetHGlobalFromStream($hStream) ;http://msdn.microsoft.com/en-us/library/aa911736.aspx If @error Then Return SetError(4, 0, 0) Local $iMemSize = _MemGlobalSize($hMemory) If Not $iMemSize Then Return SetError(5, 0, 0) Local $pMem = _MemGlobalLock($hMemory) $tData = DllStructCreate("byte[" & $iMemSize & "]", $pMem) Local $bData = DllStructGetData($tData, 1) _WinAPI_ReleaseStream($hStream) ;http://msdn.microsoft.com/en-us/library/windows/desktop/ms221473(v=vs.85).aspx _MemGlobalFree($hMemory) If $bSave Then Local $hFile = FileOpen($sFileName, 18) If @error Then Return SetError(6, 0, $bData) FileWrite($hFile, $bData) FileClose($hFile) EndIf Return $bData EndFunc ;==>_GDIPlus_StreamImage2BinaryString Probably there is a much better solution...1 point