snowman533 Posted July 11, 2009 Share Posted July 11, 2009 hey guys im working off one of the exampels in the help file, i am trying to get it to list all processes to a txt file here is the code: #cs ---------------------------------------------------------------------------- AutoIt Version: 3.3.0.0 Author: myName Script Function: Template AutoIt script. #ce ---------------------------------------------------------------------------- ; Script Start - Add your code below here ; List all processes #Include <File.au3> $rfile = "processes.txt" $list = ProcessList() for $i = 1 to $list[0][0] ;msgbox(0, $list[$i][0], $list[$i][1]) _FileWriteFromArray($rfile, $list[$i]) next ; List just notepad.exe processes $list = ProcessList("notepad.exe") for $i = 1 to $list[0][0] msgbox(0, $list[$i][0], $list[$i][1]) next and attached is the error im getting, can anyone help with this?error.txt Intermediate AutoIt/Autohotkey User Link to comment Share on other sites More sharing options...
EdwardTFN Posted July 11, 2009 Share Posted July 11, 2009 (edited) Dear Snowman, try the following code: #cs ---------------------------------------------------------------------------- AutoIt Version: 3.3.0.0 Author: myName Script Function: Template AutoIt script. #ce ---------------------------------------------------------------------------- ; Script Start - Add your code below here ; List all processes ;#Include <File.au3> $rfile = "processes.txt" $list = ProcessList() for $i = 1 to $list[0][0] ;msgbox(0, $list[$i][0], $i & " = " & $list[$i][1]) FileWriteLine($rfile, $list[$i][0] & @TAB & $list[$i][1]) next ; List just notepad.exe processes $list = ProcessList("notepad.exe") for $i = 1 to $list[0][0] msgbox(0, $list[$i][0], $list[$i][1]) next The problem was the way you were calling the array... Note that you don't need to invlude File.Au3 in this example, then you executable will be smaller... Edited July 11, 2009 by EdwardTFN 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