Jump to content
Sign in to follow this  
golfinhu

Please, help with .ini file

Recommended Posts

golfinhu

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!

Share this post


Link to post
Share on other sites
IndyUK

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.

Share this post


Link to post
Share on other sites
water

_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 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites
99ojo

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

Share this post


Link to post
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
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.