Moderators JLogan3o13 Posted November 19, 2010 Moderators Posted November 19, 2010 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 "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum!
water Posted November 19, 2010 Posted November 19, 2010 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 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
Moderators JLogan3o13 Posted November 19, 2010 Author Moderators Posted November 19, 2010 That's easy enough; think I was over-thinking things. Thanks much! "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum!
Yashied Posted November 20, 2010 Posted November 20, 2010 (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 November 20, 2010 by Yashied My UDFs: iKey | FTP Uploader | Battery Checker | Boot Manager | Font Viewer | UDF Keyword Manager | Run Dialog Replacement | USBProtect | 3D Axis | Calculator | Sleep | iSwitcher | TM | NetHelper | File Types Manager | Control Viewer | SynFolders | DLL Helper Animated Tray Icons UDF Library | Hotkeys UDF Library | Hotkeys Input Control UDF Library | Caret Shape UDF Library | Context Help UDF Library | Most Recently Used List UDF Library | Icons UDF Library | FTP UDF Library | Script Communications UDF Library | Color Chooser UDF Library | Color Picker Control UDF Library | IPHelper (Vista/7) UDF Library | WinAPI Extended UDF Library | WinAPIVhd UDF Library | Icon Chooser UDF Library | Copy UDF Library | Restart UDF Library | Event Log UDF Library | NotifyBox UDF Library | Pop-up Windows UDF Library | TVExplorer UDF Library | GuiHotKey UDF Library | GuiSysLink UDF Library | Package UDF Library | Skin UDF Library | AITray UDF Library | RDC UDF Library Appropriate path | Button text color | Gaussian random numbers | Header's styles (Vista/7) | ICON resource enumeration | Menu & INI | Tabbed string size | Tab's skin | Pop-up circular menu | Progress Bar without animation (Vista/7) | Registry export | Registry path jumping | Unique hardware ID | Windows alignment More...
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