keilamym Posted August 16, 2005 Share Posted August 16, 2005 can someon please help. I have text file that I need Autoit to open, and reformat. Example Opt("WinTitleMatchMode", 2) Run("Notepad.exe Resource.csv", "", ) WinWaitActive("Resource","") Send ("'" & "{END}" & "'" & "," & "{DEL}") While this simple query works, I would like to only have it run for number of lines in the .txt file. My question is how can I have autoit load the names into some environment and once its at the end, it will stop. Example user.user1 user.user2 user.user3 needs to look like 'user.user1','user.user2','user.user3' etc. Any assistance would be appreciated. Thank You Lavelle Link to comment Share on other sites More sharing options...
DaleHohm Posted August 16, 2005 Share Posted August 16, 2005 You'll have much more control if you open the file directly with AutoIt instead of automating Notepad.See the commands FileOpen, FileReadLine, FileWrite (or FileWriteLine) and FileClose. Dalecan someon please help.I have text file that I need Autoit to open, and reformat.ExampleOpt("WinTitleMatchMode", 2)Run("Notepad.exe Resource.csv", "", )WinWaitActive("Resource","")Send ("'" & "{END}" & "'" & "," & "{DEL}")While this simple query works, I would like to only have it run for number of lines in the .txt file.My question is how can I have autoit load the names into some environment and once its at the end, it will stop.Exampleuser.user1user.user2user.user3needs to look like'user.user1','user.user2','user.user3' etc.Any assistance would be appreciated.Thank YouLavelle<{POST_SNAPBACK}> Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model Automate input type=file (Related) Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded Better Better? IE.au3 issues with Vista - Workarounds SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead? Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble Link to comment Share on other sites More sharing options...
keilamym Posted August 16, 2005 Author Share Posted August 16, 2005 Dale, Thanks for your response. I've setup loops for directory reads and have it run commands in the past but never like this. Are you saying that I need to read the file (FileRead, FileReadLine, or FileOpen) and if the line exist, then write the contents of that line along with my changes to a different file(FileWrite, or FileWriteLine)? Thank You Lavelle Link to comment Share on other sites More sharing options...
DaleHohm Posted August 16, 2005 Share Posted August 16, 2005 Yes, that is a simple approch. Open the existing file for read access, open a second with write access. Read in the lines from the read-only file one at a time, parse them and then write the desired output to the second file. The help on FileReadLine has a nice example on how open and read a file line by line till you hit the end. Dale Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model Automate input type=file (Related) Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded Better Better? IE.au3 issues with Vista - Workarounds SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead? Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble Link to comment Share on other sites More sharing options...
keilamym Posted August 16, 2005 Author Share Posted August 16, 2005 (edited) Dale thanks for the input... While this is the test script, it works great. $file = FileOpen("test.txt", 0) $newfile = "saved.txt" while 1 $line = FileReadLine($file) if @error = -1 then ExitLoop FileWrite($newfile,"'" & $line & "'" & ",") WEnd I'll just be going back and adding prompts for the file names I want to convert. Thanks again Lavelle Edited August 16, 2005 by keilamym 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