Leaderboard
Popular Content
Showing content with the highest reputation on 11/16/2018 in all areas
-
@Belini This is a built-in implementation of manual search for SysTreeView32 from Microsoft. For a quick search, use the functions to work with the treeview. For example For $i = 1 To 26 ControlTreeView("Treeview", "", $treeview, "Select", $letter[$i]) sleep(11) Next2 points
-
... and regex version of Malkey's code Local $num = "64704", $new = $num, $sRet = $num & @CRLF For $i = 1 To 10 $new = Execute(StringRegExpReplace($new, '(\d)', " Mod('$1'+1, 10) & ") & "''") $sRet &= $new & @CRLF Next MsgBox(0, "Result", "Starting number: " & $num & @CRLF & @CRLF & $sRet)2 points
-
IE Embedded Control Versioning Use IE 9+ and HTML5 features inside a GUI This UDF allows the use of embedded IE controls which support IE versions greater than IE 7. By default, all embedded IE controls default to IE 7 compatibility mode (unless for some reason somebody has IE 6 installed!), so its not possible to use most of the HTML5 features available today. Fortunately, IE 9 and greater allow the use of HTML5, and the embedded IE control actually supports it. The problem is convincing Windows to let your program actually use those features! There are Registry branches that modify how an IE control works in specific programs. Those branches are: HKCU\Software\Microsoft\Internet Explorer\MAIN\FeatureControl\FEATURE_BROWSER_EMULATION HKLM\SOFTWARE\Microsoft\Internet Explorer\MAIN\FeatureControl\FEATURE_BROWSER_EMULATION In at least one of these branches, the executable name needs to appear as a value name ("autoit.exe" for example), and the value data needs to indicate what IE version to 'emulate'. The value data is actually dependent on the version and whether quirks-mode is enabled. See Web Browser Control - Specifying the IE Version for more information. Note that a 64-bit O/S needs adjustments to the HKLM paths. Also, prefer the HKCU branch unless the program needs to enable access across all user accounts. HTML5 Canvas Element Example Anyway, all the complexity of setting the right value with the right name with the right 32/64-bit branch is handled for you in this UDF. Enabling support for IE9+, and new HTML5 features, is as simple as making one call to _IE_EmbeddedSetBrowserEmulation(). _IE_EmbeddedSetBrowserEmulation() takes an executable name (@AutoItExe if none is provided), and checks the Registry for an entry for it. If it doesn't find one, it will create one and enable support for later versions of IE. The full parameters to the function are as follows: _IE_EmbeddedSetBrowserEmulation($nIEVersion, $bIgnoreDOCTYPE = True, $bHKLMBranch = False, $sExeName = @AutoItExe) The parameter passed in $nIEVersion can be anything from 8 to 11 [or 12+ in the future], or just the current version of IE, which is available also through a call to _IE_EmbeddedGetVersion(). $bIgnoreDOCTYPE controls when IE will go into quirks mode based on any "<!DOCTYPE>" declarations on webpages. This mode can cause major problems, so by default it is set to ignore it (set this to False to enable it). $bHKLMBranch controls where in the registry the Browser Emulation Mode setting will be stored. If you wish to store the mode for ALL users, set this parameter to True. Note, however, that elevated privileges are required for modifying the HKLM branch! If the call to _IE_EmbeddedSetBrowserEmulation() is successful, then you can enable a (more) HTML5 compliant IE browser control in a GUI. The complete set of functions in the UDF: _IE_EmbeddedGetVersion() ; Gets version of IE Embeddable Control (from ieframe.dll or Registry) _IE_EmbeddedGetBrowserEmulation() ; Gets Browser Emulation Version for given Executable (or 0 if not found) _IE_EmbeddedSetBrowserEmulation() ; Sets Browser Emulation Version. NOTE: HKLM branch REQUIRES ELEVATED PRIVILEGES! _ IMPORTANT: Setting the embedded browser object to a newer version of IE may alter the behavior of some things. See documenation for the HTMLDocumentEvents2 interface and HTMLAnchorEvents2 interface for example. Also, there is at least one difference in behavior noted by mesale0077 in working with IE10 (and possibly other versions of IE) - clicks for elements inside an <a> anchor tag will register as the actual internal element rather than the surrounding anchor. For example, an <img> element wrapped by an <a> anchor will only send the click to the <img> element and not propagate it any further. A workaround for this is to check the parentNode to see if it is an <a> element. See the discussion in the >ObjEvent dont work thread. It could be that there's some other reason for this behavior, but nothing has come to light yet. As an aside, also see trancexx's response in >ObjEvent usage for more techniques for capturing IE events. History: An example of HTML5 use, which has a little interactive Canvas, follows (requires IE9 or higher!): #include "IE_EmbeddedVersioning.au3" ; =============================================================================================================================== ; <IE_EmbeddedHTML5Example.au3> ; ; Example of using 'IE_EmbeddedVersioning' UDF ; ; This example 1st attempts to set the Browser Emulation information in the registry, then ; creates an embedded IE control with an interactive HTML5 Canvas element. ; ; Author: Ascend4nt ; =============================================================================================================================== #Region IE_CANVAS_EXAMPLE #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <IE.au3> ; ----------- ; GLOBALS ; ----------- Global $bMouseDown = False, $iLastX1 = 0, $iLastY1 = 0 Global $g_oCanvas, $g_oCtx Global $hGUI, $ctGUI_ErrMessageLabel Global $GUI_IE_Obj Global $nRet = _WinMain() ; Optionally remove valuename at Exit (not recommended if compiled to executable) ;~ _IE_EmbeddedRemoveBrowserEmulation() Exit $nRet ; ====================================================================================================== ; Embedded IE Browser-Emulation Fix + HTML5 Example ; ====================================================================================================== Func _WinMain() ConsoleWrite("@AutoItX64 = " & @AutoItX64 & ", IsAdmin() = " & IsAdmin() & @CRLF) ;; Get Current IE Embeddable Control Version (from ieframe.dll) Local $sIEVer = _IE_EmbeddedGetVersion(), $nIEVer = @extended ConsoleWrite("Embedded Version = " & $sIEVer & ", as Int: " & $nIEVer & ", @error = " & @error & @CRLF) ; Old IE version w/o HTML5 support? Exit If $nIEVer < 9 Then Return MsgBox(0, "Old IE Version", "IE version is less than 9, HTML5 example will not work") ;; Current Browser Emulation Mode for this executable (if exists) Local $nIEBEVer = _IE_EmbeddedGetBrowserEmulation() ConsoleWrite("GetEmbeddedVersion: " & $nIEBEVer & ", @error = " & @error & ", @extended = " & @extended & @CRLF) ;; Set Browser Emulation Mode for this executable (if not already set or set to a different version) ; HKCU Branch: _IE_EmbeddedSetBrowserEmulation() ; HKLM Branch: ;_IE_EmbeddedSetBrowserEmulation(-1, True, True) If @error Then ; -1 error means trying to access HKLM, so script needs elevation to access the Registry If @error = -1 Then If MsgBox(32 + 3, "Elevation Required", "Elevate script to enable setting Browser Emulation Mode?") = 6 Then Return _ReRunIfNotElevated() Return 1 EndIf Return MsgBox(0, "Error", "Couldn't set Browser Emulation mode") EndIf ;Local $oErrorHandler = ObjEvent("AutoIt.Error", "_ErrFunc") ;; Create Embedded Browser Control and GUI Local $oIE = _IECreateEmbedded() ; GUI (vars are Global) $hGUI = GUICreate("Embedded Web control Test", 460, 360, -1, -1, $WS_OVERLAPPEDWINDOW + $WS_CLIPSIBLINGS + $WS_CLIPCHILDREN) $GUI_IE_Obj = GUICtrlCreateObj($oIE, 10, 10, 440, 340) $ctGUI_ErrMessageLabel = GUICtrlCreateLabel("", 100, 500, 500, 30) GUICtrlSetColor(-1, 0xff0000) GUISetState(@SW_SHOW) ;Show GUI ; Doesn't work (at least for keyboard focus): ;~ ControlFocus($hGUI, '', $GUI_IE_Obj) ;; Initialize Embedded Control and write some HTML5 data to it _IENavigate($oIE, 'about:blank' ) ; Basic Near-Empty HTML (with minimal CSS styling for Canvas element) Local $sHTML = '<!DOCTYPE html>' & @CR & '<html>' & @CR & '<head>' & @CR & _ '<meta content="text/html; charset=UTF-8" http-equiv="content-type">' & @CR & _ '<title>Experiments</title>' & @CR & _ '<style>canvas { display:block; background-color:white; outline:#00FF00 dotted thin;}</style>' & @CR & _ '</head>' & @CR & '<body>' & @CR & '</body>' & @CR & '</html>' _IEDocWriteHTML($oIE, $sHTML) _IEAction($oIE, "refresh") ;; Setup Event Object Functions Local $oEventsDoc = ObjEvent($oIE.document, "Event_", "HTMLDocumentEvents2") #forceref $oEventsDoc ;~ ConsoleWrite("Obj Name = " & ObjName($oIE) & @CRLF) ;~ ConsoleWrite("Location = " & $oIE.document.location.pathname & @CRLF) ; -------------------------------------------------------------------------------------- ; Create Canvas Element through the DOM (optionally just add it in the HTML5 above) ; ------------------------------------------------- ; Note: Support in browsers, see "Can I use..." ; @ http://caniuse.com/#feat=canvas ; and @ http://caniuse.com/#search=canvas ; ------------------------------------------------- ; IE minimum is version 9+, 10+ has more features, but WebGL support requires version 11+ ; -------------------------------------------------------------------------------------- $g_oCanvas = $oIE.document.createElement("canvas") $g_oCanvas.id = "myCanvas" ;~ ConsoleWrite("Canvas ID = " & $g_oCanvas.id & @CRLF) $oIE.document.body.appendChild($g_oCanvas) ; Optionally, if added already through the HTML5 text: ;Local $g_oCanvas = _IEGetObjById($oIE, "myCanvas") If @error Then Return MsgBox(0, "Error", "Error creating/accessing Canvas") ;; Tweak Canvas Size, Move into View ;~ ConsoleWrite("window innerwidth = " & $oIE.document.parentWindow.innerWidth & @CRLF) ;$oIE.document.parentWindow.scrollTo(0, 10) $g_oCanvas.width = 420 $g_oCanvas.height = 320 ;ConsoleWrite("Canvas item offsetTop = " & $g_oCanvas.offsetTop & @CRLF) $g_oCanvas.scrollIntoView() ;; Grab the Canvas 2D Context $g_oCtx = $g_oCanvas.getContext("2d") ;; Example Drawing: Gradiant Local $oGrad = $g_oCtx.createLinearGradient(0,0,0,60) If IsObj($oGrad) Then $oGrad.addColorStop(0, "red") $oGrad.addColorStop(1, "blue") $g_oCtx.fillStyle = $oGrad EndIf $g_oCtx.fillRect(0,0,419,60) ;; Example Drawing: Text $g_oCtx.font = "30px serif" $g_oCtx.fillStyle = "white" $g_oCtx.textBaseline = "top" $g_oCtx.fillText("HTML5 Canvas Drawing!", 50, 10) ;; Example Drawing: Circle, Line $g_oCtx.beginPath() $g_oCtx.arc(200, 100, 20, 0, ACos(-1) * 2) $g_oCtx.fillStyle = "red" $g_oCtx.fill() $g_oCtx.beginPath() $g_oCtx.lineWidth = "3" $g_oCtx.strokeStyle = "green" $g_oCtx.moveTo(185, 85) $g_oCtx.lineTo(215, 115) $g_oCtx.stroke() ; Waiting for user to close the window While GUIGetMsg() <> $GUI_EVENT_CLOSE Sleep(10) WEnd GUIDelete() EndFunc ; ====================================================================================================== ; IE Event Functions - React to Mouse events with some Canvas graphics ; ====================================================================================================== #Region IE_EVENT_FUNCS ; For right-click, the context menu pops up, UNLESS we change the Event's 'returnValue' property Volatile Func Event_oncontextmenu($oEvtObj) If IsObj($oEvtObj) Then ; Convert to string so that 0 doesn't match EVERY string Local $sId = $oEvtObj.srcElement.id & "" If ($sId = "myCanvas") Then $oEvtObj.returnValue = False EndIf EndFunc Volatile Func Event_onmousedown($oEvtObj) If IsObj($oEvtObj) And IsObj($g_oCtx) Then ; Map click coordinates to Canvas coordinates $iLastX1 = $oEvtObj.x - $g_oCanvas.offsetLeft $iLastY1 = $oEvtObj.y - $g_oCanvas.offsetTop ;~ ConsoleWrite("Downclick recvd at X1: " & $iLastX1 & ", Y1: " & $iLastY1 & ", MouseButton [1 = left, 2 = right, etc] = " & $oEvtObj.button & @CRLF) ; Check if click was in fact within Canvas element If $iLastX1 >= 0 And $iLastX1 < $g_oCanvas.width And $iLastY1 >= 0 And $iLastY1 < $g_oCanvas.height Then ; Signal mouse-down occurred inside Canvas $bMouseDown = 1 ; Make a small square where initial down-click was detected $g_oCtx.fillStyle = "blue" $g_oCtx.fillRect($iLastX1 - 2, $iLastY1 - 2, 3, 3) EndIf EndIf EndFunc Volatile Func Event_onmouseup($oEvtObj) If IsObj($oEvtObj) And IsObj($g_oCtx) Then ;~ ConsoleWrite("MouseUp" & @LF) If $bMouseDown Then Local $iX = $oEvtObj.x - $g_oCanvas.offsetLeft, $iY = $oEvtObj.y - $g_oCanvas.offsetTop ; Random color in "#0f1100" (RGB) string form Local $sColor = "#" & Hex(Random(0, 255, 1), 2) & Hex(Random(0, 255, 1), 2) & Hex(Random(0, 255, 1), 2) ;; Draw either a line or circle depending on where the mouse button is released If $iX = $iLastX1 And $iY = $iLastY1 Then ; Circle if mouse start = mouse end $g_oCtx.beginPath() $g_oCtx.arc($iX, $iY, 8, 0, ACos(-1) * 2) $g_oCtx.fillStyle = $sColor $g_oCtx.fill() Else ; Line if mouse start <> mouse end $g_oCtx.beginPath() $g_oCtx.lineWidth = "3" $g_oCtx.strokeStyle = $sColor $g_oCtx.moveTo($iLastX1, $iLastY1) $g_oCtx.lineTo($iX, $iY) $g_oCtx.stroke() EndIf $bMouseDown = 0 EndIf EndIf EndFunc Volatile Func Event_onkeydown($oEvtObj) If IsObj($oEvtObj) Then ConsoleWrite("Event type: " & $oEvtObj.type & "id (0 is document) = " & $oEvtObj.srcElement.id) ConsoleWrite(", keycode = " & $oEvtObj.keyCode & ", shiftkey = " & $oEvtObj.shiftKey & @CRLF) EndIf EndFunc ; ====================================================================================================== #EndRegion IE_EVENT_FUNCS #EndRegion IE_CANVAS_EXAMPLE #Region UTIL_FUNCS ; ====================================================================================================== ; Func _ReRunIfNotElevated() ; ; Does what it says. (rumored to occasionally say what it does) ; ; Author: Ascend4nt ; ====================================================================================================== Func _ReRunIfNotElevated() If IsAdmin() Then Return 0 Else If @Compiled Then ; If compiled to A3X, we need to execute it as if not compiled. Local $sCmd = (@AutoItExe = @ScriptFullPath) ? "" : ("/AutoIt3ExecuteScript " & @ScriptFullPath) Return ShellExecute(@AutoItExe, $sCmd, @ScriptDir, "runas") Else Return ShellExecute(@AutoItExe,@ScriptFullPath,@ScriptDir,"runas") EndIf EndIf EndFunc #EndRegion UTIL_FUNCS IEEmbeddedVersioning.zip ~prev Downloads: 61 Also, HTML5+Javascript standalone Canvas demo (should run in any browser): HTML5StandaloneCanvasDemo.zip1 point
-
_SendTo() - Create a shortcut in the SendTo folder.
argumentum reacted to guinness for a topic
This is a question which gets asked quite a bit >> How to add my program to the SendTo Folder? If this is you and you want to use a simple Function e.g. _SendTo_Install() then this UDF is for you. The UDF uses a Function from called _WinAPI_ShellGetSpecialFolderPath() which is able to retrieve many special folders within Windows, one of which is the SendTo folder. Have a look on MSDN for additional CSIDL identifiers that can be used with this Function. Any suggestions or comments, then please post below. Thanks. UDF: #include-once ; #AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 -w 7 ; #INDEX# ======================================================================================================================= ; Title .........: _SendTo ; AutoIt Version : v3.2.12.1 or higher ; Language ......: English ; Description ...: Create a shortcut in the SendTo folder. ; Note ..........: ; Author(s) .....: guinness ; Remarks .......: Special thanks to Yashied for _WinAPI_ShellGetSpecialFolderPath, which can be found from WinAPIEx.au3 - http://www.autoitscript.com/forum/topic/98712-winapiex-udf ; =============================================================================================================================== ; #INCLUDES# ========================================================================================================= ; None ; #GLOBAL VARIABLES# ================================================================================================= ; None ; #CURRENT# ===================================================================================================================== ; _SendToFolder_Install: Creates a Shortcut in the SendTo folder. ; _SendToFolder_Uninstall: Deletes the Shortcut in the SendTo folder. ; =============================================================================================================================== ; #INTERNAL_USE_ONLY#============================================================================================================ ; __SendTo_ShellGetSpecialFolderPath ......; Retrieves the path of a special folder. ; =============================================================================================================================== ; #FUNCTION# ==================================================================================================================== ; Name ..........: _SendTo_Install ; Description ...: Creates a Shortcut in the SendTo folder. ; Syntax ........: _SendTo_Install([$sName = @ScriptName[, $sFilePath = @ScriptFullPath[, $sCmdLine = '']]]) ; Parameters ....: $sName - [optional] Name of the program. Default is @ScriptName. ; $sFilePath - [optional] Location of the program executable. Default is @ScriptFullPath. ; $sCmdLine - [optional] Additional file arguments. Default is ''. ; Return values .: Success - FileCreateShortcut() Return code. ; Failure - Returns 0 & sets @error to non-zero. ; Author ........: guinness ; Example .......: Yes ; =============================================================================================================================== Func _SendTo_Install($sName = @ScriptName, $sFilePath = @ScriptFullPath, $sCmdLine = '') Local Const $bCSIDL_SENDTO = 0x0009 If $sFilePath = Default Then $sFilePath = @ScriptFullPath EndIf If $sName = Default Then $sName = @ScriptName EndIf $sName = StringRegExpReplace($sName, '.[^./]*$', '') If StringStripWS($sName, 8) = '' Or FileExists($sFilePath) = 0 Then Return SetError(1, 0, 0) EndIf _SendTo_Uninstall($sName, $sFilePath) ; Deletes The Shortcut In The SendTo folder. Local $sSendTo = __SendTo_ShellGetSpecialFolderPath($bCSIDL_SENDTO) Return FileCreateShortcut($sFilePath, $sSendTo & '' & $sName & '.lnk', $sSendTo, $sCmdLine) EndFunc ;==>_SendTo_Install ; #FUNCTION# ==================================================================================================================== ; Name ..........: _SendTo_Uninstall ; Description ...: Deletes the Shortcut in the SendTo folder. ; Syntax ........: _SendTo_Uninstall([$sName = @ScriptName[, $sFilePath = @ScriptFullPath]]) ; Parameters ....: $sName - [optional] Name of the program. Default is @ScriptName. ; $sFilePath - [optional] Location of the program executable. Default is @ScriptFullPath. ; Return values .: Success - FileClose() Return code ; Failure - Returns 0 & sets @error to non-zero. ; Author ........: guinness ; Example .......: Yes ; =============================================================================================================================== Func _SendTo_Uninstall($sName = @ScriptName, $sFilePath = @ScriptFullPath) Local Const $bCSIDL_SENDTO = 0x0009 Local $aFileGetShortcut = 0, $sFileName = '' If $sFilePath = Default Then $sFilePath = @ScriptFullPath EndIf If $sName = Default Then $sName = @ScriptName EndIf $sName = StringRegExpReplace($sName, '.[^./]*$', '') If StringStripWS($sName, 8) = '' Or FileExists($sFilePath) = 0 Then Return SetError(1, 0, 0) EndIf Local $iStringLen = StringLen($sName), $sSendTo = __SendTo_ShellGetSpecialFolderPath($bCSIDL_SENDTO) Local $hSearch = FileFindFirstFile($sSendTo & '' & '*.lnk') If $hSearch = -1 Then Return SetError(1, 0, 0) EndIf While 1 $sFileName = FileFindNextFile($hSearch) If @error Then ExitLoop EndIf If StringLeft($sFileName, $iStringLen) = $sName Then $aFileGetShortcut = FileGetShortcut($sSendTo & '' & $sFileName) If @error Then ContinueLoop EndIf If $aFileGetShortcut[0] = $sFilePath Then FileDelete($sSendTo & '' & $sFileName) EndIf EndIf WEnd Return FileClose($hSearch) EndFunc ;==>_SendTo_Uninstall ; #INTERNAL_USE_ONLY#============================================================================================================ ; #FUNCTION# ==================================================================================================================== ; Name...........: __SendTo_ShellGetSpecialFolderPath renamed from _WinAPI_ShellGetSpecialFolderPath ; Description....: Retrieves the path of a special folder. ; Syntax.........: __SendTo_ShellGetSpecialFolderPath($CSIDL [, $fCreate = 0]) ; Parameters.....: $CSIDL - The CSIDL ($CSIDL_*) that identifies the folder of interest. ; $fCreate - Specifies whether the folder should be created if it does not already exist, valid values: ; |TRUE - The folder is created. ; |FALSE - The folder is not created. (Default) ; Return values..: Success - The full path of a special folder. ; Failure - Empty string and sets the @error flag to non-zero. ; Author.........: Yashied ; Modified.......: ; Remarks........: WinAPIEx.au3 - http://www.autoitscript.com/forum/topic/98712-winapiex-udf ; Related........: ; Link...........: @@MsdnLink@@ SHGetSpecialFolderPath ; Example........: Yes ; =============================================================================================================================== Func __SendTo_ShellGetSpecialFolderPath($CSIDL, $fCreate = 0) Local $tPath = DllStructCreate('wchar[1024]') Local $aReturn = DllCall('shell32.dll', 'int', 'SHGetSpecialFolderPathW', 'hwnd', 0, 'ptr', DllStructGetPtr($tPath), 'int', $CSIDL, 'int', $fCreate) If (@error) Or (Not $aReturn[0]) Then Return SetError(1, 0, '') EndIf Return DllStructGetData($tPath, 1) EndFunc ;==>__SendTo_ShellGetSpecialFolderPathExample 1: #include '_SendTo.au3' Example() Func Example() _SendTo_Install() ; Add the running EXE to the SendTo Folder. ShellExecute(_GetSendToFolder()) Sleep(5000) _SendTo_Uninstall() ; Remove the running EXE from the SendTo folder. EndFunc ;==>Example ; Retrieve the SendTo folder location. Func _GetSendToFolder() Local Const $bCSIDL_SENDTO = 0x0009 Return __SendTo_ShellGetSpecialFolderPath($bCSIDL_SENDTO) EndFunc ;==>_GetSendToFolderAll of the above has been included in a ZIP file. SendTo.zip1 point -
nope but if you make one please share it1 point
-
Missed that. You'd have to use the count -1, because the listview starts at 0, where the count assumes it starts at 1. Using FindInText would do it as well.1 point
-
what you are trying to do is called "changing file association", and instead of simulating that setting via the file properties dialog, look into registry settings or command-line utilities to do that. google "change file association command line" or "change file association registry". also, regarding your original intent, had you bothered to search before asking, you'd have found several topics, such as this:1 point
-
; full match ControlTreeView("Treeview", "", $treeview, "Select", $letter[$i] & " Test") ; partial match (StringInStr used) _GUICtrlTreeView_SelectItem($treeview, _GUICtrlTreeView_FindItem($treeview, $letter[$i] & " ", True)) ; condition match (use any function to work with strings) For $j = 0 To ControlTreeView("Treeview", "", $treeview, "GetItemCount") - 1 $text = ControlTreeView("Treeview", "", $treeview, "GetText", "#" & $j) If StringLeft($text, 1) == $letter[$i] Then ; <= use your own condition ControlTreeView("Treeview", "", $treeview, "Select", $text) ExitLoop EndIf Next1 point
-
ClaudiuZ, You PMed me asking for help to enable the user to enable the camera. As long as the thread remains focused on actions to be taken by the user and not any form of remote activation of the camera I am prepared to reopen the thread. One ploy that springs to mind would be to display a dialog to the user asking them to activate the camera - and possibly not allowing Skype to run until this is not done. M231 point
-
Thanks for coming back and posting your solution1 point
-
Letter enter Letter enter ... fast answer on smartphone1 point
-
Hi folks, Last morning I needed to know programmatically which were my DNS(s) for the current connection, and I searched for an API which fitted my needs... I just tried dnsqueryconfig, which shows the DNS(s) used, if you have manually selected them in the past. The API is little tricky (or maybe I'm little rusty), so I decided to write a small UDF function to avoid a waste of time in the future... here you are. ; #FUNCTION# ==================================================================================================================== ; Name...........: _WinAPI_DnsQueryConfig ; Description ...: Retrieves the currently used DNS servers, if they were selected by user ; Syntax.........: _WinAPI_DnsQueryConfig() ; Return values .: On success it returns an array with the list of currently used DNS servers ; ; On failure it returns 0 and sets @error to non zero (these values are useful only for debugging reasons): ; |1 - DllCall error ; |2 - Generic error, DNS could be generated automatically ; Author ........: j0kky ; Modified ......: 1.0.0 14/11/2018 ; Link ..........: https://docs.microsoft.com/en-us/windows/desktop/api/windns/nf-windns-dnsqueryconfig ; =============================================================================================================================== Func _WinAPI_DnsQueryConfig() Local Const $DnsConfigDnsServerList = 6 Local $aRet = DllCall("Dnsapi.dll", "LONG", "DnsQueryConfig", "int", $DnsConfigDnsServerList, "dword", 0, "ptr", Null, "ptr", 0, "ptr", Null, "dword*", 0) If @error Then Return SetError(1, 0, 0) if $aRet[6] <= 4 Then Return SetError(2, 0, 0) Local $tagBuffer = "" For $i = 1 To ($aRet[6] / 4) $tagBuffer &= "dword;" Next Local $tBuffer = DllStructCreate($tagBuffer) $aRet = DllCall("Dnsapi.dll", "LONG", "DnsQueryConfig", "int", $DnsConfigDnsServerList, "dword", 0, "ptr", Null, "ptr", 0, "ptr", DllStructGetPtr($tBuffer), "dword*", $aRet[6]) Local $aDNS[($aRet[6] / 4) - 1] For $i = 2 to (UBound($aDNS) + 1) $aRet = DllCall("Ws2_32.dll", "str", "inet_ntoa", "dword", DllStructGetData($tBuffer, $i)) if @error Then Return SetError(1, 0, 0) $aDNS[$i - 2] = $aRet[0] Next Return SetError(0, 0, $aDNS) EndFunc1 point
-
Detect double variable declaration
user4157124 reacted to Earthshine for a topic
use a better naming convention such that you give each variable a unique AND MEANINGFUL name. don't use x everywhere and be lazy. Every Error Handler has it's own name. I don't have this problem, ever. in any language meaningful names describe the variable and it's use1 point -
Forum Rules
edenwheeler reacted to Jon for a topic
We want the forum to be a pleasant place for everyone to discuss AutoIt scripting, and we also want to protect the reputation of AutoIt. So we ask you to respect these simple rules while you are here: Forum Posting 1. Do not ask for help with AutoIt scripts, post links to, or start discussion topics on the following subjects: Malware of any form - trojan, virus, keylogger, spam tool, "joke/spoof" script, etc. Bypassing of security measures - log-in and security dialogs, CAPTCHAs, anti-bot agents, software activation, etc. Automation of software/sites contrary to their EULA (see Reporting bullet below). Launching, automation or script interaction with games or game servers, regardless of the game. Running or injecting any code (in any form) intended to alter the original functionality of another process. Decompilation of AutoIt scripts or details of decompiler software. This list is non-exhaustive - the Moderating team reserve the right to close any thread that they feel is contrary to the ethos of the forum. 2. Do not post material that could be considered pornographic, violent or explicit - or express personal opinions that would not be acceptable in a civilized society. Do not post any copyrighted material unless the copyright is owned by you or by this site. 3. To protect this community, any files posted by you are subject to checks to ensure that they do not contain malware. This includes, but is not limited to, decompilation and reverse engineering. 4. Do not flame or insult other members - and just report the thread to a Moderator (see below) if you are so attacked. 5. Do not PM other users asking for support - that is why the forum exists, so post there instead. 6. Do not create multiple accounts - if you inadvertently created multiple accounts then contact a Moderator to close the unwanted ones. 7. Do not repost the same question if the previous thread has been locked - particularly if you merely reword the question to get around one of the prohibitions listed above. 8. Do not delete your posts, nor completely remove their content, if doing so will interrupt the flow of the thread. 9. Do not post in a thread while the Moderating team are actively trying to determine whether it is legal. The Moderation team will do their best to act in fair and reasonable manner. Sanctions will only be applied as a last resort and any action taken will be explained in the relevant thread. If moderation action is taken, you will need to acknowledge this through a dialog or you will be unable to post further in the forum. Please note that this dialog is not an agreement that the warning was justified - it is only there so that members are aware that moderation action has been taken and that they may have certain restrictions applied to their account. If you feel that you have been unfairly moderated then contact the Moderator concerned - using a PM or the "Report" button is preferable to opening a new thread (although new members may have to do this). But do be aware that the Moderation team has the final word - the rules are set out by the site owner and you are only welcome here if you respect his wishes. Signatures and Avatars There is no formal policy for the use of signatures but if a moderator thinks it is too big and/or distracting then you may be asked to tone it down. No-one likes wading through signatures that are a page high. Similarly for avatars, expect distracting flashing and animated gifs to be removed. Reporting If you feel a post needs Moderator attention, please use the "Report" button next to the post date at the top. You can then enter details of why you have reported the post - but there is no need to include the content of the post as that is done automatically. The Moderating team will be alerted to the post and will deal with it as soon as they can. If you suspect a EULA violation, do not expect the Moderating team to do all the work - please provide some evidence in the report such as a copy of (or link to) the EULA in question, as well as the section you believe has been violated. Finally, please do not enter into an argument with the original poster - that is why we have Moderators. Spam Please do not react to spam in any way other than reporting it. Multiple reports are combined by the forum software, so there is no need to announce that you have reported the spam - in fact doing so only increases the work for the Moderator who deals with it. Interacting with this website Anyone found abusing the website is subject to harsh punishment without warning. A non-exhaustive list of potential abuses include: Automated forum registration or login. Automated posting or sending messages on the forum. Automated manipulation of polls, user reputation or other forum features. Automated creation or comments on issue tracker tickets. Automated creation or editing of wiki pages. Other abuses which are either examples of excessive bandwidth usage or automation of the site. Use common sense. If you do not have common sense, don't do anything. Do not automate the forum, wiki or issue tracker in any way at all. Scripts which automatically update AutoIt such as AutoUpdateIt are acceptable as long as they are not abused and do not generate excessive bandwidth usage.1 point -
I was able to get this going, for future reference, here is the finished script (it's terribly messy but it did the job!) convert.au3 _FindInFile.au3 Base64.au31 point
-
Ver 1.0.3 August 12, 2008 Works Great... heres an ini i built with it.. (pace it in scriptDir\Games\CurveBall.ini CureveBall.ini [Colors] 1=0xDFFFD7 2=0xE5FFE0 3=0xE0FFD8 4=0xE4FFDE 5=0xEBFFE7 6=0xEFFFEC 7=0xD4FFCA 8=0xABFF96 9=0xC6FFB8 10=0xF2FFEF [Settings] Run=1 Launcher=http://www.albinoblacksheep.com/flash/curveball.php Left=312 Top=331 Right=708 Bottom=593 Vary=50 Wait=1 Skip=10 CWait=0 and the GameBot - Builder #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <File.au3> Dim $ver = "1.0.3" Dim $pos = "", $CHex = "", $Cpos = "", $Count = 0, $data[11], $Label_[11], $Run, $Launcher, $cwait = 0 Dim $pause, $left = 0, $right = @DesktopWidth, $top = 0, $bottom = @DesktopHeight, $wait = 1000, $Vary = 5, $Skip = 5 Dim $Gloc = @ScriptDir & "\Games\", $Ginfo Opt("PixelCoordMode", 0) ;1=absolute, 0=relative, 2=client Opt("MouseCoordMode", 0) ;1=absolute, 0=relative, 2=client HotKeySet("{ESC}", "Terminate") $Gamebot = GUICreate("GameBot - Builder by, QTasc v" & $ver, 392, 402, -1, -1, -1, $WS_EX_ACCEPTFILES) $Group_1 = GUICtrlCreateGroup("Game Select", 10, 10, 370, 60) $Combo_2 = GUICtrlCreateCombo("New Game", 20, 34, 110, 21) $Button_3 = GUICtrlCreateButton("Select Game", 150, 30, 100, 30) Set_Game_List() $Button_4 = GUICtrlCreateButton("Delete Game", 270, 30, 100, 30) $Group_5 = GUICtrlCreateGroup("Game Launch", 10, 80, 370, 80) $Radio_6 = GUICtrlCreateRadio("Run URL", 30, 100, 80, 20) $Radio_7 = GUICtrlCreateRadio("Run Game exe", 110, 100, 100, 20) $Input_8 = GUICtrlCreateInput("Type or Drag & Drop - URL or Game exe/link", 20, 130, 340, 20, -1, $WS_EX_ACCEPTFILES) GUICtrlSetState(-1, $GUI_DROPACCEPTED) GUICtrlSetState(-1, $GUI_DISABLE) $Radio_9 = GUICtrlCreateRadio("Dont Launch Anything", 230, 100, 130, 20) GUICtrlSetState(-1, $GUI_CHECKED) $Group_10 = GUICtrlCreateGroup("Pixel Search Area", 10, 170, 370, 100) $Label_11 = GUICtrlCreateLabel("Left Top Right Bottom Varience Skip", 20, 190, 350, 20) $Input_12 = GUICtrlCreateInput($left, 20, 210, 40, 20) $Input_13 = GUICtrlCreateInput($top, 80, 210, 40, 20) $Input_14 = GUICtrlCreateInput($right, 140, 210, 40, 20) $Label_16 = GUICtrlCreateLabel("Color Wait", 20, 243, 50, 20) $Input_19 = GUICtrlCreateInput($cwait, 80, 240, 40, 20) $Input_15 = GUICtrlCreateInput($bottom, 200, 210, 40, 20) $Label_16 = GUICtrlCreateLabel("Search Wait", 135, 243, 60, 20) $Input_17 = GUICtrlCreateInput($Vary, 260, 210, 40, 20) $Input_18 = GUICtrlCreateInput($wait, 200, 240, 40, 20) $Group_19 = GUICtrlCreateGroup("Colors to Search - 10 Max", 10, 280, 370, 70) $Input_20 = GUICtrlCreateInput($Skip, 320, 210, 40, 20) $Label_[1] = GUICtrlCreateLabel("1", 20, 300, 50, 20) $Label_[2] = GUICtrlCreateLabel("2", 70, 300, 50, 20) $Label_[3] = GUICtrlCreateLabel("3", 120, 300, 50, 20) $Label_[4] = GUICtrlCreateLabel("4", 170, 300, 50, 20) $Label_[5] = GUICtrlCreateLabel("5", 220, 300, 50, 20) $Label_[6] = GUICtrlCreateLabel("6", 20, 320, 50, 20) $Label_[7] = GUICtrlCreateLabel("7", 70, 320, 50, 20) $Label_[8] = GUICtrlCreateLabel("8", 120, 320, 50, 20) $Label_[9] = GUICtrlCreateLabel("9", 170, 320, 50, 20) $Label_[10] = GUICtrlCreateLabel("10", 220, 320, 50, 20) $Button_29 = GUICtrlCreateButton("Get Area", 280, 240, 90, 25) $Button_30 = GUICtrlCreateButton("Get Colors", 280, 290, 90, 25) $Button_31 = GUICtrlCreateButton("Clear All", 280, 320, 90, 25) $Button_32 = GUICtrlCreateButton("Save Game Info", 10, 360, 110, 30) $Button_33 = GUICtrlCreateButton("Run GameBot", 140, 360, 110, 30) $Button_34 = GUICtrlCreateButton("Exit GameBot", 270, 360, 110, 30) GUISetState() While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE Or $msg = $Button_34 ExitLoop Case $msg = $Button_3 $Ginfo = GUICtrlRead($Combo_2) If $Ginfo = "" Then ; nada ElseIf $Ginfo = "New Game" Then Set_new_game() Else Set_game() EndIf Case $msg = $Button_4 $Ginfo = GUICtrlRead($Combo_2) If $Ginfo = "New Game" Or $Ginfo = "" Then ; nada Else FileDelete($Gloc & $Ginfo & ".ini") Set_Game_List() EndIf Case $msg = $Radio_6 GUICtrlSetState($Radio_7, $GUI_UNCHECKED) GUICtrlSetState($Radio_9, $GUI_UNCHECKED) GUICtrlSetState($Input_8, $GUI_ENABLE) GUICtrlSetState($Radio_6, $GUI_CHECKED) GUICtrlSetState($Input_8, $GUI_DROPACCEPTED) Case $msg = $Radio_7 GUICtrlSetState($Radio_6, $GUI_UNCHECKED) GUICtrlSetState($Radio_9, $GUI_UNCHECKED) GUICtrlSetState($Input_8, $GUI_ENABLE) GUICtrlSetState($Radio_7, $GUI_CHECKED) GUICtrlSetState($Input_8, $GUI_DROPACCEPTED) Case $msg = $Radio_9 GUICtrlSetState($Radio_6, $GUI_UNCHECKED) GUICtrlSetState($Radio_7, $GUI_UNCHECKED) GUICtrlSetState($Input_8, $GUI_DISABLE) GUICtrlSetState($Radio_9, $GUI_CHECKED) Case $msg = $Button_29 Get_Area() Case $msg = $Button_30 Get_Colors() Case $msg = $Button_31 Clear_Colors() Case $msg = $Button_32 Save_Game() Case $msg = $Button_33 Set_Run() Case Else ;;; EndSelect WEnd Exit ; --------------------- Functions ----------------------- Func Set_new_game() If FileExists($Gloc & $Ginfo & ".ini") Then MsgBox(262208, "Sorry!", "That File Already Exists! " & @CRLF & $Gloc & $Ginfo & ".ini ", 5) Return EndIf $NewG = InputBox("New GameBot", "Please type in a New Game Name ", "", "", 200, 120) If $NewG = "" Then Return DirCreate($Gloc) FileWrite($Gloc & $NewG & ".ini", "") GUICtrlSetState($Radio_9, $GUI_CHECKED) GUICtrlSetState($Radio_7, $GUI_UNCHECKED) GUICtrlSetState($Radio_6, $GUI_UNCHECKED) GUICtrlSetData($Input_8, "Type or Drag & Drop - URL or Game exe/link") GUICtrlSetState($Input_8, $GUI_DISABLE) GUICtrlSetData($Input_12, 1) GUICtrlSetData($Input_13, 1) GUICtrlSetData($Input_14, @DesktopWidth) GUICtrlSetData($Input_15, @DesktopHeight) GUICtrlSetData($Input_17, 5) GUICtrlSetData($Input_18, 1000) GUICtrlSetData($Input_19, 1000) GUICtrlSetData($Input_20, 5) Set_Game_List() EndFunc;==>Set_new_game Func Set_Game_List() $FileList = _FileListToArray ($Gloc) If (Not IsArray($FileList)) Or (@error = 1) Then MsgBox(262208, "Sorry!", "No Files\Folders Found in." & @CRLF & $Gloc & " ", 5) Return EndIf GUICtrlSetData($Combo_2, "") For $x = 1 To $FileList[0] GUICtrlSetData($Combo_2, StringTrimRight($FileList[$x], 4) & "|", 1) Next GUICtrlSetData($Combo_2, "New Game") EndFunc;==>Set_Game_List Func Set_game() If Not FileExists($Gloc & $Ginfo & ".ini") Then MsgBox(262208, "Sorry!", "That File Does Not Exist! " & @CRLF & $Gloc & $Ginfo & ".ini " & @CRLF & 'Please choose "New Game" to Create a New GameBot ', 5) Return EndIf $Run = IniRead($Gloc & $Ginfo & ".ini", "Settings", "Run", "0") If $Run = 0 Then GUICtrlSetState($Radio_9, $GUI_CHECKED) GUICtrlSetState($Radio_7, $GUI_UNCHECKED) GUICtrlSetState($Radio_6, $GUI_UNCHECKED) GUICtrlSetData($Input_8, "No Launch") GUICtrlSetState($Input_8, $GUI_DISABLE) $Launcher = "" ElseIf $Run = 1 Then GUICtrlSetState($Radio_7, $GUI_UNCHECKED) GUICtrlSetState($Radio_9, $GUI_UNCHECKED) $Launcher = IniRead($Gloc & $Ginfo & ".ini", "Settings", "Launcher", "Not Found") GUICtrlSetState($Input_8, $GUI_ENABLE) GUICtrlSetData($Input_8, $Launcher) GUICtrlSetState($Radio_6, $GUI_CHECKED) ElseIf $Run = 2 Then GUICtrlSetState($Radio_6, $GUI_UNCHECKED) GUICtrlSetState($Radio_9, $GUI_UNCHECKED) $Launcher = IniRead($Gloc & $Ginfo & ".ini", "Settings", "Launcher", "Not Found") GUICtrlSetState($Input_8, $GUI_ENABLE) GUICtrlSetData($Input_8, $Launcher) GUICtrlSetState($Radio_7, $GUI_CHECKED) EndIf ; pixel search $left = IniRead($Gloc & $Ginfo & ".ini", "Settings", "Left", "None") GUICtrlSetData($Input_12, $left) $top = IniRead($Gloc & $Ginfo & ".ini", "Settings", "Top", "None") GUICtrlSetData($Input_13, $top) $right = IniRead($Gloc & $Ginfo & ".ini", "Settings", "Right", "None") GUICtrlSetData($Input_14, $right) $bottom = IniRead($Gloc & $Ginfo & ".ini", "Settings", "Bottom", "None") GUICtrlSetData($Input_15, $bottom) $Vary = IniRead($Gloc & $Ginfo & ".ini", "Settings", "Vary", "5") GUICtrlSetData($Input_17, $Vary) $cwait = IniRead($Gloc & $Ginfo & ".ini", "Settings", "CWait", "0") GUICtrlSetData($Input_19, $cwait) $wait = IniRead($Gloc & $Ginfo & ".ini", "Settings", "Wait", "1000") GUICtrlSetData($Input_18, $wait) $Skip = IniRead($Gloc & $Ginfo & ".ini", "Settings", "Skip", "5") GUICtrlSetData($Input_20, $Skip) ; colors If IniRead($Gloc & $Ginfo & ".ini", "Colors", "1", "") = "" Then MsgBox(262208, "Sorry!", "No Colors were Found! ", 5) Return EndIf $Colors = IniReadSection($Gloc & $Ginfo & ".ini", "Colors") For $i = 0 To $Colors[0][0] $data[$i] = IniRead($Gloc & $Ginfo & ".ini", "Colors", $i, "") ;GUICtrlSetData($Label_[$i], $data[$i]) GUICtrlSetBkColor($Label_[$i], $data[$i]) If $i >= 10 Then ExitLoop Next EndFunc;==>Set_game Func Get_Colors() $Ginfo = GUICtrlRead($Combo_2) If $Ginfo = "New Game" Or $Ginfo = "" Then MsgBox(262208, "Sorry!", "Please Select a Game Name First ", 5) Return EndIf If GUICtrlRead($Button_30) = "Get Colors" Then HotKeySet("{F9}", "set_color") ToolTip('Press "F9" to Get the Color under the Mouse, Click "Done" when Finished', 0, 0) GUICtrlSetData($Button_30, "Done") Return Else HotKeySet("{F9}") ToolTip('') GUICtrlSetData($Button_30, "Get Colors") MsgBox(262208, "Saved!", "The Colors have been Saved to " & @CRLF & $Gloc & $Ginfo & ".ini" & " ", 5) $Count = 0 EndIf EndFunc;==>Get_Colors Func set_color() $Ginfo = GUICtrlRead($Combo_2) $pos = MouseGetPos() $CHex = Hex(PixelGetColor($pos[0], $pos[1]), 6) $Count = $Count + 1 If $Count > 10 Then MsgBox(262208, "Sorry!", "Colors pre-selected is Full! ", 5) Return Else IniWrite($Gloc & $Ginfo & ".ini", "Colors", $Count, "0x" & $CHex) GUICtrlSetBkColor($Label_[$Count], "0x" & $CHex) EndIf EndFunc;==>set_color Func Clear_Colors() For $x = 1 To 10 GUICtrlSetBkColor($Label_[$x], 0xECE9D8) Next $Count = 0 EndFunc;==>Clear_Colors Func Get_Area() $Ginfo = GUICtrlRead($Combo_2) If $Ginfo = "New Game" Or $Ginfo = "" Then MsgBox(262208, "Sorry!", "Please Select a Game Name First ", 5) Return EndIf $Count = 0 If GUICtrlRead($Button_29) = "Get Area" Then HotKeySet("{F9}", "set_Area") ToolTip('Press "F9" to Get the Area under the Mouse Left-Top-Right-Bottom, Click "Done" when Finished', 0, 0) GUICtrlSetData($Button_29, "Done") Return Else HotKeySet("{F9}") ToolTip('') GUICtrlSetData($Button_29, "Get Area") $Count = 0 EndIf EndFunc;==>Get_Area Func set_Area() $Count = $Count + 1 $Mpos = MouseGetPos() If $Count = 1 Then GUICtrlSetData($Input_12, $Mpos[0]) If $Count = 2 Then GUICtrlSetData($Input_13, $Mpos[1]) If $Count = 3 Then GUICtrlSetData($Input_14, $Mpos[0]) If $Count = 4 Then GUICtrlSetData($Input_15, $Mpos[1]) If $Count >= 4 Then $Count = 0 EndFunc;==>set_Area Func Save_Game() $Ginfo = GUICtrlRead($Combo_2) If $Ginfo = "New Game" Or $Ginfo = "" Then MsgBox(262208, "Sorry!", "Please Select a Game Name First ", 5) Return EndIf If Not FileExists($Gloc & $Ginfo & ".ini") Then MsgBox(262208, "Sorry!", "That File Does Not Exist! " & @CRLF & $Gloc & $Ginfo & ".ini " & @CRLF & 'Please choose "New Game" to Create a New GameBot ', 5) Return EndIf $Run = "L" If BitAND(GUICtrlRead($Radio_9), $GUI_CHECKED) = $GUI_CHECKED Then $Run = 0 $Launcher = "No Launch" ElseIf BitAND(GUICtrlRead($Radio_7), $GUI_CHECKED) = $GUI_CHECKED Then $Run = 2 $Launcher = GUICtrlRead($Input_8) ElseIf BitAND(GUICtrlRead($Radio_6), $GUI_CHECKED) = $GUI_CHECKED Then $Run = 1 $Launcher = GUICtrlRead($Input_8) EndIf If $Run = "L" Or $Launcher = "" Then MsgBox(262208, "Sorry!", "Run Select Error ", 5) MsgBox(0, $Run, $Launcher) Return EndIf $left = GUICtrlRead($Input_12) $top = GUICtrlRead($Input_13) $right = GUICtrlRead($Input_14) $bottom = GUICtrlRead($Input_15) $Vary = GUICtrlRead($Input_17) $wait = GUICtrlRead($Input_18) $cwait = GUICtrlRead($Input_19) $Skip = GUICtrlRead($Input_20) If $Run = 0 Then IniWrite($Gloc & $Ginfo & ".ini", "Settings", "Run", $Run) IniWrite($Gloc & $Ginfo & ".ini", "Settings", "Launcher", "No Launch") Else IniWrite($Gloc & $Ginfo & ".ini", "Settings", "Run", $Run) IniWrite($Gloc & $Ginfo & ".ini", "Settings", "Launcher", $Launcher) EndIf IniWrite($Gloc & $Ginfo & ".ini", "Settings", "Left", $left) IniWrite($Gloc & $Ginfo & ".ini", "Settings", "Top", $top) IniWrite($Gloc & $Ginfo & ".ini", "Settings", "Right", $right) IniWrite($Gloc & $Ginfo & ".ini", "Settings", "Bottom", $bottom) IniWrite($Gloc & $Ginfo & ".ini", "Settings", "Vary", $Vary) IniWrite($Gloc & $Ginfo & ".ini", "Settings", "CWait", $cwait) IniWrite($Gloc & $Ginfo & ".ini", "Settings", "Wait", $wait) IniWrite($Gloc & $Ginfo & ".ini", "Settings", "Skip", $Skip) MsgBox(262208, "Done!", "File appears to be written Correctly! ", 5) EndFunc;==>Save_Game Func Set_Run() $Ginfo = GUICtrlRead($Combo_2) If $Ginfo = "New Game" Or $Ginfo = "" Then MsgBox(262208, "Sorry!", "Please Select a Game Name First ", 5) Return EndIf If Not FileExists($Gloc & $Ginfo & ".ini") Then MsgBox(262208, "Sorry!", "That File Does Not Exist! " & @CRLF & $Gloc & $Ginfo & ".ini " & @CRLF & 'Please choose "New Game" to Create a New GameBot ', 5) Return EndIf If IniRead($Gloc & $Ginfo & ".ini", "Colors", "1", "") = "" Then MsgBox(262208, "Sorry!", "No Colors were Found! ", 5) Return EndIf If $Run = 1 Then Run(@ComSpec & " /c Start " & $Launcher, "", @SW_HIDE) ElseIf $Run = 2 Then $Launched = FileGetShortName($Launcher) Run(@ComSpec & " /c Start " & $Launched, "", @SW_HIDE) EndIf GUISetState(@SW_MINIMIZE, $Gamebot) ToolTip('Press F9 to Start Game', 0, 0) _ReduceMemory() HotKeySet("{F9}", "_start") EndFunc;==>Set_Run Func _start() $Colors = IniReadSection($Gloc & $Ginfo & ".ini", "Colors") For $i = 0 To $Colors[0][0] $data[$i] = IniRead($Gloc & $Ginfo & ".ini", "Colors", $i, "") If $i >= 10 Then ExitLoop Next $pause = Not $pause While $pause ToolTip('GameBot is "Running".. Press F9 to Quit', 0, 0) $t = 0 Do $t = $t + 1 If $t > 10 Then ExitLoop Sleep($cwait) $Cpos = PixelSearch($left, $top, $right, $bottom, $data[$t], $Vary, $Skip) Until Not @error If $t > 10 Then ContinueLoop MouseClick("left", $Cpos[0], $Cpos[1], 1, 0) ;MouseMove($left, $top) Sleep($wait) WEnd ToolTip('') GUISetState(@SW_RESTORE, $Gamebot) HotKeySet("{F9}") EndFunc;==>_start Func _ReduceMemory() Local $ai_Return = DllCall("psapi.dll", 'int', 'EmptyWorkingSet', 'long', -1) Return $ai_Return[0] EndFunc;==>_ReduceMemory Func Terminate() Exit EndFunc;==>Terminate Enjoy!!! Valuater 8)1 point
-
How to Add hours to _nowtime
AndrewSchultz reacted to Varian for a topic
You either needed to add a parentheses at the end of line 6 or remove the first parentheses. Also, if you are trying to combine strings, you use "&" not "+"...this makes is a mathematical computation (add). You can try this, but I don't know if it is what you are looking for: #include <GUIConstantsEx.au3> #include <Date.au3> $MyString = _NowTime () ;+ "00:00:15" $MyString2 = $Mystring & @LF & _DateAdd( 'h' ,2, _NowCalc()) GUICreate("Hello World", 200, 100) GUICtrlCreateLabel($MyString, 50, 10) GUICtrlCreateLabel($MyString2, 50, 40, 120, 70) GUISetState(@SW_SHOW) Sleep(5000)1 point -
How to Add hours to _nowtime
AndrewSchultz reacted to SadBunny for a topic
You can do that easily with the _DateAdd function. There is an example in the helpfile for that function that adds 15 minutes to the current time - this can be easily modified to add 2 hours: #Include <Date.au3> ; Add 2 hours to current time $sNewDate = _DateAdd( 'h',2, _NowCalc()) MsgBox( 4096, "", "Current time +2 hours: " & $sNewDate )1 point