Get File Name

A function to obtain the file name from a string that also contains the directory info.  This was updated on April 4, 2012 to add functionality for files that may be in sub directories.  Also added functionilty where you can get the file name or the file name with the directory imbedded in the IDEA working directory.

Add the follwoing as a global variable:
Dim working_directory As String

Add this line as one of the first lines of script in your main subroutine:
working_directory = Client.WorkingDirectory()

Function getFileName(temp_filename As String, temp_type As Boolean) '1 if get the name with any folder info, 0 if only the name Dim temp_length As Integer Dim temp_len_wd As Integer Dim temp_difference As Integer Dim temp_char As String Dim tempfilename As String If temp_type Then temp_len_wd = Len(working_directory ) + 1'get the lenght of the working directory temp_length = Len(temp_filename) 'get the lenght of the file along with the working directory temp_difference = temp_length - temp_len_wd + 1'get the lenght of just the filename getFileName = Mid(temp_filename, temp_len_wd, temp_difference) Else temp_length = Len(temp_filename ) Do temp_char = Mid(temp_filename, temp_length , 1) temp_length = temp_length - 1 If temp_char <> "\" Then tempfilename = temp_char & tempfilename End If Loop Until temp_char = "\" Or temp_length = 0 getFileName = tempfilename End If End Function


Hi Brian, is there are way to increase the size of the box and the width of the first column with the fieldnames?  Scrolling over and opening the width of the first column is cumbersome; especially when there is multiple branches.  Perhaps this "selection box" built into IDEA itself?  Can the IDEA object be altered to open the width of the selection box?  Thanks.

Brian Element's picture

Hi there, I am not exactly sure what you are refering to.  Is this a pop-up box or dialog created with a script?  If so then usually it can be changed as the size is defined by the creator of the script.  Can you post an image of what you are looking at as I am not 100% sure what you are talking about.

Sorry it took me so long to respond... If, for example, you were to run the "identify blank and repeat fields" scripts that you have on the site.  That script includes the above subroutine.  When you chose the file that you want to select to identify the blank/repeat fields, you receive a "file explorer" selection box.  The width of this box is too small for me because if the filenames are lengthy or they have branches, I have to increase the size of the first column and scroll to see the filenames in their entirety.  I hope this makes sense.  If you run the blank/repeat script, you will understand.  The box where you select the file is too narrow.  Thanks.

Brian Element's picture

Is this the selection box you are refering to?

Open Database

You can change the size of the name to see more info.  Maybe if you post an image of the dialog it would help me out, you can also email it to me if you don't want to post it.