Doxie Posted December 14, 2004 Share Posted December 14, 2004 Hi, I use Readini to get some info, but the value is so long, i only need the first letter in the value, is that possible? For example: IniRead($sFile,"Software Inventory","MydocumentsPath","") The value is: C:\Documents and Settings\YPX5976\My Documents or D:\Documents and Settings\YPX5976\My Documents or in sometimes H:\Documents and Settings\YPX5976\My Documents Can i make the iniread to get only the first so the value would be, C, D or H. Thanks in advance Were ever i lay my script is my home... Link to comment Share on other sites More sharing options...
sugi Posted December 14, 2004 Share Posted December 14, 2004 Read the whole value, then use StringLeft to extract the first letter. Link to comment Share on other sites More sharing options...
Doxie Posted December 14, 2004 Author Share Posted December 14, 2004 Thanks, it was so easy, but also so far away (for me) Were ever i lay my script is my home... Link to comment Share on other sites More sharing options...
Doxie Posted December 14, 2004 Author Share Posted December 14, 2004 Another problem i got.... When i import data using Iniread and the value got a space in it, it does not import the space, instead it import " " without the ". This is irretating, cause i import the data directly to excel sheet, and need to make calculations. But excel is not recognize the value as a number. If i import 32 433 it looks like 32 433 (I can see that when i look in the excel built in script editor) Is there anyway i can use iniread, to import just numbers??? Thanks in advance Were ever i lay my script is my home... Link to comment Share on other sites More sharing options...
Blue_Drache Posted December 14, 2004 Share Posted December 14, 2004 (edited) Well, Hmm..... put it into an array?$i = IniRead ($file, $section, $key, $default) stringsplit($i, " ")If line = 32 433$i[1] = 32$i[2] = 433You could then filewrite or send itFilewrite($file, $i[1] & " " & $i[2]) ; or you could send WinActivate($window) send($i[1] & " " & $i[2])That's just a simple solution...I'm sure there's more complex ones out there.Edit:Added "send" Edited December 14, 2004 by Blue_Drache Lofting the cyberwinds on teknoleather wings, I am...The Blue Drache Link to comment Share on other sites More sharing options...
sugi Posted December 14, 2004 Share Posted December 14, 2004 StringStripWS() + Number()? Link to comment Share on other sites More sharing options...
Doxie Posted December 14, 2004 Author Share Posted December 14, 2004 Thanks for the fast reply, but i made the calculation in AutoIt, before i import it to excel. It works great. $usedd = ($dsize-$dfree) If $usedd < $cfree Then $compa = ("Yes") Else $compa = ("No") EndIf What i am doing is, it checks if the used space on D: is bigger then the free space on C: We are about to migrate to XP, and one of our script does only work if it can create a image of D: on C: Wich then means, it need enough space. Were ever i lay my script is my home... 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