Leaderboard
Popular Content
Showing content with the highest reputation on 01/12/2022 in all areas
-
Hello guys. I recently saw some posts that Windows 10 provides OCR API. So I decided to create a UDF. What's UWPOCR? UWPOCR UDF is a simple library to use Universal Windows Platform Optical character recognition API. Features. Get Text From Image File. Get Text From GDI+ Bitmap. Easy to use. Usage: #include "..\UWPOCR.au3" _Example() Func _Example() Local $sOCRTextResult = _UWPOCR_GetText(FileOpenDialog("Select Image", @ScriptDir & "\", "Images (*.jpg;*.bmp;*.png;*.tif;*.gif)")) MsgBox(0,"",$sOCRTextResult) EndFunc Get Words Rect(Example): More examples here. Check UWPOCR UDF on GitHub. Saludos3 points
-
You may want to try setting $bSaveChanges and $bForceClose to True like this : Excel_Close($oWorkbook, True, True)1 point
-
_Excel_BookOpen is likely failing to open the workbook. You should check the value of @error immediately after calling this function to see why it is failing.1 point
-
Thanks @KaFu I forgot to add that example. Saludos1 point
-
Check available languages with _ArrayDisplay(_UWPOCR_GetSupportedLanguages()) Install additional language packs like described here: https://support.microsoft.com/en-us/windows/language-packs-for-windows-a5094319-a92d-18de-5b53-1cfc697cfca8 Select language codes as displayed in above mentioned check: e.g. : Local $sOCRTextResult = _UWPOCR_GetText($sImageFilePath,"de-DE",True)1 point
-
FileExists (@AppDataDir & "\Microsoft\Word\Startup\Normal.dotm")1 point
-
Have a look at junkew's IUIAutomation UDF or Danp2's WebDriver UDF.1 point
-
I'm looking for an opinion on a specific scenario. (easy)
markyrocks reacted to argumentum for a topic
All values are expected to be sorted. Those of blank should be sorted too. The option to add those blank to the end or the beginning, is something that I would find useful.1 point -
Sort question in C++
Danyfirex reacted to pixelsearch for a topic
My journey through C++ I just "created" a very short script in C++ for sorting a structure of integers, then compiled it into a dll and called it from AutoIt. Markyrocks did that in another thread a few days ago but I wanted to try all this by myself. Here is the result : C++ code is 1 file only, named "main.cpp", here is its content : #include <stdlib.h> /* qsort */ int comp (const void* x, const void* y) { return *(int*)x - *(int*)y; } extern "C" void __declspec(dllexport) my_sort(int* my_struct, int nb_elem) { qsort(my_struct, nb_elem, sizeof(int), comp); } AutoIt code for testing : #include <WinAPIDiag.au3> $iNb_elem = 10000 ; change this value for testing less or more elements $hDLL = DllOpen(@ScriptDir & "\Structure 03.dll") If $hDLL = -1 Then Exit Msgbox(0, "DllOpen", "error occured") _SplashOn("Filling structure") $tStruct = DllStructCreate("int arr[" & $iNb_elem & "]") For $i = 1 To $iNb_elem $tStruct.arr(($i)) = Random(-100000, +100000, 1) ; note (($i)) and not ($i) <================= Next SplashOff() If $iNb_elem <= 10000 Then _SplashOn("Displaying structure #1") _WinAPI_DisplayStruct($tStruct, "int arr[" & $iNb_elem & "]", "$tStruct UNsorted") SplashOff() EndIf $hTimer = TimerInit() $aRet = DllCall($hDLL, "none:cdecl", "my_sort", "ptr", DllStructGetPtr($tStruct), "int", $iNb_elem) If @error Then Exit Msgbox(0, "DllCall", "error " & @error & " occured") If IsArray($aRet) Then ConsoleWrite($iNb_elem & " elements sorted in " & TimerDiff($htimer) & " ms" & @CRLF) If $iNb_elem <= 10000 Then _SplashOn("Displaying structure #2") _WinAPI_DisplayStruct($tStruct, "int arr[" & $iNb_elem & "]", "$tStruct sorted") SplashOff() EndIf Else Exit Msgbox(0, "error", "$aRet is not an Array") EndIf DllClose($hDLL) ;========================================================== Func _SplashOn($sFirstLine, $sSecondLine = "please wait...") SplashTextOn("", $sFirstLine & @CRLF & $sSecondLine, _ 250, 50, -1, -1, $DLG_NOTITLE + $DLG_TEXTVCENTER) EndFunc ;==>_SplashOn Results (with 10 elements only (for pics convenience) : Notes : the AutoIt variable $iNb_elem contains the number of elements for the test. * Until 10.000 elements, it will sort then display the results in the _WinAPI_DisplayStruct() GUI as shown in the above pics * If > 10.000 elements, it will sort but won't display anything (because it may take too long to display). This 10.000 value for displaying can be easily changed in the script) In all cases, the time for sorting will show in AutoIt console. For example, on my old PC, it sorts 1 million elements in less than 1s AutoIt Console : 1000000 elements sorted in 493.493167427704 ms I have no idea if I should attach the dll or not because VirusTotal indicates that 1AV (out of 66 !) flags the dll malicious (this AV is named ESET-NOD32) . Anyway, you got the C++ code so you can compile it by yourself if interested, in case you have the appropriate tool for that (I used the MinGW compiler found in CodeBlocks IDE) My next step is to rework the Dll to allow float & doubles sorting too. If you guys have comments on the C++ code above, please don't hesitate to comment as I'm a total beginner in C++ Mods : could you please be kind enough and suppress my precedent deleted message ? Thanks1 point -
Hmm, what game is this for ?1 point
-
RichEdit / Hanging indentation
BigDaddyO reacted to HurleyShanabarger for a topic
Found the solution, _GUICtrlRichEdit_SetParaIndents does the job #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #Tidy_Parameters=/reel /sf /ri #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** #Region Includes #include <GUIConstantsEx.au3> #include <GuiRichEdit.au3> #include <String.au3> #include <WindowsConstants.au3> #EndRegion Includes #Region Main Main() Func Main() ; Create GUI Local $hGui = GUICreate("RichEdit with hanging first line", 400, 400, -1, -1) Local $hEdt = _GUICtrlRichEdit_Create($hGui, "", 10, 10, 380, 380, BitOR($ES_MULTILINE, $WS_VSCROLL, $ES_AUTOVSCROLL)) ; Font and color _GUICtrlRichEdit_SetSel($hEdt, 0, -1) _GUICtrlRichEdit_SetFont($hEdt, Default, "Courier New") _GUICtrlRichEdit_SetBkColor($hEdt, 0xF0F0F0) _GUICtrlRichEdit_SetSpaceUnit("mm") Local $iIndent = 20 _GUICtrlRichEdit_SetParaIndents($hEdt, $iIndent, 0, -1 * $iIndent) ; Append text and reset selection Local $sgText = "long line, which will be broken into the next." & _StringRepeat(" The text will be aligned!", 15) _GUICtrlRichEdit_AppendText($hEdt, "[13:14:54]" & @TAB & "First " & $sgText) _GUICtrlRichEdit_AppendText($hEdt, @CRLF & "[13:14:54]" & @TAB & "Second " & $sgText) _GUICtrlRichEdit_AppendText($hEdt, @CRLF & "[13:14:54]" & @TAB & "Third " & $sgText) _GUICtrlRichEdit_AppendText($hEdt, @CRLF & "[13:14:54]" & @TAB & "Fourth " & $sgText) _GUICtrlRichEdit_SetSel($hEdt, 0, 0, False) ; Show GUI GUISetState(@SW_SHOW) ; Main loop Local $iMsg While True $iMsg = GUIGetMsg() Select Case $iMsg = $GUI_EVENT_CLOSE _GUICtrlRichEdit_Destroy($hEdt) GUIDelete() Exit EndSelect WEnd EndFunc ;==>Main #EndRegion Main1 point -
Winlist returns windows from the top down. Since _Excel_BookList only returns the name, you need to use StringReplace to remove the " - Excel" at the end of the Window Title to search it against the $aWorkBooks array (name column). When you attach you need to use the $aWinList[$i][1] Window Title for it to attach correctly. To get access to the active worksheet you just use $oDefaultActiveExcelObject.ActiveSheet or to get the name $oDefaultActiveExcelObject.ActiveSheet.Name1 point
-
To tell you the truth I have no idea. But do try something like this. And try hard lol (I'm curious): #include "WinHTTP.au3" ; your data $sUsername = "UserName" $sPassword = "Password" ; Address $sAddress = "space.livevn.com" ; Initialize and get session handle $hOpen = _WinHttpOpen() ; Get connection handle $hConnect = _WinHttpConnect($hOpen, $sAddress) ;Request $hRequest = _WinHttpOpenRequest($hConnect, _ "POST", _ ; verb "/do.php?ac=71ee30ae117cddace55bd01714904227&&ref", _ ; target "HTTP/1.1", _ ; version "http://space.livevn.com/index.php", _ ; referer "*/*") ; accept ; Send it _WinHttpSendRequest($hRequest, _ "Content-Type: application/x-www-form-urlencoded" & @CRLF, _ "username=" & $sUsername & "&password=" & $sPassword & "&loginsubmit=&loginsubmit=loginnnnnnnnnnn&refer=network.html&formhash=c51a94db") ; Wait for the response _WinHttpReceiveResponse($hRequest) ; See what's returned If _WinHttpQueryDataAvailable($hRequest) Then Global $sHeader = _WinHttpQueryHeaders($hRequest) ConsoleWrite($sHeader & @CRLF) If StringInStr($sHeader, 'Set-Cookie: uchome_loginuser=' & $sUsername) Then MsgBox(0, "", "Login success") Else MsgBox(0, "", "Login failed") EndIf Else MsgBox(48, "Error 1", "Site is experiencing problems.") EndIf ConsoleWrite("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" & @CRLF) ; Close that handle _WinHttpCloseHandle($hRequest) ; Boundary line $BOUNDARY = _RandomString() ; So, what's this? You need to comprehend this fully in order to use it. Maybe I'm not doing this right. $sSubject = "Title of this" $sMessage = "Body of this" $sTag = "testing" $iFriend = "" $sPassword = "" $sSelectgroup = "" $sTarget_names = "" $sBlogSubmit = "True" $sFormHash = "597b16ca" $sDataToSend = '--' & $BOUNDARY & @CRLF & _ 'Content-Disposition: form-data; name="classid"' & @CRLF & _ @CRLF & _ '0' & @CRLF & _ '--' & $BOUNDARY & @CRLF & _ 'Content-Disposition: form-data; name="subject"' & @CRLF & _ @CRLF & _ $sSubject & @CRLF & _ ; or title if you like '--' & $BOUNDARY & @CRLF & _ 'Content-Disposition: form-data; name="message"' & @CRLF & _ @CRLF & _ $sMessage & @CRLF & _ ; or body if you like '--' & $BOUNDARY & @CRLF & _ 'Content-Disposition: form-data; name="tag"' & @CRLF & _ @CRLF & _ $sTag & @CRLF & _ ; tag can be important '--' & $BOUNDARY & @CRLF & _ 'Content-Disposition: form-data; name="friend"' & @CRLF & _ @CRLF & _ $iFriend & @CRLF & _ ; '--' & $BOUNDARY & @CRLF & _ 'Content-Disposition: form-data; name="password"' & @CRLF & _ @CRLF & _ $sPassword & @CRLF & _ ; '--' & $BOUNDARY & @CRLF & _ 'Content-Disposition: form-data; name="selectgroup"' & @CRLF & _ @CRLF & _ $sSelectgroup & @CRLF & _ ; '--' & $BOUNDARY & @CRLF & _ 'Content-Disposition: form-data; name="target_names"' & @CRLF & _ @CRLF & _ $sTarget_names & @CRLF & _ ; '--' & $BOUNDARY & @CRLF & _ 'Content-Disposition: form-data; name="blogsubmit"' & @CRLF & _ @CRLF & _ $sBlogSubmit & @CRLF & _ ; '--' & $BOUNDARY & @CRLF & _ 'Content-Disposition: form-data; name="formhash"' & @CRLF & _ @CRLF & _ $sFormHash & @CRLF & _ ; '--' & $BOUNDARY & '--' ; New request $hRequest = _WinHttpOpenRequest($hConnect, _ "POST", _ ; verb "cp.php?ac=blog&blogid=", _ ; target "HTTP/1.1", _ ; version "http://space.livevn.com/cp.php?ac=blog", _ ; referer "application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5") ; accept ; Add some headers _WinHttpAddRequestHeaders($hRequest, "Content-Type: multipart/form-data; boundary=" & $BOUNDARY) _WinHttpAddRequestHeaders($hRequest, "Accept-Language: en-us,en;q=0.5") _WinHttpAddRequestHeaders($hRequest, "Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7") _WinHttpAddRequestHeaders($hRequest, "Cache-Control: max-age=0") _WinHttpAddRequestHeaders($hRequest, "Origin: http://space.livevn.com") ; Send new request _WinHttpSendRequest($hRequest, _ $WINHTTP_NO_ADDITIONAL_HEADERS, _ ; no additional headers (all added above) $sDataToSend) ; data ; Wait for the response _WinHttpReceiveResponse($hRequest) ; See what's returned If _WinHttpQueryDataAvailable($hRequest) Then $sHeader = _WinHttpQueryHeaders($hRequest) ConsoleWrite($sHeader & @CRLF) Global $sChunk, $sData While 1 $sChunk = _WinHttpReadData($hRequest, 1) If @error Then ExitLoop $sData &= $sChunk WEnd ConsoleWrite($sData & @CRLF) ;#cs ; Write it somewhere to see what's that Global $sFile = @DesktopDir & "\ReturnedPage.htm" Global $hFile = FileOpen($sFile, 2) FileWrite($hFile, $sData) FileClose($hFile) ;#ce Else MsgBox(48, "Error 2", "Site is experiencing problems.") EndIf ; Close open handles _WinHttpCloseHandle($hRequest) _WinHttpCloseHandle($hConnect) _WinHttpCloseHandle($hOpen) ; The end Exit ; this is redundant of course ; Used function Func _RandomString() Return "----=BoundaryLine_" & Random(100000000, 999999999, 1) EndFunc ;==>_RandomString @Kastout, okey doke1 point