Jump to content

20Ice18

Active Members
  • Posts

    54
  • Joined

  • Last visited

Everything posted by 20Ice18

  1. Sorry I didn't know they can merge. 😶
  2. The issue was in EzMtSql_Dll.au3 file there is at the fist sight obvious mistake with a lining, I thought since there is a comment ; Dont Tidy me! Author is aware of it but it probably was because of other reason. so I rewrote the original Func _EzMySql_Dll() ; Dont Tidy me! If @AutoItX64 = 0 Then Local $sData = '0x4D5A90000300000004000000FFFF0000B800000000000000400000000000000000000000000000000000000000000000000000000000000000000000F00000000E1FBA0E00B409CD21B8014CCD21546869732070726F6772616D2063616E6E6F742062652072756E20696E20444F53206D6F64652E0D0D0A2400000000000000C9F688528D97E6018D97E6018D97E60130D870018197E6.... to Func _EzMySql_Dll() ; Dont Tidy me! Local $sData If @AutoItX64 = 0 Then $sData = '0x4D5A90000300000004000000FFFF0000B800000000000000400000000000000000000000000000000000000000000000000000000000000000000000F.... Anyone whos reading this and has the same issue make sure to line up the function and condition correctly and put Local $sData into the function, not into If statement, or else $sData will be undefined in Else statement later. 😬
  3. Apologies I didn't realize. Just thought I know the answer.
  4. I apologize, I think I used to have the script on my old computer but I can't find it now and I can't find that UDF either, I will look for another solution today. Will let you know if I find anything.
  5. I might be wrong but there is a .dll for it <AutoItX3.dll> example: #include <AutoItX3.dll> ; Initialize AutoIt _AutoItX_Startup() ; Create a scheduled task to run the program after wakeup $sTaskName = "RunAfterWake" $sProgramPath = "C:\Path\To\Your\Program.exe" ; Set the trigger for the task (on computer wake) $sTrigger = '<QueryList><Query Id="0" Path="System"><Select Path="System">*[System[(EventID=1)]]</Select></Query></QueryList>' ; Set the action to run the program $sAction = 'cmd /c "' & $sProgramPath & '"' ; Create the scheduled task $nTaskCreated = _AutoItX_ScheduledTaskCreate($sTaskName, $sTrigger, $sAction) ; Check if the task was created successfully If $nTaskCreated = 0 Then MsgBox(16, "Error", "Failed to create scheduled task.") ElseIf $nTaskCreated = 1 Then MsgBox(64, "Success", "Scheduled task created successfully.") EndIf ; Shutdown AutoIt _AutoItX_Shutdown() let me know if it worked
  6. Don't know if you tried it but first Download the AutoItX package from the official website. Extract the package and copy the "AutoItX3.dll" file to your AutoIt installation folder. Initialize SDL and create a fullscreen window: _SDL_Init() _SDL_SetHint($SDL_HINT_RENDER_SCALE_QUALITY, "1") ; Optional: Set rendering quality hint ; Create a fullscreen SDL window Global $window = _SDL_CreateWindow("Fullscreen Image", $SDL_WINDOWPOS_UNDEFINED, $SDL_WINDOWPOS_UNDEFINED, @DesktopWidth, @DesktopHeight, BitOR($SDL_WINDOW_FULLSCREEN, $SDL_WINDOW_SHOWN)) If Not $window Then MsgBox(16, "Error", "Failed to create SDL window.") _SDL_Quit() Exit EndIf ; Create a renderer for the window Global $renderer = _SDL_CreateRenderer($window, -1, $SDL_RENDERER_ACCELERATED) If Not $renderer Then MsgBox(16, "Error", "Failed to create SDL renderer.") _SDL_DestroyWindow($window) _SDL_Quit() Exit EndIf Load and render the image on the renderer: ; Load the image using SDL_Image Global $imageSurface = _IMG_Load("path/to/image.jpg") If Not $imageSurface Then MsgBox(16, "Error", "Failed to load image.") _SDL_DestroyRenderer($renderer) _SDL_DestroyWindow($window) _SDL_Quit() Exit EndIf ; Create a texture from the image surface Global $imageTexture = _SDL_CreateTextureFromSurface($renderer, $imageSurface) If Not $imageTexture Then MsgBox(16, "Error", "Failed to create texture.") _SDL_FreeSurface($imageSurface) _SDL_DestroyRenderer($renderer) _SDL_DestroyWindow($window) _SDL_Quit() Exit EndIf ; Clear the renderer and render the image texture _SDL_RenderClear($renderer) _SDL_RenderCopy($renderer, $imageTexture, 0, 0) _SDL_RenderPresent($renderer) Process the SDL events and handle the window close event: Local $event = _SDL_EventStruct() Local $quit = False While Not $quit While _SDL_PollEvent($event) If $event.type = $SDL_QUIT Then $quit = True EndIf WEnd ; Your main program logic goes here WEnd Clean up and quit SDL when finished: _SDL_DestroyTexture($imageTexture) _SDL_FreeSurface($imageSurface) _SDL_DestroyRenderer($renderer) _SDL_DestroyWindow($window) _SDL_Quit() for example like this: #include <AutoItX3.dll> #include <SDL.au3> #include <SDL_Image.au3> _SDL_Init() _SDL_SetHint($SDL_HINT_RENDER_SCALE_QUALITY, "1") ; Optional: Set rendering quality hint Global $window = _SDL_CreateWindow("Fullscreen Image", $SDL_WINDOWPOS_UNDEFINED, $SDL_WINDOWPOS_UNDEFINED, @DesktopWidth, @DesktopHeight, BitOR($SDL_WINDOW_FULLSCREEN, $SDL_WINDOW_SHOWN)) If Not $window Then MsgBox(16, "Error", "Failed to create SDL window.") _SDL_Quit() Exit EndIf Global $renderer = _SDL_CreateRenderer($window, -1, $SDL_RENDERER_ACCELERATED) If Not $renderer Then MsgBox(16, "Error", "Failed to create SDL renderer.") _SDL_DestroyWindow($window) _SDL_Quit() Exit EndIf Global $imageSurface = _IMG_Load("path/to/image.jpg") If Not $imageSurface Then MsgBox(16, "Error", "Failed to load image.") _SDL_DestroyRenderer($renderer) _SDL_DestroyWindow($window) _SDL_Quit() Exit EndIf Global $imageTexture = _SDL_CreateTextureFromSurface($renderer, $imageSurface) If Not $imageTexture Then MsgBox(16, "Error", "Failed to create texture.") _SDL_FreeSurface($imageSurface) _SDL_DestroyRenderer($renderer) _SDL_DestroyWindow($window) _SDL_Quit() Exit EndIf _SDL_RenderClear($renderer) _SDL_RenderCopy($renderer, $imageTexture, 0, 0) _SDL_RenderPresent($renderer) Local $event = _SDL_EventStruct() Local $quit = False While Not $quit While _SDL_PollEvent($event) If $event.type = $SDL_QUIT Then $quit = True EndIf WEnd ; Your main program logic goes here WEnd _SDL_DestroyTexture($imageTexture) _SDL_FreeSurface($imageSurface) _SDL_DestroyRenderer($renderer) _SDL_DestroyWindow($window) _SDL_Quit() replace path with your path
  7. By the way I made this function that you can add to EzMySql.au3 udf to check if value already exists in database to prevent multiple identical records if anyone needs it. Func EntryExistsInDatabase($$str_column1, $str_column2) Local $existingQuery = "SELECT COUNT(*) FROM Computers WHERE SerialNumber = '" & $str_column1 & "' AND ComputerName = '" & $str_column2 & "'" Local $existingResult = _EzMySql_Exec($existingQuery) If @error Then MsgBox(16, "Error", "Failed to execute the existing entry check query.") Return False EndIf If $existingResult = 1 Then Return True Else Return False EndIf EndFunc example: Func data_computers_insert() Local $str_column1 Local $str_column2 Local $str_column3 Local $sqlQuery ; Start the MySQL connection _EzMySql_Startup() ; Open the connection to the database _EzMySql_Open($str_db_host, $str_db_user, $str_db_password, $str_database, "3306") If @error Then MsgBox(16, "Error", "Failed to open the MySQL connection.") Return EndIf ; Set the values for the computer $str_column1 = RegRead("HKEY_LOCAL_MACHINE\HARDWARE\DESCRIPTION\System\BIOS", "SystemProductName") If @error Then MsgBox(16, "Error", "Failed to read the serial number from the registry.") _EzMySql_Close() _EzMySql_ShutDown() Return EndIf $str_column2 = @ComputerName $str_column3 = @YEAR & "-" & @MON & "-" & @MDAY ; Check if the entry already exists If EntryExistsInDatabase($str_column1, $str_column2) Then ;modify however you want MsgBox(16, "Error", "Entry already exists in the database.") _EzMySql_Close() _EzMySql_ShutDown() Return EndIf ; Build the SQL query $sqlQuery = "INSERT INTO Computers (SerialNumber, ComputerName, SubmissionDate) VALUES ('" & $str_column1 & "', '" & $str_column2 & "', '" & $str_column3 & "')" ; Display the SQL query in the console ConsoleWrite("SQL Query: " & $sqlQuery & @CRLF) ; Execute the query _EzMySql_Exec($sqlQuery) If @error Then MsgBox(16, "Error", "Failed to execute the SQL query.") _EzMySql_Close() _EzMySql_ShutDown() Return EndIf _EzMySql_Close() _EzMySql_ShutDown() EndFunc You can modify it to meet your specific requirements. I tested it and turns out that it's able to create .dll 32 bit even when its compiled, so I guess the issue is somewhere where 64 bit .dll is created.
  8. I am encountering a perplexing issue while running a script, and I would appreciate your insights and assistance in resolving it. Here's a brief description of the problem: When I execute the script within the AutoIt environment, it runs smoothly without any errors or problems. However, when I compile the script into an executable and attempt to run it, an error occurs stating, "Variable used without being declared." I have made diligent efforts to identify the undeclared variable, but unfortunately, I have been unsuccessful in locating it. I have reviewed EzMySqll.au3 UDF made by @Yoriz thoroughly, and declared all undeclared variables now they all appear to be appropriately declared before usage. Global $str_db_host, $str_db_user, $str_db_password, $str_database Func data_computers_insert() Local $serialNumber Local $computerName Local $submissionDate Local $sqlQuery ; Start the MySQL connection _EzMySql_Startup() ; Open the connection to the database _EzMySql_Open($str_db_host, $str_db_user, $str_db_password, $str_database, "3306") If @error Then MsgBox(16, "Error", "Failed to open the MySQL connection.") Return EndIf ; Set the values for the computer $serialNumber = RegRead("HKEY_LOCAL_MACHINE\HARDWARE\DESCRIPTION\System\BIOS", "SystemProductName") If @error Then MsgBox(16, "Error", "Failed to read the serial number from the registry.") _EzMySql_Close() _EzMySql_ShutDown() Return EndIf $computerName = @ComputerName $submissionDate = @YEAR & "-" & @MON & "-" & @MDAY ; Build the SQL query $sqlQuery = "INSERT INTO Computers (SerialNumber, ComputerName, SubmissionDate) VALUES ('" & $serialNumber & "', '" & $computerName & "', '" & $submissionDate & "')" ; Display the SQL query in the console ConsoleWrite("SQL Query: " & $sqlQuery & @CRLF) ; Execute the query _EzMySql_Exec($sqlQuery) If @error Then MsgBox(16, "Error", "Failed to execute the SQL query.") _EzMySql_Close() _EzMySql_ShutDown() Return EndIf _EzMySql_Close() _EzMySql_ShutDown() EndFunc I run this script using mentioned UDF. But I keep getting error when my program is compiled. After error msgbox there is an empty file created called libmySQL_x64.dll, and its only created there when I get an error.
  9. My data was too long for the column, I had to Modify Column in Table first. Thank youu ❤️ @Andreik I should probably take a break from coding today XD
  10. yea the error code is 3 Func _EzMySql_Exec($querystring) Local $execError, $iNextResult If $sEzMySql_Result Then _EzMySql_QueryFinalize() If Not $hEzMySql_Ptr Then Return SetError(1, 0, 0) If Not $querystring Then Return SetError(5, 0, 0) $querystringlength = StringLen($querystring) _EzMySql_MultiLine() Local $query = DllCall($hEzMySql_Dll, "int", "mysql_real_query", "ptr", $hEzMySql_Ptr, "str", $querystring, "ulong", $querystringlength) If @error Then $execError = 2 If _EzMySql_ErrMsg() Then Return SetError(3, 0, 0) Do Local $result = DllCall($hEzMySql_Dll, "ptr", "mysql_store_result", "ptr", $hEzMySql_Ptr) $sEzMySql_Result = $result[0] _EzMySql_QueryFinalize() $iNextResult = DllCall($hEzMySql_Dll, "int", "mysql_next_result", "ptr", $hEzMySql_Ptr) Until $iNextResult[0] <> 0 _EzMySql_MultiLine(False) If $execError Then Return SetError($execError, 0, 0) Return 1 EndFunc ;==>_EzMySql_Exec which was set by _EzMySql_ErrMsg() according to this I suppose and that function is here but i don't see any 3s ; #FUNCTION# ==================================================================================================================== ; Name...........: _EzMySql_ErrMsg ; Description ...: returns a null-terminated string containing the error message for the most recen function that failed. ; Syntax.........: _EzMySql_ErrMsg() ; Parameters ....: None ; Return values .: On Success - A null-terminated character string that describes the error. An empty string if no error occurred ; Return values .: On Failure - returns 0 and @error value ; 1 - A MySQL struct does not exist ; 2 - Dll Call failed ; Author ........: Yoriz ; Based on script: MySQL UDFs working with libmysql.dll by Prog@ndy ; =============================================================================================================================== Func _EzMySql_ErrMsg() If Not $hEzMySql_Ptr Then Return SetError(1, 0, 0) Local $errors = DllCall($hEzMySql_Dll, "str", "mysql_error", "ptr", $hEzMySql_Ptr) If @error Then Return SetError(2, 0, 0) If $errors[0] Then Return $errors[0] Return 0 EndFunc ;==>_EzMySql_ErrMsg
  11. I think I fixed that by just declaring them again but now im getting error while executing a query Func data_computers_insert() Local $serialNumber Local $computerName Local $submissionDate Local $sqlQuery ; Start the MySQL connection _EzMySql_Startup() ; Open the connection to the database _EzMySql_Open($str_db_host, $str_db_user, $str_db_password, $str_database, "3306") If @error Then MsgBox(16, "Error", "Failed to open the MySQL connection.") Return EndIf ; Set the values for the computer $serialNumber = RegRead("HKEY_LOCAL_MACHINE\HARDWARE\DESCRIPTION\System\BIOS", "SystemProductName") If @error Then MsgBox(16, "Error", "Failed to read the serial number from the registry.") _EzMySql_Close() _EzMySql_ShutDown() Return EndIf $computerName = @ComputerName $submissionDate = @YEAR & "-" & @MON & "-" & @MDAY ; Build the SQL query $sqlQuery = "INSERT INTO Computer (serial_number, computer_name, submission_date) VALUES ('" & $serialNumber & "', '" & $computerName & "', '" & $submissionDate & "')" ; Execute the query _EzMySql_Exec($sqlQuery) If @error Then MsgBox(16, "Error", "Failed to execute the SQL query.") _EzMySql_Close() _EzMySql_ShutDown() Return EndIf _EzMySql_Close() _EzMySql_ShutDown() EndFunc this one : MsgBox(16, "Error", "Failed to execute the SQL query.")
  12. I'm getting error that variable is not declared even tho its declared right here EzMySql.au3" (98) : ==> Variable used without being declared.: $hEzMySql_Dll = DllOpen($hEzMySql_DllLoc) ^ ERROR
  13. I encountered issues while attempting to use the EzMySql UDF made by @Yoriz Specifically, I faced difficulties in creating the .dll file using http://www.mediafire.com/?ztmzzlozzlw, which turned out to be empty. While running the AutoIt script, I encountered some undeclared global and local variables, which I tried to rectify. However, despite my efforts, I am still encountering the following error when running the script: After this MsgBox it creates empty .dll file in script directory. If anyone knows what could be causing this please let me know.
  14. Install the "Code Runner" extension in VS Code that allows you to run code snippets or scripts within VS Code itself. Create a new AutoIt script file (for example main.au3) that will act as the entry point for running your desired script. In main.au3, use the Run function from AutoIt to execute your target AutoIt script. For example: Run("path\to\your\script.au3") Replace "path\to\your\script.au3" with the actual path to your target AutoIt script. Save main.au3 and open it in VS Code. Use the keyboard shortcut Ctrl + Alt + N (or go to Code -> Run Code from the VS Code menu) to run main.au3. The console output of your target script will be displayed in the "OUTPUT" tab in VS Code. You will be able to see the logs as the script runs. Regarding your second question, by default, the console OUTPUT in VS Code will display the output of the current script run. If you run the script again, the previous output will be replaced by the new output. To view all logs from multiple runs, you may need to modify your script to write the logs to a file or append them to an existing log file Also effectiveness of logging depends on how your target AutoIt script handles logging internally.
  15. To disable or enable a monitor you can use the DllCall the function I suppose, to call Windows API functions. Here's an example of how you can disable and enable a monitor using the EnumDisplayMonitors and ChangeDisplaySettingsEx functions: #include <WinAPI.au3> #include <Constants.au3> Global Const $DISPLAY_DEVICE_ATTACHED_TO_DESKTOP = 0x1 Global Const $DMDO_DEFAULT = 0x0 Global Const $DMDO_90 = 0x1 Global Const $DMDO_180 = 0x2 Global Const $DMDO_270 = 0x3 Global Const $ENUM_CURRENT_SETTINGS = -1 Func DisableMonitor($iIndex) Local $hMonitor = _WinAPI_EnumDisplayMonitors(0, 0) Local $iCount = @extended If $iIndex < 0 Or $iIndex >= $iCount Then Return False Local $aMonitorInfo = _WinAPI_GetMonitorInfo($hMonitor[$iIndex]) Local $hDeviceName = $aMonitorInfo[3] Local $tDevMode = DllStructCreate($tagDEVMODE) DllCall("user32.dll", "int", "EnumDisplaySettings", "ptr", 0, "int", $ENUM_CURRENT_SETTINGS, "ptr", DllStructGetPtr($tDevMode)) DllStructSetData($tDevMode, "PelsWidth", 1) DllStructSetData($tDevMode, "PelsHeight", 1) DllStructSetData($tDevMode, "DisplayFlags", BitOR(DllStructGetData($tDevMode, "DisplayFlags"), $DM_INTERLACED)) DllStructSetData($tDevMode, "Fields", BitOR(DllStructGetData($tDevMode, "Fields"), $DM_DISPLAYFLAGS)) Local $aResult = DllCall("user32.dll", "int", "ChangeDisplaySettingsEx", "str", $hDeviceName, "ptr", DllStructGetPtr($tDevMode), "hwnd", 0, "int", $CDS_UPDATEREGISTRY, "ptr", 0) Return $aResult[0] = $DISP_CHANGE_SUCCESSFUL EndFunc Func EnableMonitor($iIndex) Local $hMonitor = _WinAPI_EnumDisplayMonitors(0, 0) Local $iCount = @extended If $iIndex < 0 Or $iIndex >= $iCount Then Return False Local $aMonitorInfo = _WinAPI_GetMonitorInfo($hMonitor[$iIndex]) Local $hDeviceName = $aMonitorInfo[3] Local $aResult = DllCall("user32.dll", "int", "ChangeDisplaySettingsEx", "str", $hDeviceName, "ptr", 0, "hwnd", 0, "int", $CDS_UPDATEREGISTRY, "ptr", 0) Return $aResult[0] = $DISP_CHANGE_SUCCESSFUL EndFunc ; Example usage: DisableMonitor(2) ; Disable the third monitor Sleep(10000) ; Wait for 10 seconds EnableMonitor(2) ; Enable the third monitor You can adjust the index passed to the DisableMonitor and EnableMonitor functions to disable or enable a specific monitor. Make sure to call DisableMonitor before opening the .rdp file and EnableMonitor after a delay to re-enable the monitor.
  16. Add the required UDF includes at the beginning of your script: #include <Array.au3> #include <ConsoleConstants.au3> #include <MsgBoxConstants.au3> #include <WinAPIFiles.au3> insert the following code after the _InfoRAM() function: Func _InfoPrinters() Local $oWMI = ObjGet("winmgmts:\\.\root\cimv2") Local $oPrint = $oWMI.ExecQuery("SELECT * FROM Win32_Printer", "WQL", 0x30) Local $iCount = 0, $vTemp = "" For $oItem In $oPrint $iCount += 1 $vTemp &= StringFormat("Printer #%u: %s\n", $iCount, $oItem.Name) Next If $iCount = 0 Then $vTemp = "No printers installed" Return $vTemp EndFunc Modify the line where you write the computer configuration report to include the printer information: $sInfo &= _InfoPC() $sInfo &= _InfoRAM() $sInfo &= _InfoPrinters() FileWrite($hFile, $sInfo) FileClose($hFile) Place the code snippet you provided after the line where you write the computer configuration report: Opt('MustDeclareVars', True) Local $oWMI, $oPrint, $oItem, $iCount, $vTemp $oWMI = ObjGet('winmgmts:\\.\root\cimv2') $oPrint = $oWMI.ExecQuery('SELECT * FROM Win32_Printer', 'WQL', 0x30) $iCount = 0 For $oItem In $oPrint $iCount += 1 $vTemp = StringFormat("Printer #%u = '%s'\n", $iCount, $oItem.Name) ConsoleWrite($vTemp) Next If ($iCount = 0) Then ConsoleWrite('No printer installed') Exit With these changes, the computer configuration report will include the printer information retrieved using WMI.
  17. The code you provided is not working because the ShellExecute function is used to open a file or folder with its associated program, not to select a file in a folder. To select a file in a folder using AutoIt, you can use the FileSelectFolder function to prompt the user to select a folder, and then use the FileFindFirstFile and ControlListView functions to select the desired file in the folder. #include <FileConstants.au3> #include <MsgBoxConstants.au3> Local $sFolderPath = FileSelectFolder("Select a folder", "") If @error Then MsgBox($MB_OK, "Error", "No folder selected.") Exit EndIf Local $sFileName = "10GB_1.bin" Local $hSearch = FileFindFirstFile($sFolderPath & "\*") If $hSearch = -1 Then MsgBox($MB_OK, "Error", "No files found in the selected folder.") Exit EndIf Local $sFile While 1 $sFile = FileFindNextFile($hSearch) If @error Then ExitLoop If StringCompare($sFile, $sFileName) = 0 Then ExitLoop WEnd FileClose($hSearch) If Not StringCompare($sFile, $sFileName) = 0 Then MsgBox($MB_OK, "Error", "File '" & $sFileName & "' not found in the selected folder.") Exit EndIf Local $hWnd = WinGetHandle("[CLASS:CabinetWClass]") ControlListView($hWnd, "", "SysListView321", "Select", $sFileName) This example code assumes the folder window is of class [CLASS:CabinetWClass] and the file list view control has a class name of SysListView321. You may need to modify these values based on the specific application or window you are working with.
  18. Try use the UIA_BackgroundColorAttributeId attribute and the GetCurrentPropertyValue method. #include ".\Include\UIAWrappers.au3" Local $oUIAutomation = ObjCreateInterface($sCLSID_CUIAutomation, $sIID_IUIAutomation, $dtagIUIAutomation) If Not IsObj($oUIAutomation) Then MsgBox(16, "Error", "$oUIAutomation creation failed.") Exit EndIf Local $oElement, $pCondition, $pElements, $sBkColor ; Find the text control with a green background $oUIAutomation.CreatePropertyCondition($UIA_ControlTypePropertyId, $UIA_TextControlTypeId, $pCondition) $oUIAutomation.ElementFromHandle($HWND, $oElement) $oElement.FindFirst($TreeScope_Descendants, $pCondition, $pElements) $oElement = ObjCreateInterface($pElements, $sIID_IUIAutomationElement, $dtagIUIAutomationElement) If Not IsObj($oElement) Then MsgBox(16, "Error", "Failed to find the text control.") Exit EndIf ; Get the background color attribute If $oElement.GetCurrentPropertyValue($UIA_BackgroundColorAttributeId, $sBkColor) <> $S_OK Then MsgBox(16, "Error", "Failed to retrieve the background color.") Exit EndIf MsgBox(64, "Background Color", "The background color of the text control is: " & $sBkColor) Replace $HWND with the handle of the target window or control. You can obtain the handle using AutoIt's built-in functions such as WinGetHandle or ControlGetHandle. Please note that UI Automation relies on the accessibility features of the target application, so not all applications may provide the necessary information to retrieve the background-color attribute. You can try the PixelGetColor function as an alternative when UI Automation is unable to retrieve the background color of a control. #include ".\Include\UIAWrappers.au3" Local $oUIAutomation = ObjCreateInterface($sCLSID_CUIAutomation, $sIID_IUIAutomation, $dtagIUIAutomation) If Not IsObj($oUIAutomation) Then MsgBox(16, "Error", "$oUIAutomation creation failed.") Exit EndIf Local $oElement, $pCondition, $pElements, $sBkColor ; Attempt to retrieve the background color using UI Automation $oUIAutomation.CreatePropertyCondition($UIA_ControlTypePropertyId, $UIA_TextControlTypeId, $pCondition) $oUIAutomation.ElementFromHandle($HWND, $oElement) $oElement.FindFirst($TreeScope_Descendants, $pCondition, $pElements) $oElement = ObjCreateInterface($pElements, $sIID_IUIAutomationElement, $dtagIUIAutomationElement) If IsObj($oElement) Then ; UI Automation succeeded, get the background color attribute If $oElement.GetCurrentPropertyValue($UIA_BackgroundColorAttributeId, $sBkColor) = $S_OK Then MsgBox(64, "Background Color", "The background color of the text control is: " & $sBkColor) Exit EndIf EndIf ; UI Automation failed, attempt to retrieve the background color using PixelGetColor Local $x = 100 ; X-coordinate of the pixel Local $y = 100 ; Y-coordinate of the pixel $sBkColor = PixelGetColor($x, $y) MsgBox(64, "Pixel Color", "The color of the pixel at (" & $x & ", " & $y & ") is: 0x" & Hex($sBkColor, 6)) PixelGetColor function retrieves the color of a pixel on the screen, not from a specific control or window. If you need to retrieve the color of a pixel within a specific window or control, you may need to combine PixelGetColor with other AutoIt functions such as WinGetPos or ControlGetPos to obtain the coordinates relative to the desired window or control.
  19. Navigate to the directory where you want to create the text file. You can use the cd command to change directories. cd C:\Users\YourUsername\Documents Use the echo command followed by the text you want to write to the file, and then use the > symbol to redirect the output to a file. echo Hello, World! > output.txt
  20. Here is a script if you really want it ; control key is a @ ; escalator is script Exit https://www.autoitscript.com/autoit3/docs/libfunctions/_IsPressed.htm but as other people suggested you should probably find a better way to fix your issue <Misc.au3> HotKeySet("{ESC}", "TerminateScript") Global $shouldRun = True While $shouldRun If _IsPressed("11") Then ; Check if Control key is pressed Send("@") Sleep(100) ; Pause for 100 milliseconds to prevent rapid repetition EndIf Sleep(10) ; Pause for 10 milliseconds to reduce CPU usage WEnd Func TerminateScript() $shouldRun = False Exit EndFunc let me know if it worked
  21. Upon careful analysis, we discovered that the root cause of the problem was my oversight in using a 64-bit driver with a 32-bit version of AutoIt. I must admit that this was a rather foolish mistake on my part, and I apologize for any inconvenience it may have caused. It was only through your keen insight and knowledge that I was able to identify and rectify the issue. I sincerely appreciate your patience and understanding throughout this process. Your willingness to lend a helping hand and share your insights has been instrumental in resolving the problem. Without your guidance, I would not have realized the mismatch between the driver and AutoIt versions. Now that the initial issue has been addressed, I am confident that I will be able to proceed with creating the code to add values to the database on my own. However, I want to acknowledge that I couldn't have reached this point without your support and guidance. Once again, thank you for your invaluable assistance. Your expertise and willingness to help are greatly appreciated. If there's anything I can do to return the favor or assist you in any way, please do not hesitate to let me know. Warmest regards ❤️ please don't be mad
  22. I'm up to install 32 bit driver instead and I will update then just have to fix this issue first:
  23. its supposed to be MySQL
  24. I have 32 bit ODBC Driver 17 for SQL Server and SQL Server and 64 bit MySQL ODBC 8.0 ANSI Driver, MySQL ODBC 8.0 Unicode Driver, ODBC Driver 17 for SQL Server and SQL Server I'm afraid that I was using MySQL ODBC 8.0 ANSI Driver 64 bit on 32 bit Autoit.
  25. output: temprun.au3 (13) : ==> COM Error intercepted ! err.number is: 0x80020009 err.windescription: Exception occurred. err.description is: [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified err.source is: Microsoft OLE DB Provider for ODBC Drivers err.helpfile is: err.helpcontext is: 0 err.lastdllerror is: 0 err.scriptline is: 13 err.retcode is: 0x80004005 temprun.au3 (15) : ==> COM Error intercepted ! err.number is: 0x80020009 err.windescription: Exception occurred. err.description is: Operation is not allowed when the object is closed. err.source is: ADODB.Connection err.helpfile is: C:\Windows\HELP\ADO270.CHM err.helpcontext is: 1240653 err.lastdllerror is: 0 err.scriptline is: 15 err.retcode is: 0x800A0E78 temprun.au3 (16) : ==> COM Error intercepted ! err.number is: 0x000000A9 err.windescription: Variable must be of type 'Object'. err.description is: err.source is: err.helpfile is: err.helpcontext is: err.lastdllerror is: 0 err.scriptline is: 16 err.retcode is: 0x00000000 temprun.au3 (886) : ==> COM Error intercepted ! err.number is: 0x80020009 err.windescription: Exception occurred. err.description is: Operation is not allowed when the object is closed. err.source is: ADODB.Connection err.helpfile is: C:\Windows\HELP\ADO270.CHM err.helpcontext is: 1240653 err.lastdllerror is: 0 err.scriptline is: 886 err.retcode is: 0x800A0E78
×
×
  • Create New...