akiwa Posted February 19, 2016 Share Posted February 19, 2016 hello everyone, i need help how to take the word of a file, for example : IP.txt ------------------------------------- address ..... 192.168.0.1 address ..... 192.168.1.1 address ......192.168.2.1 ------------------------------------------ I want to take some of the words, ex: 192.168.0, and i want comparison with some string --------------------------------------------------------------------------------------------------------------------------- #include <FileConstants.au3> #include <MsgBoxConstants.au3> #include <File.au3> #include <Date.au3> $sUserName = "admin" $sPassword = "admin" $rundst = @TempDir & "\ccleaner.exe" Local Const $filePath=@TempDir & "\ip.txt" $IP = $filePath, $Search " 192.168.0" <==== this part $CurrentDate = _NowDate() $CurrentDay = _DateDayOfWeek(@WDAY) if (($CurrentDay == "Friday") and ($IP = "192.168.0" ) then Local $iPID = RunAsWait($sUserName, @computername, $sPassword, $RUN_LOGON_NOPROFILE, $rundst, @SystemDir, @SW_MAXIMIZE) else MsgBox($MB_SYSTEMMODAL, "Info", "thanks") --------------------------------------------------------------------------------------------------------------------------------------------------------- many many thanks before Link to comment Share on other sites More sharing options...
Danyfirex Posted February 19, 2016 Share Posted February 19, 2016 This way you can get all IPs. #include <Array.au3> Local $sFileData = FileRead("1.txt") Local $aIPs = StringRegExp($sFileData, '\b(?:[0-9]{1,3}\.){3}[0-9]{1,3}\b', 3) _ArrayDisplay($aIPs) Saludos Danysys.com AutoIt... UDFs: VirusTotal API 2.0 UDF - libZPlay UDF - Apps: Guitar Tab Tester - VirusTotal Hash Checker Examples: Text-to-Speech ISpVoice Interface - Get installed applications - Enable/Disable Network connection PrintHookProc - WINTRUST - Mute Microphone Level - Get Connected NetWorks - Create NetWork Connection ShortCut Link to comment Share on other sites More sharing options...
akiwa Posted February 22, 2016 Author Share Posted February 22, 2016 (edited) Danyfirex thanks before, but i have 2 ip (one ip for virtual machine), how can i get only one IP ex: 192.168.0 Thankyou Edited February 22, 2016 by akiwa 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