Browse windows to select item

9 posts / 0 new
Last post
Dino
Offline
Joined: 02/08/2018 - 02:45
Browse windows to select item

Hi Brain, 
 
How are you doing? can you help me with a bit of script? I'm trying to get browse window to select a file. I already found a bit of script that lets you select a folder, but i need to select the file. I'm having problems converting the script to let me select a file instead of a folder.
 
Function BrowseFolder() Dim oFolder, oFolderItem Dim oPath, oShell, strPath, item Dim msg As String
 Set oShell = CreateObject( "Shell.Application" ) Set oFolder = oShell.Namespace(17) Set oFolderItem = oFolder.Self strPath = oFolderItem.Path
 msg = "Select file "  Set oFolder = oShell.BrowseForFolder(0, msg, 1, strPath )
 If oFolder Is Nothing Then  BrowseFolder = ""  Exit Function End If
 Set oFolderItem = oFolder.Self oPath = oFolderItem.Path
 BrowseFolder = oPathEnd Function
Thanks again, 
Dino.

Brian Element's picture
Brian Element
Offline
Joined: 07/11/2012 - 19:57

Hi Dino, are you trying to select any file or an IDEA file?

What you are using only selects a folder but there are a few options to select a file or a special function to select an IDEA file, let me know which nd I will give you some examle code.

Brian

Dino
Offline
Joined: 02/08/2018 - 02:45

Hi Brain, I'm trying to select a file for example on my desktop. It is a .XAF file (xml auditfile). IDEA has a plugin for it but not for the newest type (3.2). 
Do you also have some nowhow for working with xml files and the way to code the tags (XRDF file)? 
Thanks again. 

Brian Element's picture
Brian Element
Offline
Joined: 07/11/2012 - 19:57

Hi Dino, here is some code to select your file.  Sorry, I have never really used xml files so I can't help you.  If you have a maintenance contract with IDEA you should probably send them the queation as they can probalby help you.

 


Sub Main

	' Declare variables and objects.
	Dim filename As String	
	Dim obj As Object

	' Access the CommomDialogs object.
	Set obj = Client.CommonDialogs
	
		' Show the Open dialog box with the applied filters.
	
		filename = obj.FileOpen("","","XML Files (*.XML)|*.XML|All Files (*.*)|*.*||;")
	
		' Display the selected file name.
	
		MsgBox filename

	Set obj = Nothing

End Sub
Dino
Offline
Joined: 02/08/2018 - 02:45

Hi Brain, 
It works like a charm, Thanks!
We have a support contract so I will try to contact them for some info. 

cthilton
Offline
Joined: 03/02/2019 - 21:17

Is it possible for this file window to open to a specific folder, such as the Source Files folder of the current idea project i am working in?

Brian Element's picture
Brian Element
Offline
Joined: 07/11/2012 - 19:57

Yes it is, the second parameter allows you to say where you want the folder to open.  I have adapted the code above to open in the current project folder under the Source Files folder.


Sub Main

	' Declare variables and objects.
	Dim filename As String	
	Dim obj As Object

	' Access the CommomDialogs object.
	Set obj = Client.CommonDialogs
	
		' Show the Open dialog box with the applied filters.
		workfolder = Client.WorkingDirectory()
		filename = obj.FileOpen("",workfolder & "Source Files.ILB\*.*","XML Files (*.XML)|*.XML|All Files (*.*)|*.*||;")
	
		' Display the selected file name.
	
		MsgBox filename

	Set obj = Nothing

End Sub
PATKELL
Offline
Joined: 12/22/2016 - 18:25

This it possible to write a script that allows the user to script an equation from a folder and insert that equation into a direct extraction
 
thanks
 

Brian Element's picture
Brian Element
Offline
Joined: 07/11/2012 - 19:57

Hi Pat, I am not sure what you mean by "script an equation from a folder".  In the next version of IDEA we should have access to the equation editor through IDEAScript.