t1ll.3nd Posted December 14, 2005 Share Posted December 14, 2005 Hi there,after compiling my Script to .exe it won't read the extern file and only has the data of the extern file inside which i had there when i created the exe .. mean the content is constant.$file = FileOpen("www.txt", 0)$pw = FileReadLine($file)FileClose($file)On my PC it works .. but on other it won't and only uses the strings which where in the file which i had on my PC .. Link to comment Share on other sites More sharing options...
BigDod Posted December 14, 2005 Share Posted December 14, 2005 Hi there,after compiling my Script to .exe it won't read the extern file and only has the data of the extern file inside which i had there when i created the exe .. mean the content is constant.On my PC it works .. but on other it won't and only uses the strings which where in the file which i had on my PC ..Are you using fileinstall to include the file www.txt in your exe. Time you enjoyed wasting is not wasted time ......T.S. Elliot Suspense is worse than disappointment................Robert Burns God help the man who won't help himself, because no-one else will...........My Grandmother Link to comment Share on other sites More sharing options...
t1ll.3nd Posted December 14, 2005 Author Share Posted December 14, 2005 Sorry, i don't know what do you mean with "fileinstall" .. i only have the .exe and created the .txt myself. Link to comment Share on other sites More sharing options...
BigDod Posted December 14, 2005 Share Posted December 14, 2005 Sorry, i don't know what do you mean with "fileinstall" .. i only have the .exe and created the .txt myself.If you require the file to be available for use on other computers you need to use FileInstall to build it in as part of the exe. You will find information and examples in the help file. If you just need the file to record something from your script you will need to open it for writing not just reading. Time you enjoyed wasting is not wasted time ......T.S. Elliot Suspense is worse than disappointment................Robert Burns God help the man who won't help himself, because no-one else will...........My Grandmother Link to comment Share on other sites More sharing options...
kpu Posted December 14, 2005 Share Posted December 14, 2005 What BigDod is trying to tell you is that your www.txt file needs to reside in the same directory as your executable. Also, is that all of your code? It's not doing anything except opening a file, reading a line, and then closing it. Try this: $file = FileOpen("www.txt", 0) $pw = FileReadLine($file) MsgBox(32,"Reading www.txt.","Information on line is:" & $pw") FileClose($file) http://www.kpunderground.com Link to comment Share on other sites More sharing options...
t1ll.3nd Posted December 14, 2005 Author Share Posted December 14, 2005 No its only the part .. but the rest isn't important for this .. because the rest works ControlSetText("Bla", "", "Edit1", "$pw" ) Here the $pw is used ... how could i implent this feature that everbody can change his own pw? and yes the file is in the same directory of course .. same file structure like at my Desk .. Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted December 14, 2005 Moderators Share Posted December 14, 2005 You could use an .ini file rather than a .txt file. Set it up as a "poor man's database" Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
t1ll.3nd Posted December 14, 2005 Author Share Posted December 14, 2005 Yes but the .txt should also works .. its really simple and it works on my PC .. but i dont know why it uses the string from my pc .. when its on another .. Link to comment Share on other sites More sharing options...
BigDod Posted December 14, 2005 Share Posted December 14, 2005 Yes but the .txt should also works .. its really simple and it works on my PC .. but i dont know why it uses the string from my pc .. when its on another ..If you wish to write to the file the line $file = FileOpen("www.txt", 0) should be $file = FileOpen("www.txt", 1) or $file = FileOpen("www.txt", 2).As to why it reads the string from your pc, we would need to see more of the script to see what is happening. Time you enjoyed wasting is not wasted time ......T.S. Elliot Suspense is worse than disappointment................Robert Burns God help the man who won't help himself, because no-one else will...........My Grandmother Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted December 14, 2005 Moderators Share Posted December 14, 2005 Well, sounds like you hard coded it personally. Did you do a FileInstall() like BigDod said with the .txt file, or are you creating the text file on that person's computer <hold on chasing my tale >, If you're doing a FileInstall(), you have to make sure that the <hold almost got that thing> information in that file isn't saved with information about your PC. Tell you what, I can't seem to get this dang 'tale', post the code that you are getting the information from the 'end user', and and where you're putting it at in the .txt, BTW... If you're constantly writing stuff to a file to be used as information, and .ini may be more appropriate. The 'chasing the tale' bit is because, the simple code you provide (basically from the help file), doesn't tell us what the problem is, you have to provide some of the tools ... ie.. The .txt file you're using and script you're having a problem with ... to get some real answers. Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
kpu Posted December 14, 2005 Share Posted December 14, 2005 No its only the part .. but the rest isn't important for this .. because the rest works ControlSetText("Bla", "", "Edit1", "$pw" )Here the $pw is used ...how could i implent this feature that everbody can change his own pw?and yes the file is in the same directory of course .. same file structure like at my Desk ..Just wanted to make sure. The 'chasing the tale' bit is because, the simple code you provide (basically from the help file), doesn't tell us what the problem is, you have to provide some of the tools ... ie.. The .txt file you're using and script you're having a problem with ... to get some real answers.Well said SmOke_N. http://www.kpunderground.com Link to comment Share on other sites More sharing options...
t1ll.3nd Posted December 14, 2005 Author Share Posted December 14, 2005 No its not from the help file. I scripted an Autologin for a game. It reads the user PW from a .txt which is in the same directory as the .exe. It only READS - the PW is handwritten into the file and the .txt also created by the user himself. .txt content: jdfnjfnf (something like this .. only 1 word .. ) lua file: $i=0 $file = FileOpen("pww.txt", 0) $pw = FileReadLine($file) FileClose($file) While $i <= 10 ;;some clicking around ... ControlSetText("Application", "", "Edit1", "$pw" ) ;;someclicking around.. $i = $i + 1 WEnd That's it .. Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted December 14, 2005 Moderators Share Posted December 14, 2005 Well for one, you have you're $PW variable in quotes, that's not gonna work. Let's say I have $pw = FileReadLine($file) instead of that line being sent, you have the actual "$" and "p" and "w" being sent. Why not: ControlSend("Application", "", "Edit1", $pw) ?? Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
MHz Posted December 14, 2005 Share Posted December 14, 2005 $file = FileOpen(@ScriptDir & "\pww.txt", 0) $pw = FileReadLine($file) FileClose($file) For $i = 1 To 10 ;;some clicking around ... ControlSetText("Application", "", "Edit1", $pw) ;;someclicking around.. Next Link to comment Share on other sites More sharing options...
t1ll.3nd Posted December 14, 2005 Author Share Posted December 14, 2005 I think that was the prob .. im such a dumb-ass I should have saw this cause i know a lil C++ and there it is the same a lot of thanks .. will test it later (atm not possible ..) but i think this was the problem Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted December 14, 2005 Moderators Share Posted December 14, 2005 What do you feel was the problem, so that others that may ask the same question and do a search may find a simple solotuion? Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
t1ll.3nd Posted December 14, 2005 Author Share Posted December 14, 2005 (edited) the " " were the problem so i didn't use the var .. i used the $pw as String Do i need $file = FileOpen(@ScriptDir & "\pww.txt", 0) ? The @ ScriptDir thing .. ? Edited December 14, 2005 by t1ll.3nd Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted December 14, 2005 Moderators Share Posted December 14, 2005 That would depend on where you're A) Creating the .txt file or If the txt file will be in the au3.exe directory. Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
MHz Posted December 14, 2005 Share Posted December 14, 2005 It is just a safe guard in case the working directory is not the script directory. It is good practice to do so if you do not mind a little extra code. Your choice. Link to comment Share on other sites More sharing options...
t1ll.3nd Posted December 14, 2005 Author Share Posted December 14, 2005 Another Question .. how can i make the script start itself from the beginning if a WinWait Window isn't coming after a certian period of time?^^ 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