Hok Posted November 25, 2008 Posted November 25, 2008 Alright so I am attempting to make an application that can read IPs from a TextFile and then copy them to the clipboard in a certain format. So lets say I had a textfile that only had this on it. 1.1.1:80 123.132.123.123:3102 Or whatever. In the end, I want this on the clipboard. HTTP\:\:\:1.1.1.1\:80;HTTP\:\:\:123.132.123.123\:3102; I made an application that checked if the IPs were online, and then created a textfile and showed if they were either offline or online. The difference that I do not know is when I use the FileGetLine() function, how to seperate the IP from the port... (The IP is the number on the left side of the colon, the Port is on the right side of the colon.) Here is my online script thing... (Oh and the one problem is I don't know how to do linebreaks). Here it is. #include<file.au3> $file = InputBox("File Name", "Please input the file name that has the list of IPs. (Make note, it has to be in the same directory as the script is.)") $File1=FileReadLine($file, 1) $File2=FileReadLine($file, 2) $File3=FileReadLine($file, 3) $File4=FileReadLine($file, 4) $File5=FileReadLine($file, 5) $File6=FileReadLine($file, 6) $File7=FileReadLine($file, 7) FileClose($file) $Online1=Ping($File1) $Online2=Ping($File2) $Online3=Ping($File3) $Online4=Ping($File4) $Online5=Ping($File5) $Online6=Ping($File6) $Online7=Ping($File7) If $Online1>0 Then $Status1 = "Online!" Else $Status1 = "Offline!" EndIf If $Online2>0 Then $Status2 = "Online!" Else $Status2 = "Offline!" EndIf If $Online3>0 Then $Status3 = "Online!" Else $Status3 = "Offline!" EndIf If $Online4>0 Then $Status4 = "Online!" Else $Status4 = "Offline!" EndIf If $Online5>0 Then $Status5 = "Online!" Else $Status5 = "Offline!" EndIf If $Online6>0 Then $Status6 = "Online!" Else $Status7 = "Offline!" EndIf If $Online7>0 Then $Status7 = "Online!" Else $Status1 = "Offline!" EndIf _FileCreate("IP Status.txt") FileOpen("IP Status.txt", 2) FileWrite("IP Status.txt", "Current IP Status" &@TAB &$File1 &" is currently " &$Status1 &" " &$File2 &" is currently " &$Status2 &@TAB &$File3 &" is currently " &$Status3 &@TAB &$File4 &" is currently " &$Status4 &@TAB &$File5 &" is currently " &$Status5 &@TAB &$File6 &" is currently " &$Status6 &@TAB &$File7 &" is currently " &$Status7)
TehWhale Posted November 25, 2008 Posted November 25, 2008 (edited) $IpPort = StringSplit($Line, ":") $IpPort[1] = "IP" $IpPort[2] = "Port" Also, to do a line break, you use @CRLF. So basically, like this: $Line1 = "line1" $Line2 = "line2" $Lines = $Lines1 & @CRLF & $Line2 I think those answer your questions. To get the: "HTTP\:\:\:1.1.1.1\:80;HTTP\:\:\:123.132.123.123\:3102;" Just combine the stringsplit I gave you, with other strings. Edited November 25, 2008 by TehWhale
TehWhale Posted November 25, 2008 Posted November 25, 2008 Thanks so much If you need help, or more explaination, just reply back.
Hok Posted November 25, 2008 Author Posted November 25, 2008 If you need help, or more explaination, just reply back. Alright, I think I do have one issue, but lemme get started with the programming so then it will be clearer...
Hok Posted November 25, 2008 Author Posted November 25, 2008 Alright, sorry for the double post, but I need a little help with this. So right now I have this... $Source = FileOpenDialog("Open the Notepad file with the list of proxies you would like to inport...", @WorkingDir &"\", "Text Files (*.txt)", 1 + 2) If @error = 1 Then MsgBox(16, "Error!", "No file selected. Exiting...") Exit EndIf FileOpen($Source) $Line1=FileReadLine($Source, 1) $IP1 = StringSplit($Line1, ":") $Line2=FileReadLine($Source, 2) $IP2 = StringSplit($Line2, ":") $Line3=FileReadLine($Source, 3) $IP3 = StringSplit($Line3, ":") $Line4=FileReadLine($Source, 4) $IP4 = StringSplit($Line4, ":") $Line5=FileReadLine($Source, 5) $IP5 = StringSplit($Line5, ":") $Line6=FileReadLine($Source, 6) $IP6 = StringSplit($Line6, ":") $Line7=FileReadLine($Source, 7) $IP7 = StringSplit($Line7, ":") $Line8=FileReadLine($Source, 8) $IP8 = StringSplit($Line8, ":") $Line9=FileReadLine($Source, 9) $IP9 = StringSplit($Line9, ":") $Line10=FileReadLine($Source, 10) $IP10 = StringSplit($Line10, ":") $Line11=FileReadLine($Source, 11) $IP11 = StringSplit($Line11, ":") ClipPut("HTTP\:\:\:" &$IP1[1] &"\:" &$IP1[2]") The only issue is that ClipPut() only puts text on a clipboard... Not variables? Correct me if I'm wrong... How would I go about fixing that...
TehWhale Posted November 25, 2008 Posted November 25, 2008 ClipPut("HTTP\:\:\:" &$IP1[1] &"\:" &$IP1[2]) Clipput can put variables, you were just putting it as a string, not as a variable.
Hok Posted November 25, 2008 Author Posted November 25, 2008 (edited) ClipPut("HTTP\:\:\:" &$IP1[1] &"\:" &$IP1[2]) Clipput can put variables, you were just putting it as a string, not as a variable. Then how would I fix my current situation... EDIT: Nevermind... sorry, I'm really dumb =/ Yet another question though... Right now I have it importing a Maximum of 12 ips... How would I make it able to inport any number, without writing them all out as different variables... (Even if that was possible) Edited November 25, 2008 by Hok
TehWhale Posted November 25, 2008 Posted November 25, 2008 Then how would I fix my current situation...The code in my post fixes it. I removed the last quote from the end.
Hok Posted November 25, 2008 Author Posted November 25, 2008 The code in my post fixes it. I removed the last quote from the end.Look at my edited post please; lol, we must've been writing at the same time
TehWhale Posted November 25, 2008 Posted November 25, 2008 Look at my edited post please; lol, we must've been writing at the same time Not sure what exactly you mean by your edited post.
Hok Posted November 25, 2008 Author Posted November 25, 2008 "Yet another question though... Right now I have it importing a Maximum of 12 ips... How would I make it able to inport any number, without writing them all out as different variables... (Even if that was possible)" So instead of importing specific lines, it imported the whole thing? I have no idea how to make this possible... Maybe through some kind of loop...?
November Posted November 25, 2008 Posted November 25, 2008 "Yet another question though... Right now I have it importing a Maximum of 12 ips... How would I make it able to inport any number, without writing them all out as different variables... (Even if that was possible)" So instead of importing specific lines, it imported the whole thing? I have no idea how to make this possible... Maybe through some kind of loop...? Hi there m8 I get this code i hope its suitable: #include <file.au3> Dim $bArray [2][2] $file = FileOpenDialog("Open the Notepad file with the list of proxies you would like to inport...", @WorkingDir &"\", "Text Files (*.txt)", 1 + 2) If @error = 1 Then MsgBox(16, "Error!", "No file selected. Exiting...") Exit EndIf $IPs = _FileCountLines($file) + 1 $output = "" Dim $bArray [$IPs][2] $bArray [0] [0]= $iPs $round = $IPs - 1 for $z = 1 to $round $read = FileReadLine($file, $z) $temparray = StringSplit($read, ":") $bArray[$z][0] = $temparray[1] $bArray[$z][1] = $temparray[2] $output = $output & "HTTP\:\:\:" & $bArray[$z][0] & "\:" & $bArray[$z][1] & @CRLF Next ClipPut($output) Cheers Old Scriptology Visual Ping 1.8 - Mass Ping Program with export to txt delimited. Desktop 2 RGB and YMCK - Pick a color in the desktop and get the RGB and YMCK code. Desktop 2 RGB - Pick a color in the desktop and get the RGB code. ShootIT 1.0 - Screen Capture full and partial screen [font="'Arial Black';"]Remember Remember The Fifth of November.[/font]
Hok Posted November 26, 2008 Author Posted November 26, 2008 Hi there m8 I get this code i hope its suitable: #include <file.au3> Dim $bArray [2][2] $file = FileOpenDialog("Open the Notepad file with the list of proxies you would like to inport...", @WorkingDir &"\", "Text Files (*.txt)", 1 + 2) If @error = 1 Then MsgBox(16, "Error!", "No file selected. Exiting...") Exit EndIf $IPs = _FileCountLines($file) + 1 $output = "" Dim $bArray [$IPs][2] $bArray [0] [0]= $iPs $round = $IPs - 1 for $z = 1 to $round $read = FileReadLine($file, $z) $temparray = StringSplit($read, ":") $bArray[$z][0] = $temparray[1] $bArray[$z][1] = $temparray[2] $output = $output & "HTTP\:\:\:" & $bArray[$z][0] & "\:" & $bArray[$z][1] & @CRLF Next ClipPut($output) CheersTyvm You and Whale helped me tons.
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