Leaderboard
Popular Content
Showing content with the highest reputation on 01/31/2014 in all areas
-
This topic will contain simple and working client server communication example along with some basic info for understanding. Examples are based on multi client communication that is happening on one computer (localhost). Changing (if it's not already set correctly) the IP address parameter on server script to reflect your network device IP address will allow you to communicate with other clients on network or even to communicate on internet if your network settings (forwarded router port, ip address on that port is seen from others on internet, you're not trying to do client server from identical computer on identical internet connection) are configured correctly. Every client connecting will need to have server IP address for network (or server public IP address for internet) connection in his client script. So edit client script to correspond to server address TCPConnect('type server ip address in client', 1018). Sometimes firewall can be your problem, if something isn't working turn off firewall and see if it helps. Server will always listen on his Network Adapter IP Address and not on his public address. In some rare occasions server can be set to listen on 0.0.0.0, with that he will listen from any device that he have physically connected on his MB USB or something third (with localhost included for listening). But i would not know the end result of what will happen if some other program that you have installed need that port (or you started 2 servers that interpret one with another). First part will hold just plain code.Second part will hold identical code with comments below commands for more info and understanding hopefully to help new autoit users to understand what and why that something is there.Other parts will hold additional info.First part: Working Code (working in two way communication, with multiple and-or identical client)Server #include <Array.au3> TCPStartup() Dim $Socket_Data[1] $Socket_Data[0] = 0 $Listen = TCPListen(@IPAddress1, 1018, 500) If @error Then ConsoleWrite('!--> TCPListen error number ( ' & @error & ' ), look in the help file (on MSDN link) on func TCPListen to get more info about this error.' & @CRLF) Exit EndIf While 1 For $x = $Socket_Data[0] To 1 Step -1 $Recv = TCPRecv($Socket_Data[$x], 1000000) If $Recv Then MsgBox(0, 'Client Number ' & $x & ' with connected socket identifier ' & $Socket_Data[$x], 'Recived msg from Client: ' & @CRLF & $Recv, 5) TCPSend($Socket_Data[$x], 'bye') TCPCloseSocket($Socket_Data[$x]) _ArrayDelete($Socket_Data, $x) $Socket_Data[0] -= 1 EndIf Next _Accept() WEnd Func _Accept() Local $Accept = TCPAccept($Listen) If $Accept <> -1 Then _ArrayAdd($Socket_Data, $Accept) $Socket_Data[0] += 1 EndIf EndFunc ;==>_AcceptClient TCPStartup() $Socket = TCPConnect(@IPAddress1, 1018) If @error Then ConsoleWrite('!--> TCPConnect error number ( ' & @error & ' ), look in the help file (on MSDN link) on func TCPConnect to get more info about this error.' & @CRLF) Exit EndIf TCPSend($Socket, 'Hi there. My computer name is' & ", " & @ComputerName & ", and its drive serial is " & DriveGetSerial(@HomeDrive)) Do $Recv = TCPRecv($Socket, 1000000) Until $Recv MsgBox(0, 'Recived from server:', $Recv)Second part: Explained Working Code (for upper communication) Third Part: Understanding for how is msg received with TCPRecv on server (or on client) Forth Part: Packets Fifth Part: How to get or check IP address of your device? Sixth Part: How to forward ports? (2 nice youtube tutorials) Seventh Part: Internet communication? If i wrote something incorrectly or wrong please tell me so that i can correct it. Edited: Local and Global, added aditional info about reciving msgs for maxlen buffer.1 point
-
Here is a UDF that allows you to easily read and write to the registry keys that control User Account Control (UAC). I wrote this UDF while I was working on a project for Windows 7 that required reboots, and for the script to start on its own, with the full administrator rights, after the PC auto logged in without the issue of the UAC prompt. The functions I used the most was _UAC_GetConsentPromptBehaviorAdmin and _UAC_SetConsentPromptBehaviorAdmin, but I decided to go ahead and write a full UDF for the all the UAC values. For usage, please look a the function headers.I hope other finds this UDF useful. UAC.au3 #include-once ;~ #AutoIt3Wrapper_AU3Check_Parameters= -d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 ;~ #AutoIt3Wrapper_AU3Check_Stop_OnWarning=Y ;~ #Tidy_Parameters=/sf ; #INDEX# ======================================================================================================================= ; Title .........: User Account Control (UAC) UDF for Windows Vista and higher. ; AutoIt Version : 3.3.6++ ; UDF Version ...: 1.0 ; Language ......: English ; Description ...: Get or Set UAC registry settings in Windows Vista or higher. ; Dll ...........: ; Author(s) .....: Adam Lawrence (AdamUL) ; Email .........: ; Modified ......: ; Contributors ..: ; Resources .....: http://technet.microsoft.com/en-us/library/dd835564(v=ws.10).aspx#BKMK_RegistryKeys ; http://www.autoitscript.com/forum/topic/122050-useful-snippets-collection-thread/page__p__847186#entry847186 (Post #1, item 8.) ; Remarks .......: #RequireAdmin and/or #AutoIt3Wrapper_Res_requestedExecutionLevel=requireAdministrator is needed for "Set" functions to work in this UDF. ; =============================================================================================================================== ; #CURRENT# ===================================================================================================================== ;_UAC_GetConsentPromptBehaviorAdmin ;_UAC_GetConsentPromptBehaviorUser ;_UAC_GetEnableInstallerDetection ;_UAC_GetEnableLUA ;_UAC_GetEnableSecureUIAPaths ;_UAC_GetEnableUIADesktopToggle ;_UAC_GetEnableVirtualization ;_UAC_GetFilterAdministratorToken ;_UAC_GetPromptOnSecureDesktop ;_UAC_GetValidateAdminCodeSignatures ;_UAC_SetConsentPromptBehaviorAdmin ;_UAC_SetConsentPromptBehaviorUser ;_UAC_SetEnableInstallerDetection ;_UAC_SetEnableLUA ;_UAC_SetEnableSecureUIAPaths ;_UAC_SetEnableUIADesktopToggle ;_UAC_SetEnableVirtualization ;_UAC_SetFilterAdministratorToken ;_UAC_SetPromptOnSecureDesktop ;_UAC_SetValidateAdminCodeSignatures ; =============================================================================================================================== ; #CONSTANTS# =================================================================================================================== Global Const $UAC_ELEVATE_WITHOUT_PROMPTING = 0 Global Const $UAC_PROMPT_FOR_CREDENTIALS_SECURE_DESKTOP = 1 Global Const $UAC_PROMPT_FOR_CONSENT_SECURE_DESKTOP = 2 Global Const $UAC_PROMPT_FOR_CREDENTIALS = 3 Global Const $UAC_PROMPT_FOR_CONSENT = 4 Global Const $UAC_PROMPT_FOR_CONSENT_NONWINDOWS_BINARIES = 5 Global Const $UAC_AUTOMATICALLY_DENY_ELEVATION_REQUESTS = 0 Global Const $UAC_DISABLED = 0 Global Const $UAC_ENABLED = 1 ; =============================================================================================================================== ; #FUNCTION# ==================================================================================================================== ; Name ..........: _UAC_GetConsentPromptBehaviorAdmin ; Description ...: Gets UAC Registry Key for ConsentPromptBehaviorAdmin. Behavior of the elevation prompt for administrators in Admin Approval Mode. ; Syntax ........: _UAC_GetConsentPromptBehaviorAdmin() ; Parameters ....: None. ; Return values .: Success - Registry Value ; |$UAC_ELEVATE_WITHOUT_PROMPTING (0) - Elevate without prompting (Use this option only in the most constrained environments). ; |$UAC_PROMPT_FOR_CREDENTIALS_SECURE_DESKTOP (1) - Prompt for credentials on the secure desktop. ; |$UAC_PROMPT_FOR_CONSENT_SECURE_DESKTOP (2) - Prompt for consent on the secure desktop. ; |$UAC_PROMPT_FOR_CREDENTIALS (3) - Prompt for credentials. ; |$UAC_PROMPT_FOR_CONSENT (4) - Prompt for consent. ; |$UAC_PROMPT_FOR_CONSENT_NONWINDOWS_BINARIES (5) - Prompt for consent for non-Windows binaries (default). ; Failure - -1, sets @error to: ; |1 - if unable to open requested key ; |2 - if unable to open requested main key ; |3 - if unable to remote connect to the registry ; |-1 - if unable to open requested value ; |-2 - if value type not supported ; |-3 - Invalid key on OS. ; Author ........: Adam Lawrence (AdamUL) ; Modified ......: TheXman ; Remarks .......: Admin rights not required to read the value. ; Related .......: ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func _UAC_GetConsentPromptBehaviorAdmin() If StringRegExp(@OSVersion, "_(XP|200(0|3))") Then Return SetError(-3, 0, -1) Local $s64Bit = "" If @OSArch = "X64" Then $s64Bit = "64" Local $iReturn = RegRead("HKEY_LOCAL_MACHINE" & $s64Bit & "\Software\Microsoft\Windows\CurrentVersion\Policies\System", "ConsentPromptBehaviorAdmin") If $iReturn == "" Then $iReturn = -1 Return SetError(@error, 0, $iReturn) EndFunc ;==>_UAC_GetConsentPromptBehaviorAdmin ; #FUNCTION# ==================================================================================================================== ; Name ..........: _UAC_GetConsentPromptBehaviorUser ; Description ...: Gets UAC Registry Key for ConsentPromptBehaviorUser. Behavior of the elevation prompt for standard users. ; Syntax ........: _UAC_GetConsentPromptBehaviorUser() ; Parameters ....: None. ; Return values .: Success - Registry Value ; |$UAC_AUTOMATICALLY_DENY_ELEVATION_REQUESTS (0) - Automatically deny elevation requests. ; |$UAC_PROMPT_FOR_CREDENTIALS_SECURE_DESKTOP (1) - Prompt for credentials on the secure desktop (default). ; |$UAC_PROMPT_FOR_CREDENTIALS (3) - Prompt for credentials. ; Failure - -1, sets @error to: ; |1 - if unable to open requested key ; |2 - if unable to open requested main key ; |3 - if unable to remote connect to the registry ; |-1 - if unable to open requested value ; |-2 - if value type not supported ; |-3 - Invalid key on OS. ; Author ........: Adam Lawrence (AdamUL) ; Modified ......: TheXman ; Remarks .......: Admin rights not required to read the value. ; Related .......: ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func _UAC_GetConsentPromptBehaviorUser() If StringRegExp(@OSVersion, "_(XP|200(0|3))") Then Return SetError(-3, 0, -1) Local $s64Bit = "" If @OSArch = "X64" Then $s64Bit = "64" Local $iReturn = RegRead("HKEY_LOCAL_MACHINE" & $s64Bit & "\Software\Microsoft\Windows\CurrentVersion\Policies\System", "ConsentPromptBehaviorUser") If $iReturn == "" Then $iReturn = -1 Return SetError(@error, 0, $iReturn) EndFunc ;==>_UAC_GetConsentPromptBehaviorUser ; #FUNCTION# ==================================================================================================================== ; Name ..........: _UAC_GetEnableInstallerDetection ; Description ...: Gets UAC Registry Key for EnableInstallerDetection. Detect application installations and prompt for elevation. ; Syntax ........: _UAC_GetEnableInstallerDetection() ; Parameters ....: None. ; Return values .: Success - Registry Value ; |$UAC_DISABLED (0) - Disabled (default for enterprise). ; |$UAC_ENABLED (1) - Enabled (default for home). ; Failure - -1, sets @error to: ; |1 - if unable to open requested key ; |2 - if unable to open requested main key ; |3 - if unable to remote connect to the registry ; |-1 - if unable to open requested value ; |-2 - if value type not supported ; |-3 - Invalid key on OS. ; Author ........: Adam Lawrence (AdamUL) ; Modified ......: TheXman ; Remarks .......: Admin rights not required to read the value. ; Related .......: ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func _UAC_GetEnableInstallerDetection() If StringRegExp(@OSVersion, "_(XP|200(0|3))") Then Return SetError(-3, 0, -1) Local $s64Bit = "" If @OSArch = "X64" Then $s64Bit = "64" Local $iReturn = RegRead("HKEY_LOCAL_MACHINE" & $s64Bit & "\Software\Microsoft\Windows\CurrentVersion\Policies\System", "EnableInstallerDetection") If $iReturn == "" Then $iReturn = -1 Return SetError(@error, 0, $iReturn) EndFunc ;==>_UAC_GetEnableInstallerDetection ; #FUNCTION# ==================================================================================================================== ; Name ..........: _UAC_GetEnableLUA ; Description ...: Gets UAC Registry Key for EnableLUA. Run all administrators in Admin Approval Mode. ; Syntax ........: _UAC_GetEnableLUA() ; Parameters ....: None. ; Return values .: Success - Registry Value ; |$UAC_DISABLED (0) - UAC (formally known as LUA) is disabled. ; |$UAC_ENABLED (1) - UAC (formally known as LUA) is enabled. ; Failure - -1, sets @error to: ; |1 - if unable to open requested key ; |2 - if unable to open requested main key ; |3 - if unable to remote connect to the registry ; |-1 - if unable to open requested value ; |-2 - if value type not supported ; |-3 - Invalid key on OS. ; Author ........: Adam Lawrence (AdamUL) ; Modified ......: TheXman ; Remarks .......: Admin rights not required to read the value. ; Related .......: ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func _UAC_GetEnableLUA() If StringRegExp(@OSVersion, "_(XP|200(0|3))") Then Return SetError(-3, 0, -1) Local $s64Bit = "" If @OSArch = "X64" Then $s64Bit = "64" Local $iReturn = RegRead("HKEY_LOCAL_MACHINE" & $s64Bit & "\Software\Microsoft\Windows\CurrentVersion\Policies\System", "EnableLUA") If $iReturn == "" Then $iReturn = -1 Return SetError(@error, 0, $iReturn) EndFunc ;==>_UAC_GetEnableLUA ; #FUNCTION# ==================================================================================================================== ; Name ..........: _UAC_GetEnableSecureUIAPaths ; Description ...: Gets UAC Registry Key for EnableSecureUIAPaths. Only elevate UIAccess applications that are installed in secure locations. ; Syntax ........: _UAC_GetEnableSecureUIAPaths() ; Parameters ....: None. ; Return values .: Success - Registry Value ; |$UAC_DISABLED (0) - Disabled. ; |$UAC_ENABLED (1) - Enabled. ; Failure - -1, sets @error to: ; |1 - if unable to open requested key ; |2 - if unable to open requested main key ; |3 - if unable to remote connect to the registry ; |-1 - if unable to open requested value ; |-2 - if value type not supported ; |-3 - Invalid key on OS. ; Author ........: Adam Lawrence (AdamUL) ; Modified ......: TheXman ; Remarks .......: Admin rights not required to read the value. ; Related .......: ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func _UAC_GetEnableSecureUIAPaths() If StringRegExp(@OSVersion, "_(XP|200(0|3))") Then Return SetError(-3, 0, -1) Local $s64Bit = "" If @OSArch = "X64" Then $s64Bit = "64" Local $iReturn = RegRead("HKEY_LOCAL_MACHINE" & $s64Bit & "\Software\Microsoft\Windows\CurrentVersion\Policies\System", "EnableSecureUIAPaths") If $iReturn == "" Then $iReturn = -1 Return SetError(@error, 0, $iReturn) EndFunc ;==>_UAC_GetEnableSecureUIAPaths ; #FUNCTION# ==================================================================================================================== ; Name ..........: _UAC_GetEnableUIADesktopToggle ; Description ...: Gets UAC Registry Key for EnableUIADesktopToggle. Allow UIAccess applications to prompt for elevation without using the secure desktop. ; Syntax ........: _UAC_GetEnableUIADesktopToggle() ; Parameters ....: None. ; Return values .: Success - Registry Value ; |$UAC_DISABLED (0) - Disabled. ; |$UAC_ENABLED (1) - Enabled. ; Failure - -1, sets @error to: ; |1 - if unable to open requested key ; |2 - if unable to open requested main key ; |3 - if unable to remote connect to the registry ; |-1 - if unable to open requested value ; |-2 - if value type not supported ; |-3 - Invalid key on OS. ; Author ........: Adam Lawrence (AdamUL) ; Modified ......: TheXman ; Remarks .......: Admin rights not required to read the value. ; Related .......: ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func _UAC_GetEnableUIADesktopToggle() If StringRegExp(@OSVersion, "_(XP|200(0|3))") Then Return SetError(-3, 0, -1) Local $s64Bit = "" If @OSArch = "X64" Then $s64Bit = "64" Local $iReturn = RegRead("HKEY_LOCAL_MACHINE" & $s64Bit & "\Software\Microsoft\Windows\CurrentVersion\Policies\System", "EnableUIADesktopToggle") If $iReturn == "" Then $iReturn = -1 Return SetError(@error, 0, $iReturn) EndFunc ;==>_UAC_GetEnableUIADesktopToggle ; #FUNCTION# ==================================================================================================================== ; Name ..........: _UAC_GetEnableVirtualization ; Description ...: Gets UAC Registry Key for EnableVirtualization. Virtualize file and registry write failures to per-user locations. ; Syntax ........: _UAC_GetEnableVirtualization() ; Parameters ....: None. ; Return values .: Success - Registry Value ; |$UAC_DISABLED (0) - Disabled. ; |$UAC_ENABLED (1) - Enabled. ; Failure - -1, sets @error to: ; |1 - if unable to open requested key ; |2 - if unable to open requested main key ; |3 - if unable to remote connect to the registry ; |-1 - if unable to open requested value ; |-2 - if value type not supported ; |-3 - Invalid key on OS. ; Author ........: Adam Lawrence (AdamUL) ; Modified ......: TheXman ; Remarks .......: Admin rights not required to read the value. ; Related .......: ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func _UAC_GetEnableVirtualization() If StringRegExp(@OSVersion, "_(XP|200(0|3))") Then Return SetError(-3, 0, -1) Local $s64Bit = "" If @OSArch = "X64" Then $s64Bit = "64" Local $iReturn = RegRead("HKEY_LOCAL_MACHINE" & $s64Bit & "\Software\Microsoft\Windows\CurrentVersion\Policies\System", "EnableVirtualization") If $iReturn == "" Then $iReturn = -1 Return SetError(@error, 0, $iReturn) EndFunc ;==>_UAC_GetEnableVirtualization ; #FUNCTION# ==================================================================================================================== ; Name ..........: _UAC_GetFilterAdministratorToken ; Description ...: Gets UAC Registry Key for FilterAdministratorToken. Admin Approval Mode for the Built-in Administrator account. ; Syntax ........: _UAC_GetFilterAdministratorToken() ; Parameters ....: None. ; Return values .: Success - Registry Value ; |$UAC_DISABLED (0) - Disabled. ; |$UAC_ENABLED (1) - Enabled. ; Failure - -1, sets @error to: ; |1 - if unable to open requested key ; |2 - if unable to open requested main key ; |3 - if unable to remote connect to the registry ; |-1 - if unable to open requested value ; |-2 - if value type not supported ; |-3 - Invalid key on OS. ; Author ........: Adam Lawrence (AdamUL) ; Modified ......: TheXman ; Remarks .......: Admin rights not required to read the value. ; Related .......: ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func _UAC_GetFilterAdministratorToken() If StringRegExp(@OSVersion, "_(XP|200(0|3))") Then Return SetError(-3, 0, -1) Local $s64Bit = "" If @OSArch = "X64" Then $s64Bit = "64" Local $iReturn = RegRead("HKEY_LOCAL_MACHINE" & $s64Bit & "\Software\Microsoft\Windows\CurrentVersion\Policies\System", "FilterAdministratorToken") If $iReturn == "" Then $iReturn = -1 Return SetError(@error, 0, $iReturn) EndFunc ;==>_UAC_GetFilterAdministratorToken ; #FUNCTION# ==================================================================================================================== ; Name ..........: _UAC_GetPromptOnSecureDesktop ; Description ...: Gets UAC Registry Key for PromptOnSecureDesktop. Switch to the secure desktop when prompting for elevation. ; Syntax ........: _UAC_GetPromptOnSecureDesktop() ; Parameters ....: None. ; Return values .: Success - Registry Value ; |$UAC_DISABLED (0) - Disabled. ; |$UAC_ENABLED (1) - Enabled. ; Failure - -1, sets @error to: ; |1 - if unable to open requested key ; |2 - if unable to open requested main key ; |3 - if unable to remote connect to the registry ; |-1 - if unable to open requested value ; |-2 - if value type not supported ; |-3 - Invalid key on OS. ; Author ........: Adam Lawrence (AdamUL) ; Modified ......: TheXman ; Remarks .......: Admin rights not required to read the value. ; Related .......: ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func _UAC_GetPromptOnSecureDesktop() If StringRegExp(@OSVersion, "_(XP|200(0|3))") Then Return SetError(-3, 0, -1) Local $s64Bit = "" If @OSArch = "X64" Then $s64Bit = "64" Local $iReturn = RegRead("HKEY_LOCAL_MACHINE" & $s64Bit & "\Software\Microsoft\Windows\CurrentVersion\Policies\System", "PromptOnSecureDesktop") If $iReturn == "" Then $iReturn = -1 Return SetError(@error, 0, $iReturn) EndFunc ;==>_UAC_GetPromptOnSecureDesktop ; #FUNCTION# ==================================================================================================================== ; Name ..........: _UAC_GetValidateAdminCodeSignatures ; Description ...: Gets UAC Registry Key for ValidateAdminCodeSignatures. Only elevate executables that are signed and validated. ; Syntax ........: _UAC_GetValidateAdminCodeSignatures() ; Parameters ....: None. ; Return values .: Success - Registry Value ; |$UAC_DISABLED (0) - Disabled. ; |$UAC_ENABLED (1) - Enabled. ; Failure - -1, sets @error to: ; |1 - if unable to open requested key ; |2 - if unable to open requested main key ; |3 - if unable to remote connect to the registry ; |-1 - if unable to open requested value ; |-2 - if value type not supported ; |-3 - Invalid key on OS. ; Author ........: Adam Lawrence (AdamUL) ; Modified ......: TheXman ; Remarks .......: Admin rights not required to read the value. ; Related .......: ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func _UAC_GetValidateAdminCodeSignatures() If StringRegExp(@OSVersion, "_(XP|200(0|3))") Then Return SetError(-3, 0, -1) Local $s64Bit = "" If @OSArch = "X64" Then $s64Bit = "64" Local $iReturn = RegRead("HKEY_LOCAL_MACHINE" & $s64Bit & "\Software\Microsoft\Windows\CurrentVersion\Policies\System", "ValidateAdminCodeSignatures") If $iReturn == "" Then $iReturn = -1 Return SetError(@error, 0, $iReturn) EndFunc ;==>_UAC_GetValidateAdminCodeSignatures ; #FUNCTION# ==================================================================================================================== ; Name ..........: _UAC_SetConsentPromptBehaviorAdmin ; Description ...: Sets UAC Registry Key for ConsentPromptBehaviorAdmin. Behavior of the elevation prompt for administrators in Admin Approval Mode. ; Syntax ........: _UAC_SetConsentPromptBehaviorAdmin([$iValue = $UAC_PROMPT_FOR_CONSENT_NONWINDOWS_BINARIES (5)]) ; Parameters ....: $iValue - [optional] An integer value 0 to 5. Default is 5. ; |$UAC_ELEVATE_WITHOUT_PROMPTING(0) - Elevate without prompting (Use this option only in the most constrained environments). ; |$UAC_PROMPT_FOR_CREDENTIALS_SECURE_DESKTOP (1) - Prompt for credentials on the secure desktop. ; |$UAC_PROMPT_FOR_CONSENT_SECURE_DESKTOP (2) - Prompt for consent on the secure desktop. ; |$UAC_PROMPT_FOR_CREDENTIALS (3) - Prompt for credentials. ; |$UAC_PROMPT_FOR_CONSENT (4) - Prompt for consent. ; |$UAC_PROMPT_FOR_CONSENT_NONWINDOWS_BINARIES (5) - Prompt for consent for non-Windows binaries (default). ; Return values .: Success - 1 ; Failure - -1, sets @error to: ; |1 - if unable to open requested key ; |2 - if unable to open requested main key ; |3 - if unable to remote connect to the registry ; |-1 - if unable to open requested value ; |-2 - if value type not supported ; |-3 - Current user is not Admin. ; |-4 - Invalid key on OS. ; |-5 - An invaild value. ; Author ........: Adam Lawrence (AdamUL) ; Modified ......: ; Remarks .......: Admin rights required to set the value. ; Related .......: ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func _UAC_SetConsentPromptBehaviorAdmin($iValue = $UAC_PROMPT_FOR_CONSENT_NONWINDOWS_BINARIES) If Not IsAdmin() Then Return SetError(-3, 0, -1) If StringRegExp(@OSVersion, "_(XP|200(0|3))") Then Return SetError(-4, 0, -1) Local $s64Bit = "" If @OSArch = "X64" Then $s64Bit = "64" If $iValue < 0 Or $iValue > 5 Then Return SetError(-5, 0, -1) Local $iReturn = RegWrite("HKEY_LOCAL_MACHINE" & $s64Bit & "\Software\Microsoft\Windows\CurrentVersion\Policies\System", "ConsentPromptBehaviorAdmin", "REG_DWORD", $iValue) If $iReturn = 0 Then $iReturn = -1 Return SetError(@error, 0, $iReturn) EndFunc ;==>_UAC_SetConsentPromptBehaviorAdmin ; #FUNCTION# ==================================================================================================================== ; Name ..........: _UAC_SetConsentPromptBehaviorUser ; Description ...: Sets UAC Registry Key for ConsentPromptBehaviorUser. Behavior of the elevation prompt for standard users. ; Syntax ........: _UAC_SetConsentPromptBehaviorUser([$iValue = $UAC_PROMPT_FOR_CREDENTIALS_SECURE_DESKTOP (1)]) ; Parameters ....: $iValue - [optional] An integer value. Default is 1. ; |$UAC_AUTOMATICALLY_DENY_ELEVATION_REQUESTS (0) - Automatically deny elevation requests. ; |$UAC_PROMPT_FOR_CREDENTIALS_SECURE_DESKTOP (1) - Prompt for credentials on the secure desktop (default). ; |$UAC_PROMPT_FOR_CREDENTIALS (3) - Prompt for credentials. ; Return values .: Success - 1 ; Failure - -1, sets @error to: ; |1 - if unable to open requested key ; |2 - if unable to open requested main key ; |3 - if unable to remote connect to the registry ; |-1 - if unable to open requested value ; |-2 - if value type not supported ; |-3 - Current user is not Admin. ; |-4 - Invalid key on OS. ; |-5 - An invaild value. ; Author ........: Adam Lawrence (AdamUL) ; Modified ......: ; Remarks .......: Admin rights required to set the value. ; Related .......: ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func _UAC_SetConsentPromptBehaviorUser($iValue = $UAC_PROMPT_FOR_CREDENTIALS_SECURE_DESKTOP) If Not IsAdmin() Then Return SetError(-3, 0, -1) If StringRegExp(@OSVersion, "_(XP|200(0|3))") Then Return SetError(-4, 0, -1) If $iValue < 0 Or $iValue = 2 Or $iValue > 3 Then Return SetError(-5, 0, -1) Local $s64Bit = "" If @OSArch = "X64" Then $s64Bit = "64" Local $iReturn = RegWrite("HKEY_LOCAL_MACHINE" & $s64Bit & "\Software\Microsoft\Windows\CurrentVersion\Policies\System", "ConsentPromptBehaviorUser", "REG_DWORD", $iValue) If $iReturn = 0 Then $iReturn = -1 Return SetError(@error, 0, $iReturn) EndFunc ;==>_UAC_SetConsentPromptBehaviorUser ; #FUNCTION# ==================================================================================================================== ; Name ..........: _UAC_SetEnableInstallerDetection ; Description ...: Sets UAC Registry Key for EnableInstallerDetection. Detect application installations and prompt for elevation. ; Syntax ........: _UAC_SetEnableInstallerDetection([$iValue = $UAC_DISABLED (0)]) ; Parameters ....: $iValue - [optional] An integer value. Default is 0. ; |$UAC_DISABLED (0) - Disabled (default for enterprise). ; |$UAC_ENABLED (1) - Enabled (default for home). ; Return values .: Success - 1 ; Failure - -1, sets @error to: ; |1 - if unable to open requested key ; |2 - if unable to open requested main key ; |3 - if unable to remote connect to the registry ; |-1 - if unable to open requested value ; |-2 - if value type not supported ; |-3 - Current user is not Admin. ; |-4 - Invalid key on OS. ; |-5 - An invaild value. ; Author ........: Adam Lawrence (AdamUL) ; Modified ......: ; Remarks .......: Admin rights required to set the value. ; Related .......: ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func _UAC_SetEnableInstallerDetection($iValue = $UAC_DISABLED) If Not IsAdmin() Then Return SetError(-3, 0, -1) If StringRegExp(@OSVersion, "_(XP|200(0|3))") Then Return SetError(-4, 0, -1) If $iValue < 0 Or $iValue > 1 Then Return SetError(-5, 0, -1) Local $s64Bit = "" If @OSArch = "X64" Then $s64Bit = "64" Local $iReturn = RegWrite("HKEY_LOCAL_MACHINE" & $s64Bit & "\Software\Microsoft\Windows\CurrentVersion\Policies\System", "EnableInstallerDetection", "REG_DWORD", $iValue) If $iReturn = 0 Then $iReturn = -1 Return SetError(@error, 0, $iReturn) EndFunc ;==>_UAC_SetEnableInstallerDetection ; #FUNCTION# ==================================================================================================================== ; Name ..........: _UAC_SetEnableLUA ; Description ...: Sets UAC Registry Key for EnableLUA. Run all administrators in Admin Approval Mode. ; Syntax ........: _UAC_SetEnableLUA([$iValue = $UAC_ENABLED (1)]) ; Parameters ....: $iValue - [optional] An integer value. Default is 1. ; |$UAC_DISABLED (0) - UAC (formally known as LUA) is disabled. ; |$UAC_ENABLED (1) - UAC (formally known as LUA) is enabled. ; Return values .: Success - 1 ; Failure - -1, sets @error to: ; |1 - if unable to open requested key ; |2 - if unable to open requested main key ; |3 - if unable to remote connect to the registry ; |-1 - if unable to open requested value ; |-2 - if value type not supported ; |-3 - Current user is not Admin. ; |-4 - Invalid key on OS. ; |-5 - An invaild value. ; Author ........: Adam Lawrence (AdamUL) ; Modified ......: ; Remarks .......: Admin rights required to set the value. ; Related .......: ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func _UAC_SetEnableLUA($iValue = $UAC_ENABLED) If Not IsAdmin() Then Return SetError(-3, 0, -1) If StringRegExp(@OSVersion, "_(XP|200(0|3))") Then Return SetError(-4, 0, -1) If $iValue < 0 Or $iValue > 1 Then Return SetError(-5, 0, -1) Local $s64Bit = "" If @OSArch = "X64" Then $s64Bit = "64" Local $iReturn = RegWrite("HKEY_LOCAL_MACHINE" & $s64Bit & "\Software\Microsoft\Windows\CurrentVersion\Policies\System", "EnableLUA", "REG_DWORD", $iValue) If $iReturn = 0 Then $iReturn = -1 Return SetError(@error, 0, $iReturn) EndFunc ;==>_UAC_SetEnableLUA ; #FUNCTION# ==================================================================================================================== ; Name ..........: _UAC_SetEnableSecureUIAPaths ; Description ...: Sets UAC Registry Key for EnableSecureUIAPaths. Only elevate UIAccess applications that are installed in secure locations. ; Syntax ........: _UAC_SetEnableSecureUIAPaths([$iValue = $UAC_ENABLED (1)]) ; Parameters ....: $iValue - [optional] An integer value. Default is 1. ; |$UAC_DISABLED (0) - Disabled. ; |$UAC_ENABLED (1) - Enabled. ; Return values .: Success - 1 ; Failure - -1, sets @error to: ; |1 - if unable to open requested key ; |2 - if unable to open requested main key ; |3 - if unable to remote connect to the registry ; |-1 - if unable to open requested value ; |-2 - if value type not supported ; |-3 - Current user is not Admin. ; |-4 - Invalid key on OS. ; |-5 - An invaild value. ; Author ........: Adam Lawrence (AdamUL) ; Modified ......: ; Remarks .......: Admin rights required to set the value. ; Related .......: ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func _UAC_SetEnableSecureUIAPaths($iValue = $UAC_ENABLED) If Not IsAdmin() Then Return SetError(-3, 0, -1) If StringRegExp(@OSVersion, "_(XP|200(0|3))") Then Return SetError(-4, 0, -1) If $iValue < 0 Or $iValue > 1 Then Return SetError(-5, 0, -1) Local $s64Bit = "" If @OSArch = "X64" Then $s64Bit = "64" Local $iReturn = RegWrite("HKEY_LOCAL_MACHINE" & $s64Bit & "\Software\Microsoft\Windows\CurrentVersion\Policies\System", "EnableSecureUIAPaths", "REG_DWORD", $iValue) If $iReturn = 0 Then $iReturn = -1 Return SetError(@error, 0, $iReturn) EndFunc ;==>_UAC_SetEnableSecureUIAPaths ; #FUNCTION# ==================================================================================================================== ; Name ..........: _UAC_SetEnableUIADesktopToggle ; Description ...: Sets UAC Registry Key for EnableUIADesktopToggle. Allow UIAccess applications to prompt for elevation without using the secure desktop. ; Syntax ........: _UAC_SetEnableUIADesktopToggle([$iValue = $UAC_DISABLED (0)]) ; Parameters ....: $iValue - [optional] An integer value. Default is 1. ; |$UAC_DISABLED (0) - Disabled. ; |$UAC_ENABLED (1) - Enabled. ; Return values .: Success - 1 ; Failure - -1, sets @error to: ; |1 - if unable to open requested key ; |2 - if unable to open requested main key ; |3 - if unable to remote connect to the registry ; |-1 - if unable to open requested value ; |-2 - if value type not supported ; |-3 - Current user is not Admin. ; |-4 - Invalid key on OS. ; |-5 - An invaild value. ; Author ........: Adam Lawrence (AdamUL) ; Modified ......: ; Remarks .......: Admin rights required to set the value. ; Related .......: ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func _UAC_SetEnableUIADesktopToggle($iValue = $UAC_DISABLED) If Not IsAdmin() Then Return SetError(-3, 0, -1) If StringRegExp(@OSVersion, "_(XP|200(0|3))") Then Return SetError(-4, 0, -1) If $iValue < 0 Or $iValue > 1 Then Return SetError(-5, 0, -1) Local $s64Bit = "" If @OSArch = "X64" Then $s64Bit = "64" Local $iReturn = RegWrite("HKEY_LOCAL_MACHINE" & $s64Bit & "\Software\Microsoft\Windows\CurrentVersion\Policies\System", "EnableUIADesktopToggle", "REG_DWORD", $iValue) If $iReturn = 0 Then $iReturn = -1 Return SetError(@error, 0, $iReturn) EndFunc ;==>_UAC_SetEnableUIADesktopToggle ; #FUNCTION# ==================================================================================================================== ; Name ..........: _UAC_SetEnableVirtualization ; Description ...: Sets UAC Registry Key for EnableVirtualization. Virtualize file and registry write failures to per-user locations. ; Syntax ........: _UAC_SetEnableVirtualization([$iValue = $UAC_ENABLED (1)]) ; Parameters ....: $iValue - [optional] An integer value. Default is 1. ; |$UAC_DISABLED (0) - Disabled. ; |$UAC_ENABLED (1) - Enabled. ; Return values .: Success - 1 ; Failure - -1, sets @error to: ; |1 - if unable to open requested key ; |2 - if unable to open requested main key ; |3 - if unable to remote connect to the registry ; |-1 - if unable to open requested value ; |-2 - if value type not supported ; |-3 - Current user is not Admin. ; |-4 - Invalid key on OS. ; |-5 - An invaild value. ; Author ........: Adam Lawrence (AdamUL) ; Modified ......: ; Remarks .......: Admin rights required to set the value. ; Related .......: ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func _UAC_SetEnableVirtualization($iValue = $UAC_ENABLED) If Not IsAdmin() Then Return SetError(-3, 0, -1) If StringRegExp(@OSVersion, "_(XP|200(0|3))") Then Return SetError(-4, 0, -1) If $iValue < 0 Or $iValue > 1 Then Return SetError(-5, 0, -1) Local $s64Bit = "" If @OSArch = "X64" Then $s64Bit = "64" Local $iReturn = RegWrite("HKEY_LOCAL_MACHINE" & $s64Bit & "\Software\Microsoft\Windows\CurrentVersion\Policies\System", "EnableVirtualization", "REG_DWORD", $iValue) If $iReturn = 0 Then $iReturn = -1 Return SetError(@error, 0, $iReturn) EndFunc ;==>_UAC_SetEnableVirtualization ; #FUNCTION# ==================================================================================================================== ; Name ..........: _UAC_SetFilterAdministratorToken ; Description ...: Sets UAC Registry Key for FilterAdministratorToken. Admin Approval Mode for the Built-in Administrator account. ; Syntax ........: _UAC_SetFilterAdministratorToken([$iValue = $UAC_DISABLED (0)]) ; Parameters ....: $iValue - [optional] An integer value. Default is 1. ; |$UAC_DISABLED (0) - Disabled. ; |$UAC_ENABLED (1) - Enabled. ; Return values .: Success - 1 ; Failure - -1, sets @error to: ; |1 - if unable to open requested key ; |2 - if unable to open requested main key ; |3 - if unable to remote connect to the registry ; |-1 - if unable to open requested value ; |-2 - if value type not supported ; |-3 - Current user is not Admin. ; |-4 - Invalid key on OS. ; |-5 - An invaild value. ; Author ........: Adam Lawrence (AdamUL) ; Modified ......: ; Remarks .......: Admin rights required to set the value. ; Related .......: ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func _UAC_SetFilterAdministratorToken($iValue = $UAC_DISABLED) If Not IsAdmin() Then Return SetError(-3, 0, -1) If StringRegExp(@OSVersion, "_(XP|200(0|3))") Then Return SetError(-4, 0, -1) If $iValue < 0 Or $iValue > 1 Then Return SetError(-5, 0, -1) Local $s64Bit = "" If @OSArch = "X64" Then $s64Bit = "64" Local $iReturn = RegWrite("HKEY_LOCAL_MACHINE" & $s64Bit & "\Software\Microsoft\Windows\CurrentVersion\Policies\System", "FilterAdministratorToken", "REG_DWORD", $iValue) If $iReturn = 0 Then $iReturn = -1 Return SetError(@error, 0, $iReturn) EndFunc ;==>_UAC_SetFilterAdministratorToken ; #FUNCTION# ==================================================================================================================== ; Name ..........: _UAC_SetPromptOnSecureDesktop ; Description ...: Sets UAC Registry Key for PromptOnSecureDesktop. Switch to the secure desktop when prompting for elevation. ; Syntax ........: _UAC_SetPromptOnSecureDesktop([$iValue = $UAC_ENABLED (1)]) ; Parameters ....: $iValue - [optional] An integer value. Default is 1. ; |$UAC_DISABLED (0) - Disabled. ; |$UAC_ENABLED (1) - Enabled. ; Return values .: Success - 1 ; Failure - -1, sets @error to: ; |1 - if unable to open requested key ; |2 - if unable to open requested main key ; |3 - if unable to remote connect to the registry ; |-1 - if unable to open requested value ; |-2 - if value type not supported ; |-3 - Current user is not Admin. ; |-4 - Invalid key on OS. ; |-5 - An invaild value. ; Author ........: Adam Lawrence (AdamUL) ; Modified ......: ; Remarks .......: Admin rights required to set the value. ; Related .......: ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func _UAC_SetPromptOnSecureDesktop($iValue = $UAC_ENABLED) If Not IsAdmin() Then Return SetError(-3, 0, -1) If StringRegExp(@OSVersion, "_(XP|200(0|3))") Then Return SetError(-4, 0, -1) If $iValue < 0 Or $iValue > 1 Then Return SetError(-5, 0, -1) Local $s64Bit = "" If @OSArch = "X64" Then $s64Bit = "64" Local $iReturn = RegWrite("HKEY_LOCAL_MACHINE" & $s64Bit & "\Software\Microsoft\Windows\CurrentVersion\Policies\System", "PromptOnSecureDesktop", "REG_DWORD", $iValue) If $iReturn = 0 Then $iReturn = -1 Return SetError(@error, 0, $iReturn) EndFunc ;==>_UAC_SetPromptOnSecureDesktop ; #FUNCTION# ==================================================================================================================== ; Name ..........: _UAC_SetValidateAdminCodeSignatures ; Description ...: Sets UAC Registry Key for ValidateAdminCodeSignatures. Only elevate executables that are signed and validated. ; Syntax ........: _UAC_SetValidateAdminCodeSignatures([$iValue = $UAC_DISABLED (0)]) ; Parameters ....: $iValue - [optional] An integer value. Default is 1. ; |$UAC_DISABLED (0) - Disabled. ; |$UAC_ENABLED (1) - Enabled. ; Return values .: Success - 1 ; Failure - -1, sets @error to: ; |1 - if unable to open requested key ; |2 - if unable to open requested main key ; |3 - if unable to remote connect to the registry ; |-1 - if unable to open requested value ; |-2 - if value type not supported ; |-3 - Current user is not Admin. ; |-4 - Invalid key on OS. ; |-5 - An invaild value. ; Author ........: Adam Lawrence (AdamUL) ; Modified ......: ; Remarks .......: Admin rights required to set the value. ; Related .......: ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func _UAC_SetValidateAdminCodeSignatures($iValue = $UAC_DISABLED) If Not IsAdmin() Then Return SetError(-3, 0, -1) If StringRegExp(@OSVersion, "_(XP|200(0|3))") Then Return SetError(-4, 0, -1) If $iValue < 0 Or $iValue > 1 Then Return SetError(-5, 0, -1) Local $s64Bit = "" If @OSArch = "X64" Then $s64Bit = "64" Local $iReturn = RegWrite("HKEY_LOCAL_MACHINE" & $s64Bit & "\Software\Microsoft\Windows\CurrentVersion\Policies\System", "ValidateAdminCodeSignatures", "REG_DWORD", $iValue) If $iReturn = 0 Then $iReturn = -1 Return SetError(@error, 0, $iReturn) EndFunc ;==>_UAC_SetValidateAdminCodeSignatures Updated: Thanks to @TheXman for catching a bug in the script. Adam1 point
-
Internet Explorer ControlSend issue
Palestinian reacted to DaleHohm for a topic
Bad idea to spam a thread like this with an unrelated issue. Since you want to imply a nebulous problem, I'll respond here to clear this up for anyone who may wander in here in the future. There are no changes in the new IE.au3 as it relates to frames. Each frame is a document container, each document has it's own DOM (document object model). Therefore, you cannot reference an element in the DOM of a frame from another DOM - you must get a reference to the new DOM first. Because you cannot know by looking at the screen that there are multiple DOMs at play, people are often confused. Dale1 point -
This might be what you need. Run(@ComSpec & " /k title pinging router |ping 192.168.1.1 -t ")1 point
-
Welcome to the wonderland of arithmetic. Primes, their repartition, their fantastic properties have always fascinated countless people, mathematicians and laymen alltogether. Simple as that may seem at first look, characterizing them in general is often far from trivial and many pitfalls are awaiting the unsuspecting amateur. Every primality test, compositeness test, factoring program, younameit will start with a trial division step to remove small factors. As you have experienced, a loop step of 30 without further checking is not enough to guarantee scaling. Don't by shy: there's nothing wrong by being fooled by intuition. It just needs to be backed by a more in-depth analysis. BTW there is some relation between primes and guitar.1 point
-
Thanks, that works now, the MessageBox runs in a separated thread and won't block the script execution. Gonna make it cleaner and as simple as possible and post it in the Example Forum. Thank you. #include <winapi.au3> #include <Memory.au3> $pRemoteCode = _MemVirtualAlloc(0, 512, $MEM_COMMIT, $PAGE_EXECUTE_READWRITE) $CodeBuffer = DllStructCreate("byte[512]", $pRemoteCode) $MessageBoxAddress = DllCall("Kernel32.dll", "ptr", "GetProcAddress", "ptr", _WinAPI_GetModuleHandle("user32.dll"), "str", "MessageBoxW") $MessageBoxAddress = $MessageBoxAddress[0] $texto="hola Mundo" $titulo="Titulo" Local $tDataBuffer = DllStructCreate("wchar texto[" & StringLen($texto) + 1 & "]") Local $tDataBuffer2 = DllStructCreate("wchar titulo[" & StringLen($titulo) + 1 & "]") DllStructSetData($tDataBuffer, "texto", $texto) DllStructSetData($tDataBuffer2, "titulo", $titulo) Local $Opcode $Opcode &= "0x" $Opcode &= "68" & SwapEndian(2) $Opcode &= "68" & SwapEndian(DllStructGetPtr($tDataBuffer2, 1)) $Opcode &= "68" & SwapEndian(DllStructGetPtr($tDataBuffer, 1)) $Opcode &= "68" & SwapEndian(0) $Opcode &= "B8" & SwapEndian($MessageBoxAddress) $Opcode &= "FFD0" $Opcode &= "C3" ConsoleWrite($Opcode & @CRLF) DllStructSetData($CodeBuffer, 1, $Opcode) ;Local $Ret = DllCall("user32.dll", "int", "CallWindowProc", "ptr", DllStructGetPtr($CodeBuffer), "int", 0, "int", 0, "int", 0, "int", 0) ;~ local $Ret=DllCallAddress("int",DllStructGetPtr($CodeBuffer)) ;~ Consolewrite(@CRLF & $Ret[0] & @CRLF) Global $dwThreadId CreateThread(0, 0, DllStructGetPtr($CodeBuffer), 0, 0, $dwThreadId) ;It crashes here... Msgbox(0,"","Normal Msgbox") Func SwapEndian($hex) Return Hex(Binary($hex)) EndFunc ;==>SwapEndian Func CreateThread($pThreadAttributes, $dwStackSize, $pStartAddress, $pParameter, $dwCreationFlags, ByRef $dwThreadId) Local $tThreadId = DllStructCreate("DWORD") Local $avResult = DllCall("kernel32.dll", "BOOL", "CreateThread", _ "ptr", $pThreadAttributes, _ "DWORD", $dwStackSize, _ "ptr", $pStartAddress, _ "ptr", $pParameter, _ "DWORD", $dwCreationFlags, _ "ptr", DllStructGetPtr($tThreadId, 1)) $dwThreadId = DllStructGetData($tThreadId, 1) Return $avResult[0] EndFunc1 point
-
Keypress detection.
TheBytemaster reacted to Terenz for a topic
This post from Melba is a good start: Ignore the mouse movement for the idle time, if you add also the mouse keypress ( _IsPressed ) then you have only the keyboard activity...1 point -
Do something based on GUI Input number of characters
Palestinian reacted to BrewManNH for a topic
I found this code >here and updated it to be usable in the latest version of Autoit. #include <GUIConstants.au3> #include <GUIEdit.au3> GuiCreate("Enter Registration Code",300,50,@DesktopWidth/2-150,@DesktopHeight/2-25) $i1 = GuiCtrlCreateInput("",10,15,50,20) GuiCtrlSetLimit($i1,5) $i2 = GuiCtrlCreateInput("",70,15,50,20) GuiCtrlSetLimit($i2,5) $i3 = GuiCtrlCreateInput("",130,15,50,20) GuiCtrlSetLimit($i3,5) $b1 = GuiCtrlCreateButton("Next >",190,15,50,20) $b2 = GuiCtrlCreateButton("Exit",250,15,40,20) GuiSetState(@SW_SHOW) While 1 $msg = GuiGetMsg() Select Case $msg = $GUI_EVENT_CLOSE or $msg = $b2 ExitLoop Case $msg = $b1 MsgBox(0,"Next","This button gets the focus when the last input box is filled.") EndSelect If _GUICtrlEdit_LineLength($i1) = 5 and _GUICtrlEdit_GetModify($i1) > 0 Then GuiCtrlSetState($i2,$GUI_FOCUS) _GUICtrlEdit_SetModify($i1,false) EndIf If _GUICtrlEdit_LineLength($i2) = 5 and _GUICtrlEdit_GetModify($i2) > 0 Then GuiCtrlSetState($i3,$GUI_FOCUS) _GUICtrlEdit_SetModify($i2,false) EndIf If _GUICtrlEdit_LineLength($i3) = 5 and _GUICtrlEdit_GetModify($i3) > 0 Then GuiCtrlSetState($b1,$GUI_FOCUS) _GUICtrlEdit_SetModify($i3,false) EndIf WEnd Should do what you need, or at least get you started.1 point -
Ah, I just worked on the switch. You would need to guictrlread those 'dates'. $d = guictrlread($date2)1 point
-
See FileFindFirstFile and FileFindNextFile in the help. These are basic Windows APIs so it's helpful to learn to use them. The pseudocode would be, read from raw dir FileFindFirstFile using *.*. If file found take the base name and append it to jpeg folder name, then append .jpg or .jpeg whatever is used. If FileExists(jpgfilename) do FileFindNextFile. IOW continue the loop if jpg file found. Otherwise delete the current raw file, then continue loop. Here's what I use to return file base name from a full path. You may find other methods but this works for me. If invalid path returns blank string. Otherwise returns filename with no path or ext. Func _filebasename($path) If $path = "" Then Return "" If StringLen($path) < 3 Then Return "" Local $pos = StringInStr($path, "\", 0, -1) $pos += 1 Local $tmp = StringMid($path, $pos) Return StringLeft($tmp, StringInStr($tmp, ".", 0, -1) - 1) EndFunc Edit. With these find file functions you may have to screen out the psuedofiles '.' and '..' I'm not sure. I know I do when doing it in c++.1 point
-
Chrome UDF
baconismidog reacted to jdelaney for a topic
I don't suppose there would be a way to use objects, since this is all read in from a text file...such as, having multiple windows/documents open, and differentiating between them. Or looking for an element under an object? Small fix, the _ChromeDocWaitForExistenceByTitle is not properly comparing the return string, so it always timesout. Expected return string is like: {"text":"HTML Form Example"} if StringCompare($title_from_chrome, '{"text":"' & $title & '"}') = 0 Then this fixes it ( inside _ChromeDocWaitForExistenceByTitle) Func _ChromeDocWaitForExistenceByTitle($title, $timeout = 5) dim $error = 2, $response = "", $begin, $title_from_chrome $begin = TimerInit() While TimerDiff($begin) < ($timeout * 1000) $title_from_chrome = _ChromeDocGetTitle() if StringCompare($title_from_chrome, '{"text":"' & $title & '"}') = 0 Then $error = 0 ExitLoop EndIf sleep(100) WEnd SetError($error) Return $response EndFunc1 point