anystupidassname Posted July 9, 2005 Posted July 9, 2005 I'm attemping to place an unknown string into a variable from a file. By unknown, I mean it is going to be different each time and after "something=" and be composed of 8 numbers dot 3 numbers. It will be in a file but not necessarily the same number of lines in each time. Example file [somethin] something1=whatever something7=whatever something4=56354569.654 something2=die something6=now [somethin2] something11=whatever something77=whatever something44=56354569.654 something22=die something66=now I'd like to make the variable the first instance of "56354569". I've tried experimenting with readfile and stringinstr but I'm stumped... Thanks in advance for any help! This signature is computer generated, nothing can go wron#nothing can go wron#nothing can go wron#nothing can go wron#nothing can go wron#nothing can go wron#nothing can go wron#nothing can go wron#nothing can go wron#nothing can go wron#nothing can go wron#.......
GaryFrost Posted July 9, 2005 Posted July 9, 2005 Might try IsFloat(Number($string)) SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference.
blindwig Posted July 9, 2005 Posted July 9, 2005 Have you tried IniRead() yet? My UDF Threads:Pseudo-Hash: Binary Trees, Flat TablesFiles: Filter by Attribute, Tree List, Recursive Find, Recursive Folders Size, exported to XMLArrays: Nested, Pull Common Elements, Display 2dSystem: Expand Environment Strings, List Drives, List USB DrivesMisc: Multi-Layer Progress Bars, Binary FlagsStrings: Find Char(s) in String, Find String in SetOther UDF Threads I Participated:Base64 Conversions
GaryFrost Posted July 9, 2005 Posted July 9, 2005 forgot to ask the obvious SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference.
randallc Posted July 10, 2005 Posted July 10, 2005 (edited) Hi,Dirty, using DOS;FINDSTR /R/I /c:"[0-9]*[.][0-9][0-9][0-9]" "@ScriptDir\somethin.txt">"@ScriptDir\Answer.txt"then retrieve the first line from "@ScriptDir\Answer.txt"; "=" to "." not inclusive.!Best, Randall(We shouldn't resort to DOS; just familiar?);--------------- FINDSTRAU3 Example; Randall Clapp randallc@ozemail.com.au ---------------#include <file.au3>Dim $DosFINDSTRReturn,$DisplayOpt("RunErrorsFatal", 0);FINDSTR /R/I /c:"[0-9]*[.][0-9][0-9][0-9]" "@ScriptDir\somethin.txt">"@ScriptDir\Answer.txt"$DefSwitches="/R/I /c:"&chr(34)&"[0-9]*[.][0-9][0-9][0-9]"&chr(34) ; Change only if you know FINDSTR switches well$FileIndiv=@ScriptDir&"\somethin.txt"$Answer=@ScriptDir&"\Answer.txt"FINDSTRAU3($DefSwitches,$FileIndiv,$Answer)$sFilePath1=$AnswerFileOpen($sFilePath1,1 )$line = FileReadLine($sFilePath1)FileClose($sFilePath1)$pos1=StringInStr($line,"=")$pos2=StringInStr($line,".")$8nums=stringmid($line,$pos1+1,$pos2-$pos1-1)msgbox(0,"$8nums=",$8nums)Exit;--------------- FINDSTRAU3 function; Randall Clapp randallc@ozemail.com.au ---------------Func FINDSTRAU3($Switches, $File,$AnswerFile) If StringInStr($File, " ") Then $File = '"' & $File & '"' If StringInStr($AnswerFile, " ") Then $AnswerFile = '"' & $AnswerFile & '"' $Command = @ComSpec & " /c " & 'FINDSTR '& $Switches &' '& $File &'>'&$AnswerFile $DosFINDSTRReturn=RunWait($Command, @SystemDir, @SW_HIDE)EndFunc ;==>FINDSTRAU3 Edited July 10, 2005 by randallc ExcelCOM... AccessCom.. Word2... FileListToArrayNew...SearchMiner... Regexps...SQL...Explorer...Array2D.. _GUIListView...array problem...APITailRW
anystupidassname Posted July 10, 2005 Author Posted July 10, 2005 (edited) Iniread should do the trick! Thanks, autoit rules... Edited July 10, 2005 by anystupidassname This signature is computer generated, nothing can go wron#nothing can go wron#nothing can go wron#nothing can go wron#nothing can go wron#nothing can go wron#nothing can go wron#nothing can go wron#nothing can go wron#nothing can go wron#nothing can go wron#.......
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