Sign in to follow this  
Followers 0
JLogan3o13

Remember chosen Directory

4 posts in this topic

I'm hoping this will be a simple fix. I do a lot of packaging of applications, and testing the installs. I wrote the quick script below to allow me to quickly install applications on test machines, rather than having to browse manually or run command line. The script has a function for a basic MSI install, as well as one for an MSI with a Transform file. My question is regarding the MSI and Transform function. I have the script opening a file open dialogue box in the root directory where all projects are stored, and then I browse for the MSI. It then opens back to that same root directory and I browse for the Transform. Is there an easy way to get it to remember and open in the directory where I just chose the MSI? Sometimes I have to browse 8 or 10 folders deep, and it would be nice not to have to do all that clicking more than once.

$var = MsgBox(4, "Test Application", "Does this install require a Transform?")
If $var = 6 Then
  Call("mst")
Else
  Call("msi")
EndIf

func msi()

$value = FileOpenDialog("Test Application Install", "packagingserver[url="file://\\jiminy\packaging"]\[/url]packagingDIR", "All (*.*)")
  Run( 'msiexec /i "' & $value & '" /qb' )
EndFunc

func mst()

$value1 = FileOpenDialog("MSI file", "packagingserver[url="file://jiminy/packaging"]\[/url]packagingDIR", "All (*.*)")
$value2 = FileOpenDialog("Transform file", "packagingserver[url="file://jiminy/packaging"]\[/url]packagingDIR", "All (*.*)") <---------- here is where I'd like to make the change. I would like this dialog box to open in the same directory where I chose the previous file one line above.
  Run( 'msiexec /i "' & $value1 & '" TRANSFORMS="' & $value2 & '" /qb' )
EndFunc

√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites



Set the second parameter as the starting directory.

Example:

#include <file.au3>

Dim $szDrive, $szDir, $szFName, $szExt

$value1 = FileOpenDialog("MSI file", "C:\temp", "All (*.*)")
$Path = _PathSplit($value1, $szDrive, $szDir, $szFName, $szExt)
$value2 = FileOpenDialog("Transform file", $szDrive & "\" & $szDir, "All (*.*)")

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

That's easy enough; think I was over-thinking things. Thanks much!


√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Global $Path = @ScriptFullPath

$Path = FileOpenDialog('Open File', StringRegExpReplace($Path, '\\[^\\]*\Z', ''), 'All Files (*.*)', 1 + 2, StringRegExpReplace($Path, '\.*\Z', ''))
$Path = FileOpenDialog('Open File', StringRegExpReplace($Path, '\\[^\\]*\Z', ''), 'All Files (*.*)', 1 + 2, StringRegExpReplace($Path, '\.*\Z', ''))
$Path = FileOpenDialog('Open File', StringRegExpReplace($Path, '\\[^\\]*\Z', ''), 'All Files (*.*)', 1 + 2, StringRegExpReplace($Path, '\.*\Z', ''))

Edited by Yashied

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  
Followers 0