Gmccormack Posted May 12, 2011 Share Posted May 12, 2011 Hi Sorry to ask what seems like a real dumb question but how the heck do i open a specific file i have looked on the web and the forums and all i have seen is $file = FileOpen("test.txt", 10) How do you nominate what drive or folder you intend to lookin Sorry again for the dumb question, maybe i cannot see for looking Grant Link to comment Share on other sites More sharing options...
wakillon Posted May 12, 2011 Share Posted May 12, 2011 (edited) Try like this : $file = FileOpen ( "c:\foldername\test.txt", 10) Edited May 12, 2011 by wakillon AutoIt 3.3.14.2 X86 - SciTE 3.6.0 - WIN 8.1 X64 - Other Example Scripts Link to comment Share on other sites More sharing options...
Gmccormack Posted May 12, 2011 Author Share Posted May 12, 2011 Many thanks for the response Im not sure what im doing wrong but but im still unable to open the file i get no errors so i am presuming it opens ok, do i need to add something to show the file Im completely new to all of this so please excuse my dumb questions Thanks in advance Link to comment Share on other sites More sharing options...
wakillon Posted May 12, 2011 Share Posted May 12, 2011 Not sure to well understand what you want to do...Why do you want open the file ? AutoIt 3.3.14.2 X86 - SciTE 3.6.0 - WIN 8.1 X64 - Other Example Scripts Link to comment Share on other sites More sharing options...
Gmccormack Posted May 12, 2011 Author Share Posted May 12, 2011 at the moment im just playing around trying to learn Autoit and this was the first step as the application i want to eventually build will need this feature Im used to using automated software without the coding so the steps are completely different I am trying to build a project where emails are downloaded and then parsed and the data placed into excel and control boxes in the GUI I have done this prior with automated software very easy but you can use this software with a Gui, hence the need to do this through AutoIt How long does it take on average to learn this ? also can you advise of how i incorporate a GUI i have designed with Design studi with AutoIt Thanks again Link to comment Share on other sites More sharing options...
hannes08 Posted May 12, 2011 Share Posted May 12, 2011 Hi Gmccormack, try this: $filehandle = FileOpen("C:\Path\To\file\File.txt") While 1 $line = FileReadLine($filehandle) If @error = -1 Then ExitLoop MsgBox(0, "Line read:", $line) Wend This was taken almost completely from the helpfile, which actually is a good place to start. Regards,Hannes[spoiler]If you can't convince them, confuse them![/spoiler] Link to comment Share on other sites More sharing options...
wakillon Posted May 12, 2011 Share Posted May 12, 2011 As say Hannes123, read the helpfile first,there is lot of examples who can help you to create what you want ! AutoIt 3.3.14.2 X86 - SciTE 3.6.0 - WIN 8.1 X64 - Other Example Scripts Link to comment Share on other sites More sharing options...
Gmccormack Posted May 12, 2011 Author Share Posted May 12, 2011 HI HannesI did look honest there is that much there its a job to view it allOk i tried what you said and even though i get no error it still wont workThis the code with my file path$filehandle = FileOpen("C:\Libraries\Documents\Test.txt")While 1 $line = FileReadLine($filehandle) If @error = -1 Then ExitLoop MsgBox(0, "Line read:", $line)WendWhat am i doing wrong Link to comment Share on other sites More sharing options...
UEZ Posted May 12, 2011 Share Posted May 12, 2011 Is Test.txt maybe empty? Br, UEZ Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ Link to comment Share on other sites More sharing options...
hannes08 Posted May 12, 2011 Share Posted May 12, 2011 How long does it take on average to learn this ?It depends. The learning curve with AutoIt is quite steep and you can achieve a lot of things very quickly. I don't think anyone can tell you how long it takes for you to learn it - unless he has worked with you for a while. My trainees usually take 3-4 weeks until they can code some simple applications. Some are faster some "not that fast" and some will never learn. also can you advise of how i incorporate a GUI i have designed with Design studi with AutoItYou can use KodaForm editor (that comes along with Scite4AutoIT) to build GUIs, but from my point of view this belongs to the more complex things to do with AutoIT. Take your time and start slow. Read the manual. Search the forum. Regards,Hannes[spoiler]If you can't convince them, confuse them![/spoiler] Link to comment Share on other sites More sharing options...
hannes08 Posted May 12, 2011 Share Posted May 12, 2011 Put the following lines after the FileOpen to check if file opened for reading is OK: If $filehandle = -1 Then MsgBox(0, "Error", "Unable to open file.") Exit EndIf And consider what UEZ said. Regards,Hannes[spoiler]If you can't convince them, confuse them![/spoiler] Link to comment Share on other sites More sharing options...
Gmccormack Posted May 12, 2011 Author Share Posted May 12, 2011 No the text file isnt empty. I shall trwal through the help files and try and learn some basics b4 i bore you guys silly with dumb questions I have to add that the support and help from you guys is awesome 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