Jump to content

Please, help with .ini file


golfinhu
 Share

Recommended Posts

Hello Everybody!

Guys, I need your help!

The thing is, I'm trying to create software, and in the middle of a transaction is created. Ini file, that file. Ini I can not find the root directory of the file with the following code:

$open_file = FileOpenDialog($message, @ProgramFilesDir & "\", "exe files (*.exe)", 1 + 4 )
If @error Then
    MsgBox(4096,"Erro!","Você não selecionou o Aplicativo corretamente!")
Else
    IniWrite(@ScriptDir & '\patch.ini', "Caminho", "File", $open_file)

but I must also get the directory of that application, for example:

if the file is:

C:\Program Files\Test\test.exe

I need to write on. ini file the following also:

C:\Program Files\Test

ie, I need to just delete the "\test.exe" line that shows where the file is!

thanks to those who can help me!

and sorry for my bad English

Hugs!

Link to comment
Share on other sites

Hello Everybody!

Guys, I need your help!

The thing is, I'm trying to create software, and in the middle of a transaction is created. Ini file, that file. Ini I can not find the root directory of the file with the following code:

$open_file = FileOpenDialog($message, @ProgramFilesDir & "\", "exe files (*.exe)", 1 + 4 )
If @error Then
    MsgBox(4096,"Erro!","Você não selecionou o Aplicativo corretamente!")
Else
    IniWrite(@ScriptDir & '\patch.ini', "Caminho", "File", $open_file)

but I must also get the directory of that application, for example:

if the file is:

C:\Program Files\Test\test.exe

I need to write on. ini file the following also:

C:\Program Files\Test

ie, I need to just delete the "\test.exe" line that shows where the file is!

thanks to those who can help me!

and sorry for my bad English

Hugs!

Lookup _PathSplit in the helpfile. This will break down all the elements that make up the entire path. You then read the parts you need.

Hope this helps.

Link to comment
Share on other sites

_PathSplit should do what you need:

#include <file.au3>

Dim $szDrive, $szDir, $szFName, $szExt
$TestPath = _PathSplit(@ScriptFullPath, $szDrive, $szDir, $szFName, $szExt)
ConsoleWrite($szDrive & $szDir & @CRLF)

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.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 (NEW 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

 

Link to comment
Share on other sites

Hello Everybody!

Guys, I need your help!

The thing is, I'm trying to create software, and in the middle of a transaction is created. Ini file, that file. Ini I can not find the root directory of the file with the following code:

$open_file = FileOpenDialog($message, @ProgramFilesDir & "\", "exe files (*.exe)", 1 + 4 )
If @error Then
    MsgBox(4096,"Erro!","Você não selecionou o Aplicativo corretamente!")
Else
    IniWrite(@ScriptDir & '\patch.ini', "Caminho", "File", $open_file)

but I must also get the directory of that application, for example:

if the file is:

C:\Program Files\Test\test.exe

I need to write on. ini file the following also:

C:\Program Files\Test

ie, I need to just delete the "\test.exe" line that shows where the file is!

thanks to those who can help me!

and sorry for my bad English

Hugs!

Hi,

new iniwrite:

IniWrite (@ScriptDir & '\patch.ini', "Caminho", "File", StringLeft ($openfile, StringInStr ($openfile, "\", 0, -1 ) - 1))

;-))

Stefan

Edited by 99ojo
Link to comment
Share on other sites

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
 Share

  • Recently Browsing   0 members

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