Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 08/17/2015 in all areas

  1. [NEW VERSION] - 17 Mar 22 Added: A new function _Notify_Size which allows you to adjust the size of the notification from its default 160x40. Please read the function header to see the max/min sizes that you can set for the width and height - the function returns informative @error/@extended values if these are not respected. Regardless of the size set, each notification will still display only 2 lines of text with the size of font used set automatically by the UDF. New UDF in the zip below. Previous changes: Changelog.txt A while ago I was asked to help port an AHK UDF to AutoIt. This was not too difficult and I found it useful myself (as a replacement for ConsoleWrite when debugging compiled scripts among other things). I have been polishing it for a while and thought I might release it in case it proves useful to anyone else. The notifications produced by Notify are small 2-line boxes that pop out of the edge of the display one above the other (you can select which side and in which direction they appear) - you can have as many as you want although only as many as can fit on your display will appear, the others will appear as soon as there is room. You can select whether they will retract after a certain time and/or when clicked. Colours and font are user-definable, and you can add an icon or image (bmp, jpg, gif or png) if you wish. When a notification retracts, the others move to leave space for more (you can select a smoooth slide or an instant move) - run the examples to see them in action. If you find the default sizing of the notifications is not to your liking you can change it by amending these values in the UDF (lines #354-356): ; Set default auto-sizing Notify dimensions Local $iNotify_Width_max = 300 Local $iNotify_Width_min = 150 Local $iNotify_Height = 40 A zip containing the UDF, example scripts and my StringSize UDF (which is also required): Notify.zip As usual happy for comments and/or compliments. M23
    1 point
  2. JohnOne

    Tesseract Simple Example

    There has been many questions about using tesseract of late. Here is a very basic example which works for me, along with the exact version of standalone tesseract executable and English language data used I found it some time ago at a time I thought I needed it, I do not recall from where. $ImageToReadPath = @ScriptDir & "\image.bmp" $ResultTextPath = @ScriptDir & "\Result" $OutPutPath = $ResultTextPath & ".txt" $TesseractExePath = @ScriptDir & "\Tesseract.exe" ShellExecuteWait($TesseractExePath, '"' & $ImageToReadPath & '" "' & $ResultTextPath & '"', "", "", @SW_HIDE) If @error Then Exit MsgBox(0, "Error", @error) EndIf MsgBox(0, "Result", FileRead($OutPutPath)) FileDelete($OutPutPath)Some Answers: The files contained in the download, only support English language. From the only documentation I got with this version... Original Binaries and Source can be found here: http://code.google.com/p/tesseract-ocr/I do not know where to get other languages support. I do not know if there is a later standalone version. I do not know why it does not read your image accurately. It does not have a virus in it. You can search the forums or internet to learn how to create / cut / copy / paste, or otherwise manipulate your own images. TesseractExample.zip
    1 point
  3. The OP hasn't been online in almost 3 years. You will likely get more help if you repost your issue in a new thread.
    1 point
  4. Thank you for including the script. I shall have a look and let you know what I find.
    1 point
  5. Please check my ADCU example script here. It handles two listviews.
    1 point
  6. It looks like you didn't get the handle for the second ListView like you did for your first one. P.S. a testable script would be nice, too.
    1 point
  7. It seems that AutoIt3.exe doesn't send back his console output to the caller cmd prompt. Anyway, if you force the redirection of the output of AutoIt3.exe using the dos redirector operator "|" and you send the output to the "more" command, then the "more" command will send his output back to your command prompt. in short, try this: "C:\Users\user>"c:\Program Files (x86)\AutoIt3\AutoIt3.exe" "c:\Program Files (x86)\AutoIt3\test.au3" | more
    1 point
  8. @KCVINU: I used #32770 as AU3Inf did not get the text from the save as window. So in your winexists you should check on special definition winexists("[CLASS:#32770]")similar for winactivate ControlSetText("Save As", $wintxt, 1001, $DediCated_FileName) ; Set the new filenamchange to ControlSetText("Save As", "", "[CLASS:Edit; INSTANCE:1]", $DediCated_FileName) ; Set the new filenam
    1 point
  9. I haven't tried it but you simply would prepend the path. Example: ControlSetText("Save As", $wintxt, 1001, "C:\temp\ & $DediCated_FileName) ; Set the new path and filename
    1 point
  10. @KCVINU: Did you try to just enter your foldername in the file textbox. That textbox itself is directly recognized whereas the listbox controls and treeview controls are only reachable with IUIAutomation. But in your case it seems just that you have to enter <path><filename>.jpg in the file textbox. That easily can be done with controlsettext function of AutoIT [CLASS:Edit; INSTANCE:1] seems to be the recognition pattern (at least from Chrome save as) based on https://www.autoitscript.com/autoit3/docs/functions/ControlSetText.htm you should get something like #include <MsgBoxConstants.au3> Example() Func Example() ; Wait 10 seconds for the save as window to appear. Local $hWnd = WinWait("[CLASS:#32770]", "", 10) ; Set the edit control in save as with some text. The handle returned by WinWait is used for the "title" parameter of ControlSetText. ControlSetText($hWnd, "", "[CLASS:Edit; INSTANCE:1]", "%temp%\myfile.jpg") ; Retrieve the text of the edit control in Notepad. The handle returned by WinWait is used for the "title" parameter of ControlGetText. ; Local $sText = ControlGetText($hWnd, "", "Edit1") ; Display the text of the edit control. ; MsgBox($MB_SYSTEMMODAL, "", "The text in Edit1 is: " & $sText) ; Close the Notepad window using the handle returned by WinWait. ; WinClose($hWnd) EndFunc ;==>Example
    1 point
  11. 1. Ahh you mean the cursor. That´s right currently you can not change this in the settings. (I will include it in the next update) But at this time you can do a workaround: Create a new macro in your project. Select "Open file" as trigger and "Execute Command" as action. In the Execute Command Action you insert the following: SendMessage($SCE_EDITOR[_GUICtrlTab_GetCurFocus($hTab)], $SCI_SETCARETFORE, 0xFF00FF, 0)-> Where 0xFF00FF is your Color Code for the caret. So now when you open a new Tab the new Caret color should be set. (As i said..in the next update i will include it in the settings. About the func saving: I thing you mean the Calltips and highliting for own functions and elements. For this you must create an own au3.autoit.XXX.api and XXX.keywords.properties file in the \Data\Api and \Data\Properties folder. You can see the example files for the Autoit Syntax in this folders. Just create your own files with your funcs and you should see it in the ISN. And yes the error-color will also be changable in the next update!
    1 point
  12. if (!'string' === false) { // !'string' is equal to false and then false is compared with false hence true console.log('Internet is NOT broken!'); }This is JavaScript. Therefore if AutoIt is broken, so is the entire web. Maybe contact ECMAScript and W3C and explain to them that they're wrong. Let us know what they respond with so we can change AutoIt. Thanks
    1 point
  13. You should be able to handle those save as dialogs with the IUIautomation stuff in the examples section. Try with simplespy if it recognizes the controls.
    1 point
  14. Do I understand you correctly that you want to wait until the user opens the Save As dialogWhen the user saves a jpeg file then rename itSave it to another folderBut I might be wrong. From your OP it is not really clear what you want to do.
    1 point
  15. What version of AutoIt are you running this on? It works for me in 3.3.14.0.
    1 point
  16. I think the term crash is being misused here. I guess most of you mean AutoIt error/exception. As a crash is quite a serious occurrence, where as an AutoIt error is basically AutoIt protecting you from bad programming.
    1 point
  17. KaFu

    DriveGetDrive Issue

    One thing I think I remember from my research is, that you can map the missing drive in the user context with DriveMapAdd(). I started a script to synchronize to drive mappings under different user contexts, but somehow lost the interest (will be an addition to SMF when my interest starts again ). Here's the current state, I guess you'll have to insert some includes ... #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_UseUpx=n #AutoIt3Wrapper_Res_requestedExecutionLevel=requireAdministrator #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** ; DriveMapDel("b:") ; DriveMapAdd("b:","\\diskstation\nas",8) #include <array.au3> Global $b_AddNetworkDrives = True Global $g_CmdLineRaw = $CmdLineRaw $h_DLL_Kernel32 = DllOpen("kernel32.dll") $h_DLL_Advapi32 = DllOpen("advapi32.dll") #include <WinAPIEx_3.8_3380\WinAPIEx.au3> If Not @Compiled Then MsgBox(0, "Hint", "Run program compiled to test...") Exit EndIf ; Add to top of SMF_Func_ShellTristateTreeView_v64.au3 ? If StringInStr($g_CmdLineRaw, "SMF_GetMappedDrives", 2) Then If Not IsAdmin() Then _UAC_GetMappedDrives_Child() Exit EndIf ; Add to func _ShellTreeView_Create( If $b_AddNetworkDrives Then If IsAdmin() Then _UAC_GetMappedDrives_Parent() EndIf Exit Func _UAC_GetMappedDrives_Parent() Local $tSecurity = DllStructCreate("int Length;ptr Descriptor;int InheritHandle") ; $tagSECURITY_ATTRIBUTES DllStructSetData($tSecurity, 1, DllStructGetSize($tSecurity)) DllStructSetData($tSecurity, 2, 0) Local $hFileMap = _WinAPI_CreateFileMapping(-1, 65536, "SMF_MappedDrives_Buffer", 0x0004, DllStructGetPtr($tSecurity)) Local $s_AutoItWinGetTitle = AutoItWinGetTitle() AutoItWinSetTitle("") _RunWithReducedPrivileges(@ScriptFullPath, " SMF_GetMappedDrives", @ScriptDir, @SW_HIDE, True) AutoItWinSetTitle($s_AutoItWinGetTitle) Local $pAddress = _WinAPI_MapViewOfFile($hFileMap) Local $tData = DllStructCreate('wchar[32768]', $pAddress) Local $s_MappedDrives_Data_Child = DllStructGetData($tData, 1) _WinAPI_UnmapViewOfFile($pAddress) _WinAPI_CloseHandle($hFileMap) Local $aDrives_Child If Not StringInStr($s_MappedDrives_Data_Child, "GetMappedDrives Results - Child:") Then Local $aDrives_Child[1] $aDrives_Child[0] = -1 ; Error, no info transfered from non-elevated process Else $s_MappedDrives_Data_Child = StringReplace($s_MappedDrives_Data_Child, "GetMappedDrives Results - Child:" & @LF, "") $aDrives_Child = StringSplit($s_MappedDrives_Data_Child, @LF) StringReplace($s_MappedDrives_Data_Child, @LF, "") ; Detect number of lines in data = number of found mappings $aDrives_Child[0] = @extended EndIf Local $aDrives = DriveGetDrive("NETWORK") If @error Or Not IsArray($aDrives) Then Local $aDrives[1] $aDrives[0] = 0 EndIf Local $a_Drive_Mapping[28][5] $a_Drive_Mapping[0][1] = "Elevated Mode" $a_Drive_Mapping[0][3] = "Non-Elevated Mode" $a_Drive_Mapping[0][4] = "Number of Differences in mapped drives" $a_Drive_Mapping[1][1] = $aDrives[0] ; Number of Mapping in Elevated mode $a_Drive_Mapping[1][3] = $aDrives_Child[0] ; Number of Mapping in Non-Elevated mode $a_Drive_Mapping[1][4] = 0 ; Number of differences in mapped drive paths Local $aDrives_Child_Split For $i = 2 To 27 $a_Drive_Mapping[$i][0] = Chr($i + 95) & ":" For $y = 1 To $aDrives[0] If $aDrives[$y] = Chr($i + 95) & ":" Then $a_Drive_Mapping[$i][1] = DriveMapGet($aDrives[$y]) $a_Drive_Mapping[$i][2] = DriveStatus($a_Drive_Mapping[$i][1]) ExitLoop EndIf Next For $y = 1 To $aDrives_Child[0] If StringLeft($aDrives_Child[$y], 3) = Chr($i + 95) & ":=" Then $aDrives_Child[$y] = StringTrimLeft($aDrives_Child[$y], 3) $aDrives_Child_Split = StringSplit($aDrives_Child[$y], "|") If $aDrives_Child_Split[0] = 2 Then $a_Drive_Mapping[$i][3] = $aDrives_Child_Split[1] $a_Drive_Mapping[$i][4] = $aDrives_Child_Split[2] EndIf ExitLoop EndIf Next If $a_Drive_Mapping[$i][1] <> $a_Drive_Mapping[$i][3] Then $a_Drive_Mapping[1][4] += 1 Next If $a_Drive_Mapping[1][4] > 0 Then ; different mappings found EndIf _ArrayDisplay($a_Drive_Mapping, IsAdmin()) EndFunc ;==>_UAC_GetMappedDrives_Parent Func _UAC_GetMappedDrives_Child() Local $s_MappedDrives_Data = "GetMappedDrives Results - Child:" & @LF Local $aDrives = DriveGetDrive("NETWORK") If Not @error Then For $i = 1 To $aDrives[0] $s_MappedDrives_Data &= $aDrives[$i] & "=" & DriveMapGet($aDrives[$i]) & "|" & DriveStatus($aDrives[$i]) & @LF Next EndIf Local $hFileMap = _WinAPI_OpenFileMapping("SMF_MappedDrives_Buffer") Local $pAddress = _WinAPI_MapViewOfFile($hFileMap) Local $tData = DllStructCreate('wchar[32768]', $pAddress) DllStructSetData($tData, 1, $s_MappedDrives_Data) _WinAPI_UnmapViewOfFile($pAddress) _WinAPI_CloseHandle($hFileMap) EndFunc ;==>_UAC_GetMappedDrives_Child ; send result to main process ; in main process do something like... ; - check if any mappings existed before > on exit remove only newly "added" mappings ; > remove "Old added" mappings before reload! ; DriveMapAdd($aDrives[$i],DriveMapGet($aDrives[$i]),8) ; =============================================================================================================================== ; <_RunWithReducedPrivileges.au3> ; ; Function to run a program with reduced privileges. ; Useful when running in a higher privilege mode, but need to start a program with reduced privileges. ; - A common problem this fixes is drag-and-drop not working, and misc functions (sendmessage, etc) not working. ; ; Functions: ; _RunWithReducedPrivileges() ; runs a process with reduced privileges if currently running in a higher privilege mode ; ; INTERNAL Functions: ; _RWRPCleanup() ; Helper function for the above ; ; Reference: ; See 'Creating a process with Medium Integration Level from the process with High Integration Level in Vista' ; @ http://www.codeproject.com/KB/vista-security/createprocessexplorerleve.aspx ; See Elmue's comment 'Here the cleaned and bugfixed code' ; Also see: 'High elevation can be bad for your application: How to start a non-elevated process at the end of the installation' ; @ http://www.codeproject.com/KB/vista-security/RunNonElevated.aspx ; (Elmue has the same code here too in his response to FaxedHead's comment ('Another alternative to this method')) ; Another alternative using COM methods: ; 'Getting the shell to run an application for you - Part 2:How | BrandonLive' ; @ http://brandonlive.com/2008/04/27/gettin...o-run-an-application-for-you-p ; ; Author: Ascend4nt, based on code by Elmue's fixed version of Alexey Gavrilov's code ; =============================================================================================================================== ; =================================================================================================================== ; Func _RunWithReducedPrivileges($sPath,$sCmd='',$sFolder='',$iShowFlag=@SW_SHOWNORMAL,$bWait=False) ; ; Function to run a program with reduced privileges. ; Useful when running in a higher privilege mode, but need to start a program with reduced privileges. ; - A common problem this fixes is drag-and-drop not working, and misc functions (sendmessage, etc) not working. ; ; $sPath = Path to executable ; $sCmd = Command-line (optional) ; $sFolder = Folder to start in (optional) ; $iShowFlag = how the program should appear on startup. Default is @SW_SHOWNORMAL. ; All the regular @SW_SHOW* macros should work here ; $bWait = If True, waits for the process to finish before returning with an exit code ; If False, it returns without waiting for the process to finish, with the process ID # ; ; Returns: ; Success: If $bWait=True, the exit code of the Process. If $bWait=False, then the Process ID # of the process ; Failure: 0, with @error set: ; @error = 2 = DLLCall error. @extended contains the DLLCall error code (see AutoIt Help) ; @error = 3 = API returned failure. Call 'GetLastError' API function to get more info. ; ; Author: Ascend4nt, based on code by Elmue's fixed version of Alexey Gavrilov's code ; =================================================================================================================== Func _RunWithReducedPrivileges($sPath, $sCmd = '', $sFolder = '', $iShowFlag = @SW_SHOWNORMAL, $bWait = False) Local $aRet, $iErr, $iRet = 1, $hProcess, $hToken, $hDupToken, $stStartupInfo, $stProcInfo Local $sCmdType = "wstr", $sFolderType = "wstr" ;~ Run normally if not in an elevated state, or if pre-Vista O/S ; If Not IsAdmin() Or StringRegExp(@OSVersion, "_(XP|200(0|3))") Then ; XP, XPe, 2000, or 2003? If Not IsAdmin() Or $__WINVER < 0x0600 Then ; XP or less then ; MsgBox(0,"_RunWithReducedPrivileges",IsAdmin() & @crlf & "0x" & hex($__WINVER,4)) If $bWait Then Return RunWait($sPath & ' ' & $sCmd, $sFolder) Return Run($sPath & ' ' & $sCmd, $sFolder) EndIf ;~ Check Parameters and adjust DLLCall types accordingly If Not IsString($sCmd) Or $sCmd = '' Then $sCmdType = "ptr" $sCmd = 0 EndIf If Not IsString($sFolder) Or $sFolder = '' Then $sFolderType = "ptr" $sFolder = 0 EndIf #cs ; STARTUPINFOW struct: cb,lpReserved,lpDesktop,lpTitle,dwX,dwY,dwXSize,dwYSize,dwXCountChars,dwYCountChars,dwFillAttribute, ; dwFlags,wShowWindow,cbReserved2,lpReserved2,hStdInput,hStdOutput,hStdError ; NOTE: This is for process creation info. Also, not sure if the Std I/O can be redirected..? #ce $stStartupInfo = DllStructCreate("dword;ptr[3];dword[7];dword;word;word;ptr;handle[3]") DllStructSetData($stStartupInfo, 1, DllStructGetSize($stStartupInfo)) DllStructSetData($stStartupInfo, 4, 1) ; STARTF_USESHOWWINDOW DllStructSetData($stStartupInfo, 5, $iShowFlag) ; PROCESS_INFORMATION struct: hProcess, hThread, dwProcessId, dwThreadId ; This is for *receiving* info $stProcInfo = DllStructCreate("handle;handle;dword;dword") ;~ Open a handle to the Process ; Explorer runs under a lower privilege, so it is the basis for our security info. ; Open the process with PROCESS_QUERY_INFORMATION (0x0400) access $aRet = DllCall($h_DLL_Kernel32, "handle", "OpenProcess", "dword", 0x0400, "bool", False, "dword", ProcessExists("explorer.exe")) If @error Then Return SetError(2, @error, 0) If Not $aRet[0] Then Return SetError(3, 0, 0) $hProcess = $aRet[0] ;~ Open a handle to the Process's token (for duplication) ; TOKEN_DUPLICATE = 0x0002 $aRet = DllCall($h_DLL_Advapi32, "bool", "OpenProcessToken", "handle", $hProcess, "dword", 2, "handle*", 0) If @error Then Return SetError(_RWRPCleanup($hProcess, 0, 0, 2, @error), @extended, 0) If $aRet[0] = 0 Then Return SetError(_RWRPCleanup($hProcess, 0, 0, 3), @extended, 0) $hToken = $aRet[3] ;~ Duplicate the token handle ; TOKEN_ALL_ACCESS = 0xF01FF, SecurityImpersonation = 2, TokenPrimary = 1, $aRet = DllCall($h_DLL_Advapi32, "bool", "DuplicateTokenEx", "handle", $hToken, "dword", 0xF01FF, "ptr", 0, "int", 2, "int", 1, "handle*", 0) If @error Then Return SetError(_RWRPCleanup($hProcess, $hToken, 0, 2, @error), @extended, 0) If Not $aRet[0] Then Return SetError(_RWRPCleanup($hProcess, $hToken, 0, 3), @extended, 0) $hDupToken = $aRet[6] ;~ Create the process using 'CreateProcessWithTokenW' (Vista+ O/S function) $aRet = DllCall($h_DLL_Advapi32, "bool", "CreateProcessWithTokenW", "handle", $hDupToken, "dword", 0, "wstr", $sPath, $sCmdType, $sCmd, _ "dword", 0, "ptr", 0, $sFolderType, $sFolder, "ptr", DllStructGetPtr($stStartupInfo), "ptr", DllStructGetPtr($stProcInfo)) $iErr = @error _RWRPCleanup($hProcess, $hToken, $hDupToken, 2, @error) If $iErr Then Return SetError(2, $iErr, 0) If Not $aRet[0] Then Return SetError(3, 0, 0) ;~ MsgBox(0,"Info","Process info data: Process handle:"&DllStructGetData($stProcInfo,1)&", Thread handle:"&DllStructGetData($stProcInfo,2)& _ ;~ ", Process ID:"&DllStructGetData($stProcInfo,3)&", Thread ID:"&DllStructGetData($stProcInfo,4)&@CRLF) $iRet = DllStructGetData($stProcInfo, 3) ; Process ID ;~ If called in 'RunWait' style, wait for the process to close If $bWait Then ProcessWaitClose($iRet) $iRet = @extended ; Exit code EndIf ;~ Close Thread and then Process handles (order here is important): _RWRPCleanup(0, DllStructGetData($stProcInfo, 2), DllStructGetData($stProcInfo, 1), 0) Return $iRet EndFunc ;==>_RunWithReducedPrivileges ; =================================================================================================================== ; Func _RWRPCleanup($hProcess,$hToken,$hDupToken,$iErr=0,$iExt=0) ; ; INTERNAL: Helper function for _RunWithReducedPrivileges() ; ; Author: Ascend4nt ; =================================================================================================================== Func _RWRPCleanup($hProcess, $hToken, $hDupToken, $iErr = 0, $iExt = 0) Local $aHandles[3] = [$hToken, $hDupToken, $hProcess] ; order is important For $i = 0 To 2 If $aHandles[$i] <> 0 Then DllCall($h_DLL_Kernel32, "bool", "CloseHandle", "handle", $aHandles[$i]) Next Return SetExtended($iExt, $iErr) EndFunc ;==>_RWRPCleanup
    1 point
  18. jchd

    Remote AutoIt

    I think you can do 1. and 2. with a webpage hosted by your provider, a php app for acting on the DB there. 3. can be done the same way: AutoIt script can reach the webpage and get back the value then perform required action. Well, unless I miss something.
    1 point
  19. I know you can capture and view packets using the pcap UDF, so I'm sure you could alter and send packets too. EDIT: but it requires external modules.
    1 point
  20. water

    Coloured text for e-mail

    Simple HTML file with the second paragraph in green. <!DOCTYPE html> <html> <body> This is text in <b>bold</b>. <p style="color:green">This paragraph is in green.</p> <p>Normal text again.</p> </body> </html>
    1 point
  21. water

    Coloured text for e-mail

    This is a good starting point.
    1 point
  22. Skysnake, Is this anything at all like what you are looking for? #include <GUIConstantsEx.au3> #include <array.au3> #include <sqlite.au3> #include <GuiComboBox.au3> #AutoIt3Wrapper_Add_Constants=n _SQLite_Startup() _SQLite_Open() Local $sql, $aRows, $iCols, $iRows, $LastSelected $sql = 'create table T1 (Fname, MI, Lname);' $sql &= 'insert into T1 values("Thomas","R","Jones");' $sql &= 'insert into T1 values("William","X","Smith");' $sql &= 'insert into T1 values("James","T","Kirk");' $sql &= 'insert into T1 values("Rastus","P","Badass");' _SQLite_Exec(-1, $sql) Local $gui010 = GUICreate('SQLite _rowid_ Example') GUICtrlCreateLabel('Middle Initial', 140, 15, 100, 20) Local $cMI = GUICtrlCreateCombo('', 140, 30, 100, 50) Local $dummyenter = GUICtrlCreateDummy() GUICtrlCreateLabel('Hit [ENTER] to update DB entry', 110, 70, 200, 20) _pop_combo() GUISetState() Local $aAcKeys[1][2] = [["{Enter}", $dummyenter]] GUISetAccelerators($aAcKeys) While 1 Switch GUIGetMsg() Case $gui_event_close Exit Case $cMI $LastSelected = _GUICtrlComboBox_GetCurSel($cMI) Case $dummyenter If $LastSelected = '' Then ContinueLoop ConsoleWrite($aRows[$LastSelected][0] & @CRLF) _SQLite_Exec(-1, 'update T1 set MI = ' & _SQLite_FastEscape(GUICtrlRead($cMI)) & ' where _rowid_ = ' & $aRows[$LastSelected+1][0] & ';') _pop_combo() EndSwitch WEnd Func _pop_combo() _SQLite_GetTable2d(-1, 'select _rowid_, MI from T1', $aRows, $iRows, $iCols) _arraydisplay($aRows) Local $str = '|' For $i = 1 To UBound($aRows) - 1 $str &= $aRows[$i][1] & '|' Next GUICtrlSetData($cMI, $str, $aRows[1][1]) $LastSelected = '' EndFunc ;==>_pop_combokylomas Edit: Original posting deleted, corrected version posted (_rowid_ used incorrectly).
    1 point
  23. water

    Coloured text for e-mail

    HTML would be the easiest way and should be possible with variables too. Another possibility is to create RTF mails, but that is much more complex.
    1 point
  24. Seems to be working here and it's not visible in optional features. It's not come back yet on the images I've been doing. Maybe it's because I run the script as System during ConfigMgr OSD and it nukes it early
    1 point
  25. Malkey

    Pixelsearch help

    Here are two methods. This first method randomly selects a smaller area within the given search area, then, randomly searches that small area either left-to-right or right-to-left; and, either top-to-bottom or bottom-to-top. #cs Script's objective:- A way to tell Pixelsearch to click a random pixel of the specified colour. From AutoIt help file:- PixelSearch ( left, top, right, bottom, color [, shade-variation = 0 [, step = 1 [, hwnd]]] The search direction varies as follows: Left-to-Right - left < right Right-to-Left - right < left Top-to-Bottom - top < bottom Bottom-to-Top - bottom < top Changing the search direction can be a useful optimization if the color being searched for frequently appears in in a specific quadrant of the search area since less searching is done if the search starts in the most common quadrant. #ce ; For full screen search $a = _PixelSearchRandom(0, 0, @DesktopWidth, @DesktopHeight, 0x0000FF, 0) ; 0x0000FF = Blue If @error Then MsgBox(0, "Error", @extended & " segments searched, colour not found.") Else MouseMove($a[0], $a[1]) MouseClick("primary") EndIf ; Divide the search area along the X-axis into $iX_NumOfSeg, and, along the Y-axis into $iY_NumOfSeg, thus creating ($iX_NumOfSeg multiply by ; $iY_NumOfSeg) number of segements. Then randomly select a segment, and randomly search that segment either Left-to-Right or Right-to-Left, ; and, either Top-to-Bottom or Bottom-to-Top. Continue selecting and searching random segments until colour is found. Func _PixelSearchRandom($iLeft, $iTop, $iRight, $iBottom, $iColor, $shade_variation = 0, $iX_NumOfSeg = 16, $iY_NumOfSeg = 12, $iStep = 1, $hwnd = "") Local $iMiss = 0, $sUniqueSegNum = "|" Local $iSegWidth = ($iRight - $iLeft) / $iX_NumOfSeg Local $iSegHeight = ($iBottom - $iTop) / $iY_NumOfSeg ConsoleWrite("Segment Width x Height = " & $iSegWidth & " x " & $iSegHeight & @LF) ConsoleWrite("=========================================" & @LF) While 1 Local $iSegment = Random(1, $iX_NumOfSeg * $iY_NumOfSeg, 1) ; Get Random segment. If StringInStr($sUniqueSegNum, "|" & $iSegment & "|") = 0 Then ; Ensures each segment is searched only once. ; Add random segment number to test string. Example: If $sUniqueSegNum = "|10|110|" then search for "|1|" will not be found, and, ; "1|" will be added to end of $sUniqueSegNum, making $sUniqueSegNum = "|10|110|1|" $sUniqueSegNum &= $iSegment & "|" Else ; "|" & $iSegment & "|" - already exists in the unique test string, $sUniqueSegNum, so start loop again. ConsoleWrite(" " & $iSegment & " Continue Loop" & @LF) ContinueLoop ; Start While loop again EndIf ConsoleWrite($iMiss & ": Random Segment = " & $iSegment) ; Find right-bottom corner of segment - coordinates ($iRightSegNumber_X, $iBottomSegNumber_Y) Local $iRightSegNumber_X = Mod($iSegment, $iX_NumOfSeg) + (Mod($iSegment, $iX_NumOfSeg) = 0) * $iX_NumOfSeg Local $iBottomSegNumber_Y = Ceiling($iSegment / $iX_NumOfSeg) ConsoleWrite(" Search segment with Right-Botton Corner, grid Coord (X, Y) = " & $iRightSegNumber_X & ", " & $iBottomSegNumber_Y & @TAB) ; Convert grid numbers to pixel lengths for PixelSearch function. Local $iLeftSeg = ($iRightSegNumber_X - 1) * $iSegWidth Local $iRightSeg = $iRightSegNumber_X * $iSegWidth Local $iTopSeg = ($iBottomSegNumber_Y - 1) * $iSegHeight Local $iBottomSeg = $iBottomSegNumber_Y * $iSegHeight ; Randomly change search direction. If Random(0, 1, 1) Then ; Search Left-to-Right when $iLeftSeg < $iRightSeg. Or, search Right-to-Left when $iRightSeg < $iLeftSeg. ; Swap, because random = 1 $Temp = $iLeftSeg $iLeftSeg = $iRightSeg $iRightSeg = $Temp EndIf If Random(0, 1, 1) Then ; Search Top-to-Bottom when $iTopSeg < $iBottomSeg. Or, search Bottom-to-Top when $iBottomSeg < $iTopSeg. ; Swap, because random = 1 $Temp = $iTopSeg $iTopSeg = $iBottomSeg $iBottomSeg = $Temp EndIf $aCoord = PixelSearch($iLeftSeg, $iTopSeg, $iRightSeg, $iBottomSeg, $iColor, $shade_variation, $iStep, $hwnd) $iMiss += @error If IsArray($aCoord) Then Return SetError(0, $iMiss, $aCoord) If ($iMiss >= ($iX_NumOfSeg * $iY_NumOfSeg) - 1) Then Return SetError(1, $iX_NumOfSeg * $iY_NumOfSeg, 0) ; All segments searched - nothing found. ConsoleWrite(" Colour not found" & @LF) WEnd EndFunc ;==>_PixelSearchRandom The next script can find all occurrences of a specified pixel colour with parameter "Step" = 1, and put all those pixel's coordinates into an array. To speed the process up, increase the "Step" size. However, not all specified colour pixels are certain to be found. Testing:- Using Step = 1, found 2483 pixels of specific colour in 78.667 secs; and, on the same search area, using Step = 10, found 20 pixels of specific colour in 0.870 secs. Also, using Step = 1, found 222 pixels of specific colour in 7.531 secs; and, on the same search area, using Step = 10, found 10 pixels of specific colour in 0.455 secs. #include <Array.au3> Local $hTimer = TimerInit() $aArray = _PixelSearchArray(0, 0, @DesktopWidth, @DesktopHeight, 0x0000FF, 0, 10) If Not @error Then MsgBox(0, "Taken: " & Round(TimerDiff($hTimer) / 1000, 3) & " secs", "Start Random Selection") For $i = 1 To 4 $Rnd = Random(1, UBound($aArray) - 1, 1) ; Random array index MouseMove($aArray[$Rnd][0], $aArray[$Rnd][1]) MouseClick("primary") MsgBox(0, "Mouse click #" & $i & " of 4", 'Random array index "' & $Rnd & '" Coords X, Y = ' & $aArray[$Rnd][0] & ', ' & $aArray[$Rnd][1]) Next _ArrayDisplay($aArray) Else MsgBox(0, "Error", "Colour not found.") EndIf ; Returns an array of coordinates of all found specified colour in a search area. The rectangular search area ; being enclosed by the ($iLeft, $iTop) coordinate, to the ($iRight, $iBottom) coordinate. Func _PixelSearchArray($iLeft, $iTop, $iRight, $iBottom, $iColor, $iShade_Variation = 0, $iStep = 1, $hWnd = "") Local $aRetArr[500][2], $iCount = 0 Local $aCoord = PixelSearch($iLeft, $iTop, $iRight, $iBottom, $iColor, $iShade_Variation, $iStep, $hWnd) If Not @error Then $iCount += 1 $aRetArr[$iCount][0] = $aCoord[0] $aRetArr[$iCount][1] = $aCoord[1] Else Return SetError(1, 0, 0) EndIf While 1 If ($aRetArr[$iCount][0]) <= $iRight Then While 1 ; Search the rest of the line only, for more matching pixels. $aCoord = PixelSearch($aRetArr[$iCount][0] + 1, $aRetArr[$iCount][1], $iRight, $aRetArr[$iCount][1], $iColor, $iShade_Variation, $iStep, $hWnd) If Not @error Then If UBound($aRetArr) - 1 = $iCount Then ReDim $aRetArr[UBound($aRetArr) + 200][2] $iCount += 1 $aRetArr[$iCount][0] = $aCoord[0] $aRetArr[$iCount][1] = $aCoord[1] Else ; No more matching pixels on this line. ExitLoop EndIf WEnd EndIf ; Search the rest of the search area from Left to Right, Top to Bottom with new Top, being the last found pixel's line plus one. $aCoord = PixelSearch($iLeft, $aRetArr[$iCount][1] + 1, $iRight, $iBottom, $iColor, $iShade_Variation, $iStep, $hWnd) If Not @error Then If UBound($aRetArr) - 1 = $iCount Then ReDim $aRetArr[UBound($aRetArr) + 200][2] $iCount += 1 $aRetArr[$iCount][0] = $aCoord[0] $aRetArr[$iCount][1] = $aCoord[1] ;_ArrayDisplay($aRetArr) Else ExitLoop EndIf WEnd ReDim $aRetArr[$iCount + 1][2] $aRetArr[0][0] = $iCount Return $aRetArr EndFunc ;==>_PixelSearchArray
    1 point
  26. Jon

    AutoIt v3.3.14.2 Released

    Uploaded v3.3.14.1 Removed au3record.exe as it's often mistakenly flagged as malware causing the entire AutoIt zip/installer to be flagged. We'll host it separately.Reworked AutoIt3Help.exe and applied a digital signature to help with malware false positives - as above.No other changes to the AutoIt exes so no real need to update if you are not having issues.
    1 point
  27. I'm just looking for advice on where to start. I'm writing a script that opens a web page, logs-in, clicks a link, deletes cookies & history, then logs in on a different account a few more times. I was hoping to use Chrome or FireFox. The part I most anticipate issues with is finding the link to click.
    1 point
×
×
  • Create New...