golfinhu Posted November 18, 2009 Share Posted November 18, 2009 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 More sharing options...
IndyUK Posted November 18, 2009 Share Posted November 18, 2009 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 More sharing options...
water Posted November 18, 2009 Share Posted November 18, 2009 _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 - 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...
99ojo Posted November 18, 2009 Share Posted November 18, 2009 (edited) 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 November 18, 2009 by 99ojo Link to comment Share on other sites More sharing options...
golfinhu Posted November 18, 2009 Author Share Posted November 18, 2009 Hi, new iniwrite: IniWrite (@ScriptDir & '\patch.ini', "Caminho", "File", StringLeft ($openfile, StringInStr ($openfile, "\", 0, -1 ) - 1)) ;-)) Stefan it's Work! Thankyou very much and thanks for all! you rulez =D 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