protfromkpax Posted January 18, 2015 Share Posted January 18, 2015 Friends help me. description of the problem: There is a file that is structured like windows ini file, but lacks the early indications [section]. When would I managed to write the FIRST LINE of the expression "[section]" I treat him like a classic * .ini file (need it !!!). What you need: function that writes the selected text to the first line in the file (please, no solution 'run ("notepad.exe ... Send (" [section] "..) CloseFile () ...), but something like the" FileWriteLine "or "IniWrite". Then you need to find the file in a text string and the delete and find and delete empty lines. For help, thank you, and I apologize for English (it's not me, but google translator:-) Link to comment Share on other sites More sharing options...
water Posted January 18, 2015 Share Posted January 18, 2015 (edited) Welcome to AutoIt and the forum! I would start with_FileReadToArray to read the whole file into an array. Then use IniWrite and IniWriteSection to create the ini file from the needed lines. Edited January 18, 2015 by water My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
JohnOne Posted January 18, 2015 Share Posted January 18, 2015 _FileWriteToLine AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
protfromkpax Posted January 18, 2015 Author Share Posted January 18, 2015 MVP: thank you very much, I'm sure I will use it well! for John: fast and accurate. That's what I was looking for (the few I was looking for :-) ) Do not ask if it is possible to delete a line with a specific text and delete empty line. thank you Link to comment Share on other sites More sharing options...
JohnOne Posted January 18, 2015 Share Posted January 18, 2015 (edited) FileReadToArray Loop through, to find the line you want to replace. _FileWriteToLine with empty text param and $fOverwrite flag set to 1. Edited January 18, 2015 by JohnOne AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
water Posted January 18, 2015 Share Posted January 18, 2015 BTW: MVP is not the name of my account - it's "water". MVP stands for "Most valuable participant" (or something similar) My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
protfromkpax Posted January 18, 2015 Author Share Posted January 18, 2015 for Water: ...i´m sorry, i´m sorry, i´m sorry... :-) Link to comment Share on other sites More sharing options...
protfromkpax Posted January 18, 2015 Author Share Posted January 18, 2015 I need you help again. I have the link to file ( $file = FileOpenDialog("...", "@UserProfileDir", " (*.txt)") ), the link is in the format: C:Userpcfile.txt. Input format for external SW is in the format C:Userpcfile.txt. Could you help me? Link to comment Share on other sites More sharing options...
water Posted January 19, 2015 Share Posted January 19, 2015 for Water: ...i´m sorry, i´m sorry, i´m sorry... :-)Nothing to be sorry about I'm sure you will never do it again My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
SadBunny Posted January 19, 2015 Share Posted January 19, 2015 I need you help again.I have the link to file ( $file = FileOpenDialog("...", "@UserProfileDir", " (*.txt)") ), the link is in the format: C:Userpcfile.txt.Input format for external SW is in the format C:Userpcfile.txt.Could you help me? Something like this? $filename = "c:\x\y\z" ConsoleWrite("Before: " & $filename & @CRLF) $filename = StringReplace($filename, "\", "\\") ConsoleWrite("After: " & $filename & @CRLF)... which outputs: Before: c:\x\y\z After: c:\\x\\y\\z Roses are FF0000, violets are 0000FF... All my base are belong to you. Link to comment Share on other sites More sharing options...
protfromkpax Posted January 19, 2015 Author Share Posted January 19, 2015 I need you help again. I need to create a file link to the selected folder: Before: input file $FileSelectFolder( ... ) => C:xyz input folder FileOpenDialog( ... ) => D:ab After: C:abZ I do not need to copy the file, but only to create a destination link. thank you Link to comment Share on other sites More sharing options...
JohnOne Posted January 19, 2015 Share Posted January 19, 2015 You really need to explain a little better. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
protfromkpax Posted January 19, 2015 Author Share Posted January 19, 2015 i´m absolutly beginner, I wrote only a few small things, Now I'm trying to finish a script on lines 500 and something you really can not help it. and I still think that this is my last problem :-D Link to comment Share on other sites More sharing options...
JohnOne Posted January 19, 2015 Share Posted January 19, 2015 I don't even understand what you want, you are not explaining properly. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
protfromkpax Posted January 19, 2015 Author Share Posted January 19, 2015 Retrieves the file path ( C:dir1file.txt ) using the command "FileOpenDialog" Retrieves the path to another directory ( C:dir2 ) using the command "FileSelectFolder" You need a fold path to the file file.txt + C:Dir2 = C:dir2file.txt Link to comment Share on other sites More sharing options...
JohnOne Posted January 19, 2015 Share Posted January 19, 2015 (edited) ;bad code O.ops, sorry. Local $sFileSelectFolder = FileSelectFolder("Select a folder", "") Local $FileOpenDialog = FileOpenDialog("Select a file", @HomeDrive, "(*.*)") MsgBox(0, 0, $sFileSelectFolder & StringTrimLeft($FileOpenDialog, 2)) Edited January 19, 2015 by JohnOne AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
protfromkpax Posted January 19, 2015 Author Share Posted January 19, 2015 Alalujah! #include <StringConstants.au3> $text = FileOpenDialog("", "", "(*.*)") Local $aArray = StringSplit($Text, '', $STR_ENTIRESPLIT) $number = $aArray[0] $file = $aArray[$number] MsgBox(0, "", $file) Problem solved? Link to comment Share on other sites More sharing options...
JohnOne Posted January 19, 2015 Share Posted January 19, 2015 That code does absolutely nowhere near what you said you wanted and asked for. Good luck. Over and out. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
mikell Posted January 19, 2015 Share Posted January 19, 2015 Problem solved if you combine the codes from #16 and #17 Local $sFileSelectFolder = FileSelectFolder("Select a folder", "") Local $FileOpenDialog = FileOpenDialog("Select a file", @HomeDrive, "(*.*)") Local $tmp = StringSplit($FileOpenDialog, '\') MsgBox(0, 0, $sFileSelectFolder & "\" & $tmp[$tmp[0]]) Link to comment Share on other sites More sharing options...
JohnOne Posted January 19, 2015 Share Posted January 19, 2015 Problem solved if you combine the codes from #16 and #17 Local $sFileSelectFolder = FileSelectFolder("Select a folder", "") Local $FileOpenDialog = FileOpenDialog("Select a file", @HomeDrive, "(*.*)") Local $tmp = StringSplit($FileOpenDialog, '\') MsgBox(0, 0, $sFileSelectFolder & "\" & $tmp[$tmp[0]]) That produces the exact same result as the code I posted. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. 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