Leaderboard
Popular Content
Showing content with the highest reputation on 12/01/2017 in all areas
-
An oldie but goodie, I was cleaning house and found this old snippet I made back in Apr 2013. It still has some utility, so I figured I'd share it. It runs netstat and populates the output into an array. Very Pretty simple. #include <Constants.au3> #include <Process.au3> #include <Array.au3> Local $aNetStatData = _NetStat_GetData() Local $sHeaders = _ArrayToString($aNetStatData,"|",0,0) _ArrayDelete($aNetStatData, 0) _ArrayDisplay($aNetStatData,"NetStat", "", 32, Default, $sHeaders) Func _NetStat_GetData($bAddProcessName = True) Local $aNetStatData = _NetStat_ProcessOutput(_NetStat_GetOutput()) If $bAddProcessName Then _NetStat_AddProcessName($aNetStatData) Return $aNetStatData EndFunc Func _NetStat_GetOutput() ;Run netstat CMD and get StdOut Local $sNetStatOutput = _RunCMD("netstat.exe -a -o -f") Return $sNetStatOutput EndFunc Func _NetStat_ProcessOutput($sNetStatOutput) ;Convert netstat StdOut to Array Local $arr = StringSplit(StringStripWS($sNetStatOutput,4),@CR) Local $aRecord Dim $aNetStatData[1][5]=[["Protocol","Local Address","Foreign Address","State","PID"]] ReDim $aNetStatData[$arr[0]-3][5] For $iX = 1 To UBound($aNetStatData)-1 $aRecord = StringSplit($arr[$iX+3]," ") If $aRecord[1]="TCP" Then For $iY = 0 to $aRecord[0]-1 $aNetStatData[$iX][$iY] = $aRecord[$iY+1] Next ElseIf $aRecord[1]="UDP" Then For $iY = 0 to $aRecord[0]-2 $aNetStatData[$iX][$iY] = $aRecord[$iY+1] Next $aNetStatData[$iX][4] = $aRecord[4] EndIf Next Return $aNetStatData EndFunc Func _NetStat_AddProcessName(ByRef $aNetStatData) ;Add processname to NetStat Array ;Create NetStat PID / Process Name Array Local $aPIDs = _ArrayUnique($aNetStatData,4,0,0,0) _ArrayColInsert($aPIDs,1) $aPIDs[0][1] = "Process Name" For $iX = 1 To UBound($aPIDs)-1 $aPIDs[$iX][1] = _ProcessGetName($aPIDs[$iX][0]) Next ;Add Process Names to NetStat Array _ArrayColInsert($aNetStatData,5) $aNetStatData[0][5] = "Process Name" For $iX = 1 to UBound($aNetStatData)-1 Local $sProcessName = $aPIDs[_ArraySearch($aPIDs, $aNetStatData[$iX][4])][1] If $sProcessName Then $aNetStatData[$iX][5] = $sProcessName Next EndFunc Func _RunCMD($sCMD) ;Run CMD and Return StdOut Local $iPID = Run(@ComSpec & " /c " & $sCMD, @SystemDir, @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD) Local $sStdOut While 1 $sStdOut &= StdoutRead($iPID) If @error Then ExitLoop WEnd Return $sStdOut EndFunc1 point
-
Create a File Shortcut with advance option "Run ad administrator" checked
Earthshine reacted to Danyfirex for a topic
I found that trick time ago in stack overflow written in another lenguage. I don't remeber the thread. Saludos1 point -
In the MsgBox examples in the Help file, you'll see that the first line is #include <MsgBoxConstants.au3> and this: is a message box constant, defined in that include file. So you need to add that "include this file" directive at the top of your script, so that when your own code is read, the interpreter knows what number to put in. BTW Welcome to the forums. PS: if you get stuck in situations like this, one way to figure it out is to open an example from the Help file that closely resembles the line that generates the error, and then change that step-by-step to mimic your own code more closely, and run it each time until it starts breaking.1 point
-
https://github.com/bard/mozrepl/blob/master/README.md1 point
-
CompileIt - an experimental AutoIt-to-machine code compiler
Earthshine reacted to Deye for a topic
context helper CompileItCmd.au3 Edit: Fixed1 point -
Ok, all good again. The digit check was only implemented for the price Query check process, but not also for ADD a new game process, strangely enough. That wasn't the issue though. Slack array total check was the problem, due to html code missing, because the price value was missing, and in its place was a NOTIFY ME button (not the suspected TBA one). or ...... I also noted some other slack array error checking by moi, so implemented that too, along with the missing digit check. Update upload has been replaced.1 point
-
Sometimes you have to laugh. Only minutes after uploading the update, I added a new game (hasn't been released yet) and it crashed the program. https://www.gog.com/game/battlezone_combat_commander I suspect it was the price (TBA) that did it, so I now need to incorporate a digit check fix ... and I thought I had already ... so it may be something else. I will be a bit of a while doing the fix, as my Laptop needs to boot up first, and the poor old thing is slow with all its checks etc.1 point
-
IonGoG Wishlist has been updated to v0.0_b13, see first post. For now, IonGoG Wishlist is in a BETA condition, so not all fixes or adaptions or new features (unless significantly unique) will be listed or mentioned. (v0.0_b13) This includes all changes made since v0.0_b08. Bugfix for unwanted blank lines in Comments. Bugfix for Price not found or non digits, plus related code improvements. Bugfix at program start for program window being off-screen (including Preview window). Export & Import options added for a User (Settings and Files). Import has two methods for any updating required (complete or only specific changes with prompting for other elements if found). Genre column can now optionally be a Series column (toggled on Settings window at bottom). More accelerator keys added, for features like - Sweet Price, Warning, Add Series, Skip in Query ALL, etc. When ADDING a new game to the list, a Series name can be manually added (based on the Game name by default, but modifiable either then or later). The column sort is handy when you want dissimilar named games in a series to be sorted together. Ideal sorting will often require a trailing number in the field, indicating position in a series (i.e. Quake 1). Slicker loading and clearing of lists has now been implemented for all the features that should require it (when the Slicker Visuals option is enabled). A new option to check for a Series Discount Price (if it exists) has also been added, which will be in place of the usual reported price during a Query. On first use of this version, you will be prompted about using this new feature, which has not had much testing to-date. The option can be turned ON or OFF via the program Settings window. IMPORT & EXPORT NOTES Exporting can be a great way to externally share your bought list with family & friends. Typically by default, a user called 'John' will have a bought list named 'John (b)' created when the 'Relocate all Bought items' (right-click) menu option is used. You set an item as Bought, by using either the CTRL+B accelerator key for selected entry or the right-click menu option. To Export a specific user list, load that list in the program, then use the right-click (USERS -> Export current User & Image data) option to save to a selected folder location, the user's settings files (i.e. John (b).ini and Comments.txt) plus related image files for every game on that list. You then share that folder with your relative or friend who also has the IonGoG Wishlist program installed. That person uses the program's Import feature (USERS -> Import or update a User & Image data) on the list's right-click menu. ***WARNING*** - To prevent overwriting (replacing) or updating the wrong user list (where you have more than one user with the same name), it is important, that you rename the user INI file first (the one you are importing), perhaps using a nickname instead or adding a surname to make it unique (i.e. John Smith (b).ini). ADVICE - Because the Username field is currently not very wide, a nickname would probably be the better option. My KindEbook Wishlist was recently expanded (widened) to incorporate a 'Last' price column, which I may later add to IonGoG Wishlist, at which time I would widen the Username (dropdown) field. REMINDER IonGoG Wishlist is in a mostly finished but still incomplete state. Most options and features are working as they should, but some lesser used ones may give odd or strange results or just none at all. As I discover things (or they are reported) I will fix them. This program is an adaption of my JB Wishlist one, which was an adaption of my KindEbook Wishlist one, which have been regularly updated (January 2015 -> November 2017) ... with updates to all programs being ongoing, it seems, and often updated together in tandem. It is true though, that each program has a unique set of requirements, so not everything is indeed the same or acts in the same way.1 point
-
Outlook MOdules
Earthshine reacted to water for a topic
Maybe this sheds some light onto the subject: http://www.outlookcode.com/article.aspx?id=281 point -
Create a File Shortcut with advance option "Run ad administrator" checked
Earthshine reacted to Danyfirex for a topic
Hello You can do this: Local $sShortcut = "C:\Users\User\Desktop\someshortcut.lnk" _SetShortcutRunAsAdmin($sShortcut);Enable-Set advanced settings Run as administrator true ;~ _SetShortcutRunAsAdmin($sShortcut,False);Disable-Set advanced settings Run as administrator false Func _SetShortcutRunAsAdmin($sShortcutFullPath, $bRunAsAdmin = True) Local $hFile = FileOpen($sShortcutFullPath, 17) FileSetPos($hFile, 21, 0) FileWrite($hFile, $bRunAsAdmin ? 0x20 : 0x00) FileClose($hFile) EndFunc ;==>_SetShortcutRunAsAdmin Saludos1 point -
How to get SysListView32 header text?
Earthshine reacted to soulost for a topic
Thank you very much. I have solved my problem.1 point -
How to get SysListView32 header text?
Earthshine reacted to BrewManNH for a topic
Try something like this: #include <GUIConstantsEx.au3> #include <GuiListView.au3> #include <MsgBoxConstants.au3> Example() Func Example() Local $aInfo, $idListview GUICreate("ListView Get Column", 400, 300) $idListview = GUICtrlCreateListView("col1|col2|col3", 2, 2, 394, 268) _GUICtrlListView_SetExtendedListViewStyle($idListview, BitOR($LVS_EX_FULLROWSELECT, $LVS_EX_CHECKBOXES)) _GUICtrlListView_SetColumnWidth($idListview, 0, 100) GUISetState(@SW_SHOW) GUICtrlCreateListViewItem("index 0|data1|more1", $idListview) GUICtrlCreateListViewItem("index 1|data2|more2", $idListview) GUICtrlCreateListViewItem("index 2|data3|more3", $idListview) GUICtrlCreateListViewItem("index 3|data4|more4", $idListview) GUICtrlCreateListViewItem("index 4|data5|more5", $idListview) ; Change column $aInfo = _GUICtrlListView_GetColumn($idListview, 0) MsgBox($MB_SYSTEMMODAL, "Information", "Column 1 Width: " & $aInfo[4]) _GUICtrlListView_SetColumn($idListview, 0, "New Column 1", 150) $aInfo = _GUICtrlListView_GetColumn($idListview, 0) MsgBox($MB_SYSTEMMODAL, "Information", "Column 1 header text: " & $aInfo[5]) ; <<<<<<<<<<<<<<<<<<<<<< ; Loop until the user exits. Do Until GUIGetMsg() = $GUI_EVENT_CLOSE GUIDelete() EndFunc ;==>Example1 point -
try this script EDIT: SORRY, I LEAVED ONE FUNCTION WITH WRONG NAME. TRY THIS ONE #include <File.au3> ; =============================================================================================================================== ; Variables for the _INetSmtpMailCom ; =============================================================================================================================== Global Enum _ $g__INetSmtpMailCom_ERROR_FileNotFound = 1, _ $g__INetSmtpMailCom_ERROR_Send, _ $g__INetSmtpMailCom_ERROR_ObjectCreation, _ $g__INetSmtpMailCom_ERROR_COUNTER Global Const $g__cdoSendUsingPickup = 1 ; Send message using the local SMTP service pickup directory. Global Const $g__cdoSendUsingPort = 2 ; Send the message using the network (SMTP over the network). Must use this to use Delivery Notification Global Const $g__cdoAnonymous = 0 ; Do not authenticate Global Const $g__cdoBasic = 1 ; basic (clear-text) authentication Global Const $g__cdoNTLM = 2 ; NTLM Global $gs_thoussep = "." Global $gs_decsep = "," Global $sFileOpenDialog = "" ; Delivery Status Notifications Global Const $g__cdoDSNDefault = 0 ; None Global Const $g__cdoDSNNever = 1 ; None Global Const $g__cdoDSNFailure = 2 ; Failure Global Const $g__cdoDSNSuccess = 4 ; Success Global Const $g__cdoDSNDelay = 8 ; Delay _Sendmail() Func _Sendmail() Local $sSmtpServer = "smtp.gmail.com" ; address for the smtp-server to use - REQUIRED Local $sFromName = "user" ; name from who the email was sent Local $sFromAddress = "youremail@gmail.com" ; address from where the mail should come Local $sToAddress = "mailreceiver@gmail.com" ; destination address of the email - REQUIRED Local $sSubject = "testing" ; subject from the email - can be anything you want it to be Local $sBody = "test" ; the messagebody from the mail - can be left blank but then you get a blank mail Local $sAttachFiles = "" ; the file(s) you want to attach seperated with a ; (Semicolon) - leave blank if not needed Local $sCcAddress = "" ; address for cc - leave blank if not needed Local $sBccAddress = "" ; address for bcc - leave blank if not needed Local $sImportance = "Normal" ; Send message priority: "High", "Normal", "Low" Local $sUsername = "youremail@gmail.com" ; username for the account used from where the mail gets sent - REQUIRED Local $sPassword = "xxxxxxx" ; password for the account used from where the mail gets sent - REQUIRED Local $iIPPort = 465 ; GMAIL port used for sending the mail Local $bSSL = True ; GMAIL enables/disables secure socket layer sending - set to True if using httpS Local $bIsHTMLBody = False Local $iDSNOptions = $g__cdoDSNDefault Local $rc = _INetSmtpMailCom($sSmtpServer, $sFromName, $sFromAddress, $sToAddress, $sSubject, $sBody, $sAttachFiles, $sCcAddress, $sBccAddress, $sImportance, $sUsername, $sPassword, $iIPPort, $bSSL, $bIsHTMLBody, $iDSNOptions) If @error Then MsgBox(0, "_INetSmtpMailCom(): Error sending message", _ "Error code: " & @error & @CRLF & @CRLF & _ "Error Hex Number: " & _INetSmtpMailCom_ErrHexNumber() & @CRLF & @CRLF & _ "Description: " & _INetSmtpMailCom_ErrDescription() & @CRLF & @CRLF & _ "Description (rc): " & $rc & @CRLF & @CRLF & _ "ScriptLine: " & _INetSmtpMailCom_ErrScriptLine() _ ) ConsoleWrite("### COM Error ! Number: " & _INetSmtpMailCom_ErrHexNumber() & " ScriptLine: " & _INetSmtpMailCom_ErrScriptLine() & " Description:" & _INetSmtpMailCom_ErrDescription() & @LF) Else Dim $iMsgBoxAnswer $iMsgBoxAnswer = MsgBox(262208, "SUCCESS", ":-)", 5) EndIf EndFunc ;==>_Enviarmail #Region UDF Functions ; The UDF ; #FUNCTION# ==================================================================================================================== ; Name ..........: _INetSmtpMailCom ; Description ...: ; Syntax ........: _INetSmtpMailCom($s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress[, $s_Subject = ""[, $as_Body = ""[, ; $s_AttachFiles = ""[, $s_CcAddress = ""[, $s_BccAddress = ""[, $s_Importance = "Normal"[, $s_Username = ""[, ; $s_Password = ""[, $IPPort = 25[, $bSSL = False[, $bIsHTMLBody = False[, $iDSNOptions = $g__cdoDSNDefault]]]]]]]]]]]]) ; Parameters ....: $s_SmtpServer - A string value. ; $s_FromName - A string value. ; $s_FromAddress - A string value. ; $s_ToAddress - A string value. ; $s_Subject - [optional] A string value. Default is "". ; $s_Body - [optional] A string value. Default is "". ; $s_AttachFiles - [optional] A string value. Default is "". ; $s_CcAddress - [optional] A string value. Default is "". ; $s_BccAddress - [optional] A string value. Default is "". ; $s_Importance - [optional] A string value. Default is "Normal". ; $s_Username - [optional] A string value. Default is "". ; $s_Password - [optional] A string value. Default is "". ; $IPPort - [optional] An integer value. Default is 25. ; $bSSL - [optional] A binary value. Default is False. ; $bIsHTMLBody - [optional] A binary value. Default is False. ; $iDSNOptions - [optional] An integer value. Default is $g__cdoDSNDefault. ; Return values .: None ; Author ........: Jos ; Modified ......: mLipok ; Remarks .......: ; Related .......: http://www.autoitscript.com/forum/topic/23860-smtp-mailer-that-supports-html-and-attachments/ ; Link ..........: http://www.autoitscript.com/forum/topic/167292-smtp-mailer-udf/ ; Example .......: Yes ; =============================================================================================================================== Func _INetSmtpMailCom($s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $s_Subject = "", $s_Body = "", $s_AttachFiles = "", $s_CcAddress = "", $s_BccAddress = "", $s_Importance = "Normal", $s_Username = "", $s_Password = "", $IPPort = 25, $bSSL = False, $bIsHTMLBody = False, $iDSNOptions = $g__cdoDSNDefault) ; init Error Handler _INetSmtpMailCom_ErrObjInit() Local $objEmail = ObjCreate("CDO.Message") If Not IsObj($objEmail) Then Return SetError($g__INetSmtpMailCom_ERROR_ObjectCreation, Dec(_INetSmtpMailCom_ErrHexNumber()), _INetSmtpMailCom_ErrDescription()) ; Clear previous Err information _INetSmtpMailCom_ErrHexNumber(0) _INetSmtpMailCom_ErrDescription('') _INetSmtpMailCom_ErrScriptLine('') $objEmail.From = '"' & $s_FromName & '" <' & $s_FromAddress & '>' $objEmail.To = $s_ToAddress If $s_CcAddress <> "" Then $objEmail.Cc = $s_CcAddress If $s_BccAddress <> "" Then $objEmail.Bcc = $s_BccAddress $objEmail.Subject = $s_Subject ; Select whether or not the content is sent as plain text or HTM If $bIsHTMLBody Then $objEmail.Textbody = $s_Body & @CRLF Else $objEmail.HTMLBody = $s_Body EndIf ; Add Attachments If $s_AttachFiles <> "" Then Local $S_Files2Attach = StringSplit($s_AttachFiles, ";") For $x = 1 To $S_Files2Attach[0] $S_Files2Attach[$x] = _PathFull($S_Files2Attach[$x]) If FileExists($S_Files2Attach[$x]) Then ConsoleWrite('+> File attachment added: ' & $S_Files2Attach[$x] & @LF) $objEmail.AddAttachment($S_Files2Attach[$x]) Else ConsoleWrite('!> File not found to attach: ' & $S_Files2Attach[$x] & @LF) Return SetError($g__INetSmtpMailCom_ERROR_FileNotFound, 0, 0) EndIf Next EndIf ; Set Email Configuration $objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = $g__cdoSendUsingPort $objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = $s_SmtpServer If Number($IPPort) = 0 Then $IPPort = 25 $objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = $IPPort ;Authenticated SMTP If $s_Username <> "" Then $objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = $g__cdoBasic $objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusername") = $s_Username $objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = $s_Password EndIf $objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = $bSSL ;Update Configuration Settings $objEmail.Configuration.Fields.Update ; Set Email Importance Switch $s_Importance Case "High" $objEmail.Fields.Item("urn:schemas:mailheader:Importance") = "High" Case "Normal" $objEmail.Fields.Item("urn:schemas:mailheader:Importance") = "Normal" Case "Low" $objEmail.Fields.Item("urn:schemas:mailheader:Importance") = "Low" EndSwitch ; Set DSN options If $iDSNOptions <> $g__cdoDSNDefault And $iDSNOptions <> $g__cdoDSNNever Then $objEmail.DSNOptions = $iDSNOptions $objEmail.Fields.Item("urn:schemas:mailheader:disposition-notification-to") = $s_FromAddress ;~ $objEmail.Fields.Item("urn:schemas:mailheader:return-receipt-to") = $s_FromAddress EndIf ; Update Importance and Options fields $objEmail.Fields.Update ; Sent the Message $objEmail.Send If @error Then _INetSmtpMailCom_ErrObjCleanUp() Return SetError($g__INetSmtpMailCom_ERROR_Send, Dec(_INetSmtpMailCom_ErrHexNumber()), _INetSmtpMailCom_ErrDescription()) EndIf ; CleanUp $objEmail = "" _INetSmtpMailCom_ErrObjCleanUp() EndFunc ;==>_INetSmtpMailCom ; ; Com Error Handler Func _INetSmtpMailCom_ErrObjInit($bParam = Default) Local Static $oINetSmtpMailCom_Error = Default If $bParam == 'CleanUp' And $oINetSmtpMailCom_Error <> Default Then $oINetSmtpMailCom_Error = '' Return $oINetSmtpMailCom_Error EndIf If $oINetSmtpMailCom_Error = Default Then $oINetSmtpMailCom_Error = ObjEvent("AutoIt.Error", "_INetSmtpMailCom_ErrFunc") EndIf Return $oINetSmtpMailCom_Error EndFunc ;==>_INetSmtpMailCom_ErrObjInit Func _INetSmtpMailCom_ErrObjCleanUp() _INetSmtpMailCom_ErrObjInit('CleanUp') EndFunc ;==>_INetSmtpMailCom_ErrObjCleanUp Func _INetSmtpMailCom_ErrHexNumber($vData = Default) Local Static $vReturn = 0 If $vData <> Default Then $vReturn = $vData Return $vReturn EndFunc ;==>_INetSmtpMailCom_ErrHexNumber Func _INetSmtpMailCom_ErrDescription($sData = Default) Local Static $sReturn = '' If $sData <> Default Then $sReturn = $sData Return $sReturn EndFunc ;==>_INetSmtpMailCom_ErrDescription Func _INetSmtpMailCom_ErrScriptLine($iData = Default) Local Static $iReturn = '' If $iData <> Default Then $iReturn = $iData Return $iReturn EndFunc ;==>_INetSmtpMailCom_ErrScriptLine Func _INetSmtpMailCom_ErrFunc() _INetSmtpMailCom_ErrObjInit() _INetSmtpMailCom_ErrHexNumber(Hex(_INetSmtpMailCom_ErrObjInit().number, 8)) _INetSmtpMailCom_ErrDescription(StringStripWS(_INetSmtpMailCom_ErrObjInit().description, 3)) _INetSmtpMailCom_ErrScriptLine(_INetSmtpMailCom_ErrObjInit().ScriptLine) SetError(1) ; something to check for when this function returns Return EndFunc ;==>_INetSmtpMailCom_ErrFunc #EndRegion UDF Functions Change "youremail@gmail.com" for your email account The password for your password andf the receiver. Anyway you have to set your gmail account to let the less safe apps to send mails with it1 point
-
Regex toolkit
Earthshine reacted to UEZ for a topic
Seems to be a very handy RegEx tool. My three suggestions: import text from clipboard resizeable GUI for larger edit controls show/hide functionality of the right help panel to make the GUI more compact Drag'n drop doesn't load the text file.1 point -
Regex toolkit
Earthshine reacted to BrewManNH for a topic
It's not needed because it actually makes your script much slower with a large amount of data. What this function does is takes the memory used by the program and dumps it to disk in the page file. Reading data from a file is many times slower than reading the same data from memory. Also, having more free memory means that all the money you spent on that 16Gbs of memory was a waste, because you're not actually using it. This was a useless holdover from the XP days, and wasn't even needed back then either.1 point