Leaderboard
Popular Content
Showing content with the highest reputation on 07/24/2015 in all areas
-
The long awaited! Magic Number CalculatorMagic Number Calculator is a useful tool if you have code which does not uses constants but instead use magic numbers to specify Styles & ExStyles... Its Features: Small & Compact Standalone exeutableAutomatically generates the Corrected function lineMade for the lazy, Press the "Press the Paste Button", "Press the Calculate Button", Wait, "Press the Copy Button" & Done!Fast CalculationsThe Unlicensed Open Source >>> Links <<< Source & Version Archive Bug Submission & Bug Tracker >>>Download<<< https://www.autoitscript.com/forum/files/file/352-magic-number-calculator/ Please Report Bugs & Request Features in the Bug Submission form! It will help me keep track of all requests! P.S If you are not able to view the sources & version archive, please try disabling your adblocker3 points
-
I was needing to check all my connected networks and check if there is internet connection. so I wrote this function. #include <MsgBoxConstants.au3> #include <Array.au3> Global $NLM_ENUM_NETWORK_CONNECTED = 0x01 ;~ Global $NLM_ENUM_NETWORK_DISCONNECTED = 0x02 ;~ Global $NLM_ENUM_NETWORK_ALL = 0x03 Global Enum $eName, $eIsConectedtoInternet Local $aNetworks = GetNetWorks() If @extended Then For $i = 0 To @extended - 1 ConsoleWrite("NetWork Name: " & $aNetworks[$i][$eName] & "| IsConectedToInternet: " & $aNetworks[$i][$eIsConectedtoInternet] & @CRLF) Next _ArrayDisplay($aNetworks, "NetWork Name|NetWork Is Conected to Internet") EndIf ;~ Success: Return an 2DArray[][] and sets @extended Ubound of Array ;~ Failure: Return 0 and set @extended 0 Func GetNetWorks($NLM_ENUM_NETWORK = $NLM_ENUM_NETWORK_CONNECTED) Local $aNetworks[0][2] ;[n][0]NetWorks Name|[n][1]isConnectedtoInternet Local $INetworks = 0 Local $ReDim = 0 Local $oErrorHandler = ObjEvent("AutoIt.Error", "_ErrFunc") Local $oINetworkListManager = ObjCreate("{DCB00C01-570F-4A9B-8D69-199FDBA5723B}") ;Create INetworkListManager Object by CLSID If Not IsObj($oINetworkListManager) Then Return 0 $INetworks = $oINetworkListManager.GetNetworks($NLM_ENUM_NETWORK) If Not IsObj($INetworks) Then Return 0 For $INetwork In $INetworks $ReDim = UBound($aNetworks, 1) + 1 ReDim $aNetworks[$ReDim][2] $aNetworks[$ReDim - 1][0] = $INetwork.GetName $aNetworks[$ReDim - 1][1] = $INetwork.isConnectedtoInternet Next $oINetworkListManager = 0 ;Free Return SetExtended($ReDim, $aNetworks) EndFunc ;==>GetNetWorks ; User's COM error function. Will be called if COM error occurs Func _ErrFunc($oError) ; Do anything here. ConsoleWrite(@ScriptName & " (" & $oError.scriptline & ") : ==> COM Error intercepted !" & @CRLF & _ @TAB & "err.number is: " & @TAB & @TAB & "0x" & Hex($oError.number) & @CRLF & _ @TAB & "err.windescription:" & @TAB & $oError.windescription & @CRLF & _ @TAB & "err.description is: " & @TAB & $oError.description & @CRLF & _ @TAB & "err.source is: " & @TAB & @TAB & $oError.source & @CRLF & _ @TAB & "err.helpfile is: " & @TAB & $oError.helpfile & @CRLF & _ @TAB & "err.helpcontext is: " & @TAB & $oError.helpcontext & @CRLF & _ @TAB & "err.lastdllerror is: " & @TAB & $oError.lastdllerror & @CRLF & _ @TAB & "err.scriptline is: " & @TAB & $oError.scriptline & @CRLF & _ @TAB & "err.retcode is: " & @TAB & "0x" & Hex($oError.retcode) & @CRLF & @CRLF) EndFunc ;==>_ErrFunc Saludos3 points
-
@Jfish, you're not the only one. In the help file we use MsgBox($MB_SYSTEMMODAL, "", "Example message box") ; $MB_SYSTEMMODAL is better than 4096, as 4096 has little meaning if you don't look it up ; Or if you would like... MsgBox($MB_OK, "", "Example message box") ; Again $MB_OK is clear as to what it will show compared to 0 or ""As AutoIt isn't statically typed, "" becomes 0 e.g. If 0 = "" Then will result in true. Though I personally try to be explicit with everything, so I would write that as If 0 = Int("") Then I know I am comparing two integers. Honestly though, I do take the JavaScript approach these days with triple equals (in AutoIt it's two) by which I compare both type and value (I noticed you didn't have this in the table =D) What do you think this displays? #include <MsgBoxConstants.au3> Local $iAge = 20 Local $sAge = '20' If $iAge == $sAge Then MsgBox($MB_SYSTEMMODAL, '', 'They are equal') Else MsgBox($MB_SYSTEMMODAL, '', 'They are NOT equal') EndIf If $iAge = $sAge Then MsgBox($MB_SYSTEMMODAL, '', 'They are equal') Else MsgBox($MB_SYSTEMMODAL, '', 'They are NOT equal') EndIfFor some they would be like "what the h...?!"2 points
-
Version 1.2
29,304 downloads
I wrote an introductory text for new programmers to learn how to code using AutoIt. It follows along with the help file for the most part – but provides additional context and attempts to connect all the information in a cohesive way for someone without any programming experience. I find the help file to be an AMAZING resource and the text I wrote in no way reflects any opinion to the contrary. Rather, it was created from the perspective of someone who struggled early on with the most basic concepts and thought that a hand-holding guide could be useful. I was also inspired by code.org who is trying to encourage people to learn to code. I thought – what better way than to use free tools that you can download at any time with access to an amazing community? If only there was a guide to walk people through it … Full discussion about the file can be found here: https://www.autoitscript.com/forum/topic/174205-introductory-learn-to-program-text-using-au3/1 point -
How can I read the data of a Combo?
SevereMessage reacted to water for a topic
Case $SellSelected ; When the Sell button is pressed check which item to sell. $sComboRead = GUICtrlRead($hComboBox) If $sComboRead = "xy" Then ... Something like this?1 point -
How can I read the data of a Combo?
SevereMessage reacted to water for a topic
Something like this: #include <GUIConstantsEx.au3> #include <MsgBoxConstants.au3> Local $sComboRead = "" Local $hGUI = GUICreate("Example", 300, 200) Local $hComboBox = GUICtrlCreateCombo("Choose a Gem to sell!", 10, 10, 185, 20) GUICtrlSetData($hComboBox, "Ruby|Emerald|Sapphire|Topaz") Local $hClose = GUICtrlCreateButton("Close", 210, 170, 85, 25) GUISetState(@SW_SHOW, $hGUI) ; Loop until the user exits. While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE, $hClose ExitLoop Case $hComboBox $sComboRead = GUICtrlRead($hComboBox) MsgBox($MB_SYSTEMMODAL, "", "You have selected: " & $sComboRead, 0, $hGUI) EndSwitch WEnd1 point -
How can I read the data of a Combo?
SevereMessage reacted to water for a topic
Is this the whole script you posted? You need to run a loop to wait until the control has been selected.1 point -
How can I read the data of a Combo?
SevereMessage reacted to water for a topic
Until you have not selected an item the default value is being returned.1 point -
@Jewtus, please don't duplicate code around the forum. Instead be polite and post a link back to where you got the original code from. Providing a backlink is better than copying, because no doubt @czardas will update that particular function in the near future. Therefore by linking, you guarantee an up to date function for those who come across your post. Unless you will be updating this post as well with every update they make?1 point
-
Deleting System Environment Path Variable Values
ViciousXUSMC reacted to jguinch for a topic
Here are my two functions : ; iFlag possible combinations : ; - 0 : add the sText to the beginning (default) ; - 1 : add the sText to the end ; - 2 : add the sText even if it is already present Func _AddToPath($sText, $iFlag = 0) If NOT IsAdmin() Then Return SetError(4, 0, 0) Local $sPath = RegRead("HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment", "path") If NOT BitAND($iFlag, 2) AND StringRegExp($sPath, "(?i)(?:^|;)\Q" & $sText & "\E(?:;|$)") Then Return SetError(5, 0, 1) Local $sNewPath = $sText & ";" & $sPath If BitAND($iFlag, 1) Then $sNewPath = $sPath & ";" & $sText RegWrite("HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment", "path2", "REG_EXPAND_SZ", $sNewPath) If @error Then Return SetError(@error, 0, 0) EnvUpdate() Return 1 EndFunc ; iFlag = 0 : match exactly the text (default) ; iFlag = 1 : match part of the text Func _RemoveFromPath($sText, $iFlag = 0) If NOT IsAdmin() Then Return SetError(4, 0, 0) Local $sPattern = "\Q" & $sText & "\E*" If $iFlag Then $sPattern = "[^;]*" & $sPattern & "[^;]*" Local $sPath = RegRead("HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment", "path") Local $sNewPath = StringRegExpReplace($sPath, "(?i)(?<=^|;)" & $sPattern & "(?:;|$)", "") Local $iExtended = @extended If $iExtended Then RegWrite("HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment", "path2", "REG_EXPAND_SZ", $sNewPath) If @error Then Return SetError(@error, 0, 0) EnvUpdate() EndIf ConsoleWrite($sNewPath) Return SetExtended($iExtended, 1) EndFunc1 point -
well, (?=^.{8}$)(?=.*\d)(?=.*[[:lower:]])(?=.*[[:upper:]])(?=.*[[:alnum:]])(?=.*[^[:alnum:]])(?!.*[^[:ascii:]])1 point
-
Message window does not always appear on top
supraspecies reacted to kylomas for a topic
supraspecies, By default MSGBOX is modal (I believe) so I suspect a timing issue. The solution from MilesAhead should solve your problem. Here is a discussion of dialog box types. kylomas1 point -
@TheSaint - I picked up your changes. They will be in the next draft. Thanks again.1 point
-
Message window does not always appear on top
supraspecies reacted to MilesAhead for a topic
I can remember that happening to me a lot when programming using MFC. The messagebox would display but it was behind the application window. It happened often enough that I made my messageboxes System Modal.1 point -
New tools and new goal for autoit
kcvinu reacted to JLogan3o13 for a topic
I keep reading "I'm going to", "I will". Fantastic for you! Wish you the best in your endeavors! I would say a smart man only posts when he can say "I did" or "I finished...".1 point -
Thanks but I it was not exactly that. I started it last year and probably had an older version installed at the time. Also, I don't want anyone to think I hammered it out all day every day. It was several weekends over the course of a several months.1 point
-
I would like to see one of your huge scripts made with this principles in mind. All we have seen until now are some small and simple scripts When trying to make good scripts/programs it is not about coding but planning. The design you make before you write the first line of code is what makes good code or in absence you get a pile of s..t sooner or later. Coding is less then 10% of the effort to write a good program. The rest is design, testing, documentation etc Just my 2 cents..1 point