IDEASnippets
Count the number of time a certain item appears in an array
This snippet will take an array and a string value (you can easily change it to other formats) and count how many times an item appears in the array.
Matching Key Example
An example of how to create a dialog that emulates the matching dialog in IDEA.
- Read more about Matching Key Example
- 2 comments
- Log in or register to post comments
Normalize Field Name
This snippet will take a variable and translate it to how it would appear as an IDEA field name.
- Read more about Normalize Field Name
- 2 comments
- Log in or register to post comments
renameFields Function
Function: renameFields
Purpose: To rename fields within a file
Input: sTempFilename: the name of the imd file that contains the fields to change
sOldFieldName: The name of the field that is to be changed
sNewFieldName: The new field name
Returns: True if fieldname was changed False if the field name could not be changed
Problems: Currently does not work for some Editable fields
- Read more about renameFields Function
- 19 comments
- Log in or register to post comments
Date Picker
One of the items that the IDEAScripting dialog lacks is a date picker. I recently saw a post on the IDEA forum that they had the script for one but for some strange reason weren't releasing it on the scripting section, so I decided to try and create a date picker for my use and anyone else that wants to use it.
The attached script has the code for the date picker along with an example of how to use it with a dialog that asks for the user to enter a date.
When you start up the example script you will have a dialog with two edit boxes where the user can enter a date:
- Read more about Date Picker
- 6 comments
- Log in or register to post comments
Test to see if Array is empty
This function will test to see if an array is empty or not and will return true or false. I added a line at the beginning of the function to make sure the err.number is 0, I had it happen that it would show an error but the error wasn't caused by the testing but by something else.
The following is an example on how to use it:
Dim myArray() as string
- Read more about Test to see if Array is empty
- Log in or register to post comments
Checking for a list of charcters in a string
I came up with this function while trying to validate a filename for a script. The function will take a string and a list of characters to look for and will return true if the string contains one or more of those characters. An example would be looking for \/:*?"<>[]| as these characters should not appear in a filename, so if they exist the filename is not valid. You would call it in the following way:
checkForSpecialChar(newFilename, "\/:*?""<>[]|")
- Read more about Checking for a list of charcters in a string
- 2 comments
- Log in or register to post comments
Using listboxs to select files/fields
A common problem with IDEAScript is there is no easy way to select multiple files or fields. This script shows you one way of performing this operation. This is a working example script. It has a main menu that allows you to open the listbox dialog. The main menu also allows you to select which type of fields you want to display, when you select ok you will have a message box of the fields that you selected. You can download the code.
- Read more about Using listboxs to select files/fields
- 20 comments
- Log in or register to post comments
Check if File or Directory Exists
This snippet will check if a file or directory exists. It returns true or false and you send the full pathname and filename. I adapted this snippet from one I found at http://www.vbaexpress.com/kb/getarticle.php?kb_id=559
- Read more about Check if File or Directory Exists
- Log in or register to post comments
Action Field
This snippet was created by CB and it allows us to use IDEAScript to create an action field. The function takes three parameters:
The master file, this is the file in which the field will hold the action (i.e.
- Read more about Action Field
- Log in or register to post comments