Pook Posted July 15, 2008 Share Posted July 15, 2008 Okay... I've been reading/testiong some post but I'm just not that good yet. I trying to convert some of my Vbs scripts to Autoit & I can't find a solid loop command(set-up) For example this is what I like to use in VBS... Set oFSO = CreateObject("Scripting.FileSystemObject") Set WSHShell = wscript.createObject("wscript.shell") Set oTextStream = oFSO.OpenTextFile("wks.txt") RemotePC = Split(oTextStream.ReadAll, vbNewLine) oTextStream.Close For Each strComputer In RemotePC =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= '>>>> code here <<<<< =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Next This would pull the computer name from the TXT file and run the code on each of them. I can't figure out how to accomplish this in Autoit. Any ideas Please... Link to comment Share on other sites More sharing options...
PsaltyDS Posted July 15, 2008 Share Posted July 15, 2008 (edited) Okay... I've been reading/testiong some post but I'm just not that good yet. I trying to convert some of my Vbs scripts to Autoit & I can't find a solid loop command(set-up) For example this is what I like to use in VBS... Set oFSO = CreateObject("Scripting.FileSystemObject") Set WSHShell = wscript.createObject("wscript.shell") Set oTextStream = oFSO.OpenTextFile("wks.txt") RemotePC = Split(oTextStream.ReadAll, vbNewLine) oTextStream.Close For Each strComputer In RemotePC =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= '>>>> code here <<<<< =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Next This would pull the computer name from the TXT file and run the code on each of them. I can't figure out how to accomplish this in Autoit. Any ideas Please... Use _FileReadToArray(): #include <File.au3> Global $sFile = "wks.txt", $avFile _FileReadToArray($sFile, $avFile) For $n = 1 To $avFile[0] _YourFunctionHere($avFile[$n]) Next Func _YourFunctionHere($sInput) ConsoleWrite("Debug: $sInput = " & $sInput & @LF) EndFunc It's in the help file. muttley Edit: Or... Global $sFile = "wks.txt", $sLine While 1 $sLine = FileReadLine($sFile) If @error Then ExitLoop _YourFunctionHere($sLine) Next Func _YourFunctionHere($sInput) ConsoleWrite("Debug: $sInput = " & $sInput & @LF) EndFunc Edited July 15, 2008 by PsaltyDS Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
Pook Posted July 16, 2008 Author Share Posted July 16, 2008 Thanks for your Help!!! 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