Jump to content

Recommended Posts

Posted
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:-)
Posted (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 by water

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Posted
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
Posted

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 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Posted
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?
Posted

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 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Posted

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.

Posted

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
Posted

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
Posted
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
Posted (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 by JohnOne

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Posted

Alalujah!

#include <StringConstants.au3>
 
$text = FileOpenDialog("", "", "(*.*)")
    Local $aArray = StringSplit($Text, '', $STR_ENTIRESPLIT)
 
        $number = $aArray[0]
 
$file = $aArray[$number]
MsgBox(0, "", $file)
 
 
Problem solved?
Posted

 

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.

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...