gracea Posted September 9, 2014 Share Posted September 9, 2014 . Wheew! I give up again. Twerked around google and this forum. Found somewhat similar but - again too many codes. Found from autoit samples - less code. Then got headaches again. This is where the code originates: '?do=embed' frameborder='0' data-embedContent>> Do it guys..Please. Got to hibernate now. #include <array.au3> Local $ProcessListss[3] ; [N] = TOTAL LIST COUNT $ProcessListss[0] = "calc.exe" ; CALCULATOR $ProcessListss[1] = "notepad.exe" ; NOTEPAD $ProcessListss[2] = "mspaint.exe" ; MSPAINT Local $ListToMsgBoxx Local $NumberListss For $i = 0 $NumberListss = $NumberListss[$i] +1 Next For $ProcessNamee IN $ProcessListss If ProcessExists($ProcessNamee) Then ;MsgBox(4096,"",$ProcessNamee) $ListToMsgBoxx &= $NumberListss & ". " & $ProcessNamee & @CRLF EndIf Sleep (100) Next MsgBox(4096,"",$ListToMsgBoxx) . Thanks. :P " Loved It ! " :wub: Link to comment Share on other sites More sharing options...
guinness Posted September 9, 2014 Share Posted September 9, 2014 (edited) So read the help file and understand the fundamental basics. Your code is a mess as it's using variables which aren't arrays and vice versa. Edited September 10, 2014 by guinness UDF List: _AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples... Updated: 22/04/2018 Link to comment Share on other sites More sharing options...
kylomas Posted September 9, 2014 Share Posted September 9, 2014 Do it guys..Please. I see I was mistaken giving you the solution to your last problem. Time to start reading the Help file. You might start with how a "for...to" loop is constructed. Forum Rules Procedure for posting code "I like pigs. Dogs look up to us. Cats look down on us. Pigs treat us as equals." - Sir Winston Churchill Link to comment Share on other sites More sharing options...
Guest Posted September 9, 2014 Share Posted September 9, 2014 hi lady, Did you mean to write this? #include <array.au3> Local $ProcessListss[4] $ProcessListss[0] = 3 ; [N] = TOTAL LIST COUNT $ProcessListss[1] = "calc.exe" ; CALCULATOR $ProcessListss[2] = "notepad.exe" ; NOTEPAD $ProcessListss[3] = "mspaint.exe" ; MSPAINT Local $ListToMsgBoxx Local $NumberListss = 0 ;For $i = 0 ;$NumberListss = $NumberListss[$i] +1 ;Next For $a = 1 to $ProcessListss[0] If ProcessExists($ProcessListss[$a]) Then $ListToMsgBoxx &= $ProcessListss[$a] $NumberListss += 1 If $a < $ProcessListss[0] Then $ListToMsgBoxx &= @CRLF EndIf Next If $NumberListss > 0 Then $ListToMsgBoxx = $NumberListss&" Processes running:"&@CRLF&$ListToMsgBoxx Else $ListToMsgBoxx = "No Processes running" EndIf MsgBox(4096,"",$ListToMsgBoxx) Link to comment Share on other sites More sharing options...
guinness Posted September 10, 2014 Share Posted September 10, 2014 I see I was mistaken giving you the solution to your last problem. Time to start reading the Help file. You might start with how a "for...to" loop is constructed.You weren't to know. I just had a hunch that handing out free would code would be a bad idea in this instance.gil900,That really doesn't help the user if they have zero clue of what is happening in AutoIt. 232showtime 1 UDF List: _AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples... Updated: 22/04/2018 Link to comment Share on other sites More sharing options...
Guest Posted September 10, 2014 Share Posted September 10, 2014 (edited) You weren't to know. I just had a hunch that handing out free would code would be a bad idea in this instance. gil900, That really doesn't help the user if they have zero clue of what is happening in AutoIt. I thought that if she edited the code so she tried to figure out what's going on and what needs to happen ..So if I give corrected code(And that code is what she might intend to write) in that case, maybe she will understand how it works because maybe she was going to write such logic anyway Edited September 10, 2014 by Guest Link to comment Share on other sites More sharing options...
gracea Posted September 10, 2014 Author Share Posted September 10, 2014 gil900.. still no luck.. ill try again.. kylomas.. sorry for the frustration.. i frequently use it - soon my neighbors will - it wont be wasted. guinness.. please dont hold them how to help - its not a bad thing. :P " Loved It ! " :wub: Link to comment Share on other sites More sharing options...
czardas Posted September 10, 2014 Share Posted September 10, 2014 The code from gil900 seemed to work fine on my computer. What do you mean exactly? Do you want the code to be more simple? Write in your own language if you find it too difficult to explain what you want in English. operator64 ArrayWorkshop Link to comment Share on other sites More sharing options...
gracea Posted September 10, 2014 Author Share Posted September 10, 2014 czardas.. from script example from post #1 try not to change much of the code. if calculator, notepad and mspaint are opened. the result of msgbox should be 1. calc.exe 2. notepad.exe 3. mspaint.exe if notepad and mspaint only opened msgbox result should be 1. notepad.exe 2. mspaint.exe :P " Loved It ! " :wub: Link to comment Share on other sites More sharing options...
Guest Posted September 10, 2014 Share Posted September 10, 2014 gil900.. still no luck.. ill try again.. kylomas.. sorry for the frustration.. i frequently use it - soon my neighbors will - it wont be wasted. guinness.. please dont hold them how to help - its not a bad thing. try this: expandcollapse popup#include <array.au3> MsgBox(0,"Step 1 [Line 4 in the code]","I create a table of all the processes that you want to check") Local $ProcessListss[4] $ProcessListss[0] = 3 ; [N] = TOTAL LIST COUNT $ProcessListss[1] = "calc.exe" ; CALCULATOR $ProcessListss[2] = "notepad.exe" ; NOTEPAD $ProcessListss[3] = "mspaint.exe" ; MSPAINT _ArrayDisplay($ProcessListss,"The table is [Line 10 in the code]") MsgBox(0,"[Line 11 in the code]","$ProcessListss[0] = how many processes in that table.") MsgBox(0,"Step 2.1 [Line 13 in the code]","I create $ListToMsgBoxx that is the text in the final MsgBox") Local $ListToMsgBoxx MsgBox(0,"Step 2.2 [Line 15 in the code]","I create $NumberListss Which will be used to count the running processes in the table above") Local $NumberListss = 0 ;For $i = 0 ;$NumberListss = $NumberListss[$i] +1 ;Next MsgBox(0,"Step 3 - Starting loop [Line 23 in the code]","Now I starting a loop from 1($a = 1) to 3($ProcessListss[0])") For $a = 1 to $ProcessListss[0] MsgBox(48,"[Line 25 in the code]","Loop round "&$a&"($a):") MsgBox(0,"[Line 26 in the code]","I check if the processes "&$ProcessListss[$a]&" (raw number "&$a&" ($a) in the tabel and round number "&$a&" ($a) in the loop) is running") If ProcessExists($ProcessListss[$a]) Then MsgBox(64,"[Line 28 in the code]","the processes "&$ProcessListss[$a]&" ($ProcessListss[$a]) is running!"&@CRLF&"So now:") $ListToMsgBoxx &= $ProcessListss[$a]&@CRLF MsgBox(0,"[Line 29 in the code]",'By "$ListToMsgBoxx &= $ProcessListss[$a]" I adding to the string $ListToMsgBoxx a new string that is the running processes ($ProcessListss[$a])'&@CRLF& _ "The result is:"&@CRLF&$ListToMsgBoxx) $NumberListss += 1 MsgBox(0,"[Line 33 in the code]",'By "$NumberListss += 1" i Increases the nummber of the running processes by 1'&@CRLF& _ "Number of processes that in the table and are also running."&@CRLF&"$NumberListss is now = "&$NumberListss) EndIf Next MsgBox(0,"Step 4 - Building the text for the OutPut message [Line 38 in the code]",'"If $NumberListss > 0 Then" = If more then 0 process are running') If $NumberListss > 0 Then $ListToMsgBoxx = $NumberListss&" Processes running:"&@CRLF&$ListToMsgBoxx MsgBox(0,"[Line 39 in the code]","Because there are some processes that run i did the following:"&@CRLF& _ "I added the number ($NumberListss) that i built before during the loop in step 3 to the stirng($ListToMsgBoxx)") Else $ListToMsgBoxx = "No Processes running" MsgBox(0,"[Line 45 in the code]","Because no processes running i did the following:"&@CRLF& _ 'I change the output string($ListToMsgBoxx) to: "No Processes running"') EndIf MsgBox(4096,"",$ListToMsgBoxx) Link to comment Share on other sites More sharing options...
czardas Posted September 10, 2014 Share Posted September 10, 2014 (edited) That's easy. Comments explaining each step are in green. I decided to change the variable names - to hopefully make the code easier to understand. ; Local $aProcessList[4] ; Declare an array with four elements. ; Assign values to the elements of the array. $aProcessList[0] = 3 ; [N] = TOTAL LIST COUNT $aProcessList[1] = "calc.exe" ; CALCULATOR $aProcessList[2] = "notepad.exe" ; NOTEPAD $aProcessList[3] = "mspaint.exe" ; MSPAINT Local $sMessage ; This will be the information displayed in the message box. Local $iItemsFound = 0 For $a = 1 to $aProcessList[0] ; Loop through the array If ProcessExists($aProcessList[$a]) Then ; Test to see if the process is running. $iItemsFound += 1 ; The number of processes found so far. $sMessage &= $iItemsFound & ". " & $aProcessList[$a] & @CRLF ; Add each new line to the message EndIf Next If $iItemsFound = 0 Then $sMessage = "No Processes running" MsgBox(4096,"",$sMessage) ; Edit Modified - I forgot to include the dot after each number. Edited September 10, 2014 by czardas operator64 ArrayWorkshop Link to comment Share on other sites More sharing options...
Solution gracea Posted September 10, 2014 Author Solution Share Posted September 10, 2014 gil900.. sorry for misunderstanding its not like that. Thanks for your effort. czardas.. It does what i wanted. quite confusing for this ($aProcessList[$a]).. but i see it clearly .. i could easily understood it. Then i see the solution through your sample to my sample above which provided by kylomas . I prefer this one because its too simple. [N] is my personal reference when i add more elements. #include <array.au3> Local $ProcessListss[3] ; [N] = TOTAL LIST COUNT $ProcessListss[0] = "calc.exe" ; CALCULATOR $ProcessListss[1] = "notepad.exe" ; NOTEPAD $ProcessListss[2] = "mspaint.exe" ; MSPAINT Local $ListToMsgBoxx Local $NumberListss For $ProcessNamee IN $ProcessListss If ProcessExists($ProcessNamee) Then $NumberListss += 1 $ListToMsgBoxx &= $NumberListss & ". " & $ProcessNamee & @CRLF EndIf Sleep (100) Next MsgBox(4096,"",$ListToMsgBoxx) . Thanks czardas for sample. :P " Loved It ! " :wub: Link to comment Share on other sites More sharing options...
czardas Posted September 10, 2014 Share Posted September 10, 2014 (edited) Good, I'm happy to see you are getting there - making modifications yourself. What people were saying about reading the help file and trying the examples is well worth the effort. Try to stay on the good side of the fence. Many people have helped me here a lot over the years. Edited September 10, 2014 by czardas operator64 ArrayWorkshop Link to comment Share on other sites More sharing options...
gracea Posted September 11, 2014 Author Share Posted September 11, 2014 Good, I'm happy to see you are getting there - making modifications yourself. What people were saying about reading the help file and trying the examples is well worth the effort. Try to stay on the good side of the fence. Many people have helped me here a lot over the years. :P " Loved It ! " :wub: Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now