-
Posts
54 -
Joined
-
Last visited
Profile Information
-
Member Title
Will code for food 🍜
Recent Profile Visitors
486 profile views
20Ice18's Achievements
-
matteus_71 reacted to a post in a topic: Need a script that type @ - (Moved)
-
20Ice18 reacted to a post in a topic: run program on wake from standby?
-
Sorry I didn't know they can merge. 😶
-
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. 😬
-
Apologies I didn't realize. Just thought I know the answer.
-
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.
-
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
-
Show full screen image using SDL UDF
20Ice18 replied to Belini's topic in AutoIt General Help and Support
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 -
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.
-
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.
-
ayu_2403 reacted to a post in a topic: Select File in Folder View
-
20Ice18 reacted to a post in a topic: EzMySql_Dll.au3 Problems with creating .dll
-
EzMySql_Dll.au3 Problems with creating .dll
20Ice18 replied to 20Ice18's topic in AutoIt General Help and Support
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 -
20Ice18 reacted to a post in a topic: EzMySql_Dll.au3 Problems with creating .dll
-
EzMySql_Dll.au3 Problems with creating .dll
20Ice18 replied to 20Ice18's topic in AutoIt General Help and Support
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 -
EzMySql_Dll.au3 Problems with creating .dll
20Ice18 replied to 20Ice18's topic in AutoIt General Help and Support
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.") -
EzMySql_Dll.au3 Problems with creating .dll
20Ice18 replied to 20Ice18's topic in AutoIt General Help and Support
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 -
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.
-
20Ice18 reacted to a post in a topic: EzMySql UDF - Use MySql Databases with autoit
-
20Ice18 reacted to a post in a topic: Show "ENTER/CR" in Richedit - (Moved)
-
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.
-
20Ice18 reacted to a post in a topic: Disabling a 3rd monitor while running a function and then powering back on
-
Yedidya reacted to a post in a topic: Disabling a 3rd monitor while running a function and then powering back on
-
20Ice18 reacted to a post in a topic: Active Directory problem - User Cannot Change Password
-
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.