bartekd Posted May 1, 2009 Share Posted May 1, 2009 OK, so I am creating a psexec gui from scratch (I know there are a couple on this forum, but i want to create my own). as you probably know, you can make the script reference a computers.txt file and run it against those computers. This is what I wanted to do instead Create a gui control edit so I can put the list of computers in this edit and it will run one at a time. (I can use the runwait command and put the full command line for PSEXEC for each computer name) I already have created teh GUI that has a Input box that I use for one computer. But instead I would prefer to use a Edit and run it for multiple computers on just one depending on how many lines are in the edit. I have looked at the help file and was thinking of creating an array that is created from the data in the edit. Then I would loop from this array and for each computer. If any one has a way to do this, or any suggestions, please let me know. thanks in advance Link to comment Share on other sites More sharing options...
CodyBarrett Posted May 1, 2009 Share Posted May 1, 2009 _GUICtrlEdit_GetLineCount [size="1"][font="Tahoma"][COMPLETED]-----[FAILED]-----[ONGOING]VolumeControl|Binary Converter|CPU Usage| Mouse Wrap |WinHide|Word Scrammbler|LOCKER|SCREEN FREEZE|Decisions Decisions|Version UDF|Recast Desktop Mask|TCP Multiclient EXAMPLE|BTCP|LANCR|UDP serverless|AIOCR|OECR|Recast Messenger|AU3C|Tik-Tak-Toe|Snakes & Ladders|BattleShips|TRON|SNAKE_____________________[u]I love the Helpfile it is my best friend.[/u][/font][/size] Link to comment Share on other sites More sharing options...
bartekd Posted May 1, 2009 Author Share Posted May 1, 2009 thanks, but now how do i loop each line of the edit? Link to comment Share on other sites More sharing options...
CodyBarrett Posted May 1, 2009 Share Posted May 1, 2009 this is just for the edit control.. im not sure what you want with the other copmuters... $i1=_GUICtrlEdit_GetLineCount ($EDIT) For $i2=1 to $i1[0] $i1[$i2] = 'example' ;sets EACH line to 'example' ;or do whatever you need to do in the loop guictrlsetdata ($EDIT, $i1[$i2]) next [size="1"][font="Tahoma"][COMPLETED]-----[FAILED]-----[ONGOING]VolumeControl|Binary Converter|CPU Usage| Mouse Wrap |WinHide|Word Scrammbler|LOCKER|SCREEN FREEZE|Decisions Decisions|Version UDF|Recast Desktop Mask|TCP Multiclient EXAMPLE|BTCP|LANCR|UDP serverless|AIOCR|OECR|Recast Messenger|AU3C|Tik-Tak-Toe|Snakes & Ladders|BattleShips|TRON|SNAKE_____________________[u]I love the Helpfile it is my best friend.[/u][/font][/size] Link to comment Share on other sites More sharing options...
bartekd Posted May 1, 2009 Author Share Posted May 1, 2009 gives me the following error => Subscript used with non-Array variable.: For $i2=1 to $i1[0] For $i2=1 to $i1^ ERROR Link to comment Share on other sites More sharing options...
bartekd Posted May 1, 2009 Author Share Posted May 1, 2009 In the loop, what I want to do is this. What is written on the line, I want to make a variable = that line. For example if in the edit this is what is there. WK001 WK002 WK003 WK004 First it will do the first line. So $Computername = 'WK001' after that, it will go to the next line, where $Computername = 'WK002' ETC... See what I mean? Link to comment Share on other sites More sharing options...
CodyBarrett Posted May 1, 2009 Share Posted May 1, 2009 (edited) #Include <GuiEdit.au3> #Include <String.au3> $i1 = Stringsplit ($EDIT, @CRLF) ;this splits up the edit into EACH line.. and all you have to do is $i1[1] = 'something' (this is the FIRST line...) For $i2=1 to $i1[0] msgbox (0, '', _GUICtrlEdit_GetLine($EDIT, $i1[$i2])) nextoÝ÷ ÚÚò¶9®¶sb4æ6ÇVFRfÇCµ7G&æræS2fwC°¢b33c¶Ò7G&æw7ÆBb33c´TDBÂ5$Äb·F27ÆG2WFRVFBçFòT4ÆæRââæBÆÂ÷RfRFòFò2b33c¶³ÒÒb33·6öÖWFærb33²F22FRd%5BÆæRâââ¤f÷"b33c¶#ÓFòb33c¶³Ò¢×6v&÷Âb33²b33²Âb33c¶²b33c¶%Ò¦æW@ Edited May 1, 2009 by CodyBarrett [size="1"][font="Tahoma"][COMPLETED]-----[FAILED]-----[ONGOING]VolumeControl|Binary Converter|CPU Usage| Mouse Wrap |WinHide|Word Scrammbler|LOCKER|SCREEN FREEZE|Decisions Decisions|Version UDF|Recast Desktop Mask|TCP Multiclient EXAMPLE|BTCP|LANCR|UDP serverless|AIOCR|OECR|Recast Messenger|AU3C|Tik-Tak-Toe|Snakes & Ladders|BattleShips|TRON|SNAKE_____________________[u]I love the Helpfile it is my best friend.[/u][/font][/size] Link to comment Share on other sites More sharing options...
bartekd Posted May 1, 2009 Author Share Posted May 1, 2009 Nice, that almost works. There are 2 things, I had to put GUICtrlRead($EDIT1) otherwise it didn't return any data. also, for some reason even though there are more then one line in the edit, it just returns the first line, over and over again. Link to comment Share on other sites More sharing options...
CodyBarrett Posted May 1, 2009 Share Posted May 1, 2009 #Include <String.au3> #Include <array.au3> $EDIT=guictrlread ($iedit) $i1 = Stringsplit ($EDIT, @CRLF) _arraydisplay ($i1) For $i2=1 to $i1[0] msgbox (0, '', $i1[$i2])) next try this ^.it might be the @CRLF ... mayeb replace it with @CR or @LF... [size="1"][font="Tahoma"][COMPLETED]-----[FAILED]-----[ONGOING]VolumeControl|Binary Converter|CPU Usage| Mouse Wrap |WinHide|Word Scrammbler|LOCKER|SCREEN FREEZE|Decisions Decisions|Version UDF|Recast Desktop Mask|TCP Multiclient EXAMPLE|BTCP|LANCR|UDP serverless|AIOCR|OECR|Recast Messenger|AU3C|Tik-Tak-Toe|Snakes & Ladders|BattleShips|TRON|SNAKE_____________________[u]I love the Helpfile it is my best friend.[/u][/font][/size] Link to comment Share on other sites More sharing options...
bartekd Posted May 1, 2009 Author Share Posted May 1, 2009 Almost perfect. the only issue now is there is a extra enter between each space. For exmple my edit is wk001 wk002 wk003 and the array shows wk001 wk002 wk003 and the msg box would be, 'wk001' '' 'wk002' '' 'wk003' '' etc, you know why that would be? Link to comment Share on other sites More sharing options...
bartekd Posted May 1, 2009 Author Share Posted May 1, 2009 actually, you were right, instead of using @crlf, use either @cr or @lf. Thanks allot for your help, its much appreciated. Link to comment Share on other sites More sharing options...
CodyBarrett Posted May 1, 2009 Share Posted May 1, 2009 np [size="1"][font="Tahoma"][COMPLETED]-----[FAILED]-----[ONGOING]VolumeControl|Binary Converter|CPU Usage| Mouse Wrap |WinHide|Word Scrammbler|LOCKER|SCREEN FREEZE|Decisions Decisions|Version UDF|Recast Desktop Mask|TCP Multiclient EXAMPLE|BTCP|LANCR|UDP serverless|AIOCR|OECR|Recast Messenger|AU3C|Tik-Tak-Toe|Snakes & Ladders|BattleShips|TRON|SNAKE_____________________[u]I love the Helpfile it is my best friend.[/u][/font][/size] Link to comment Share on other sites More sharing options...
bartekd Posted May 1, 2009 Author Share Posted May 1, 2009 I have one small issue. The script isn't working if I am doing it for multiple computers that I am pulling from the log file. So instead of a msg box, i outputed the results of the computer name to a txt file. What I see is a small little square next to each of the computer names (each line in the edit) except for the last line. What I suspect is that each enter is putting something after the computer name. Any ideas on how to remove this? Link to comment Share on other sites More sharing options...
bartekd Posted May 1, 2009 Author Share Posted May 1, 2009 Nevermind, I figured it out. For each line, I just replaced @crlf, @cr and @lf with "". That seems to work. $StationNow = $i1[$i2] $StationNow = StringReplace($StationNow, @CRLF,"") $StationNow = StringReplace($StationNow, @CR,"") $StationNow = StringReplace($StationNow, @LF,"") 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