russell Posted July 19, 2011 Share Posted July 19, 2011 I recently wrote a large program the reference variables from a txt file. It works fine but was want to have the txt file instead of being the the same dir as the script, instead me on mysite and reference it from there. Before i used $color = FileOpen("color.txt", 0) I thought this might work $color = FileOpen("http://mysite.com/color.txt", 0) Since anyone could see it and it worked in my web-browser. However non of the variables now work and im thinking its not actually opening the file because the location. Is there another command i use before FileOpen, like a HTTP base one or something? Help didn't seem to help too much, i assume its because i don't know where to look muppet hands are so soft :) Link to comment Share on other sites More sharing options...
russell Posted July 19, 2011 Author Share Posted July 19, 2011 ooop Inetget, lol i think i found it muppet hands are so soft :) Link to comment Share on other sites More sharing options...
russell Posted July 19, 2011 Author Share Posted July 19, 2011 oo wow this proves to be a bit more than i thought. I ended up switching to InetRead instead but still cant seem to get any information from the file muppet hands are so soft :) Link to comment Share on other sites More sharing options...
russell Posted July 19, 2011 Author Share Posted July 19, 2011 $color1 = InetRead ("http://mywebsite/color.txt", 1) $color= BinaryToString($color1) $test = FileReadLine ($color, 3) $test = StringTrimLeft($test,13) MsgBox (1,"title", $test) That works if i tell the msgbox to give $color but not if i use the line read and trim. Any suggestions? muppet hands are so soft :) Link to comment Share on other sites More sharing options...
Exit Posted July 19, 2011 Share Posted July 19, 2011 use _inetgetsource() #include <INet.au3> ConsoleWrite(_INetGetSource('http://mywebsite/color.txt')) App: Au3toCmd UDF: _SingleScript() Link to comment Share on other sites More sharing options...
russell Posted July 19, 2011 Author Share Posted July 19, 2011 thanks ill try that muppet hands are so soft :) Link to comment Share on other sites More sharing options...
russell Posted July 19, 2011 Author Share Posted July 19, 2011 (edited) well that successfully writes it to the console but i have around 300 line in the script that look like this $test = FileReadLine ($color, 3) $test = StringTrimLeft($test,13) Is there a way to convert it to a temp file so all the trims and read line matchup? Edited July 19, 2011 by russell muppet hands are so soft :) Link to comment Share on other sites More sharing options...
Exit Posted July 19, 2011 Share Posted July 19, 2011 #include <inet.au3> FileWrite("C:\blabla\temp.txt",_INetGetSource("myurl")) App: Au3toCmd UDF: _SingleScript() Link to comment Share on other sites More sharing options...
russell Posted July 19, 2011 Author Share Posted July 19, 2011 perfect! thanks forumer100 muppet hands are so soft :) Link to comment Share on other sites More sharing options...
LurchMan Posted July 19, 2011 Share Posted July 19, 2011 You could also use: $sFileRead = BinaryToString(InetRead ($sURL)) This would avoid the temp file. Dating a girl is just like writing software. Everything's going to work just fine in the testing lab (dating), but as soon as you have contract with a customer (marriage), then your program (life) is going to be facing new situations you never expected. You'll be forced to patch the code (admit you're wrong) and then the code (wife) will just end up all bloated and unmaintainable in the end. Link to comment Share on other sites More sharing options...
Exit Posted July 19, 2011 Share Posted July 19, 2011 You could also use: $sFileRead = BinaryToString(InetRead ($sURL)) This would avoid the temp file. But he needs the temp file. See App: Au3toCmd UDF: _SingleScript() 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