UweH Posted March 3, 2010 Posted March 3, 2010 I wrote a WEng script, which reads a text file with some coordinates and wind data. The user should select the file name in the Windows "open file" window.At the moment I am using FileAssistant.GetAWindAtlasFileNameThis works, but for this command *.map files are preselected. The user has to select *.* manually.Is there any other command to select *.* or *.txt files directly?Thanks,Uwe
Duncan Posted March 8, 2010 Posted March 8, 2010 Is the default extension for that method really *.map or is it actually *.lib? If it's map then we've got a bug in there somewhere.There is no method on that object (or anywhere else) to get the name of some other type of file. You could use the VBScript call 'Inputbox' to retrieve a string from the user, but that's a bit ugly. We could add a method like this to the next WEng 2.0 release if you think it would be useful.Duncan.
UweH Posted March 9, 2010 Posted March 9, 2010 Thanks for the response. You're right, it's *.lib.I think it would be a great help to have a method likeFileAssistant.GetAFileName Extension in WEng. Extension should be a free definable string (could be "*.txt", "*.grd", "*.rsf", ...).
HPJ Posted March 16, 2010 Posted March 16, 2010 I've had success using the below method to get the filename of txt files. You can add your own filters to the open dialog:'Open File Dialog ang get the filename that was pickedDim objDialog'Create a dialog objectSet objDialog = CreateObject( "UserAccounts.CommonDialog" ) 'Filter so only txt files are shownobjDialog.Filter = "Mast Siting Files|*.txt"'Open the dialog and return the selected file nameIf objDialog.ShowOpen Then GetFileName = objDialog.FileNameElse GetFileName = ""End IfThen your filename will be in the GetFileName variable.
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