Changing files and criteria/formulas

2 posts / 0 new
Last post
lgoldsmith
Offline
Joined: 04/15/2014 - 18:21
Changing files and criteria/formulas

I am new to scripting and have a few questions:
1. If I create a script based on a specific file and later want to run that script on another file, how do I do it without having to go into the script and modify the file? Is there a way to create a script not based on a specific file but just the open file in IDEA?
2. I have criteria to enter into a script but have been told it isn't possible. Is it possible to enter criteria/formula into the script?
Thanks for your help.

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

Hello and welcome to the site.

Yes there is a way to obtain the file through a dialog using the following code:

Dim oFilebar as object
Dim sFileName as string
Set oFilebar=CreateObject("ideaex.fileexplorer")
oFilebar.displaydialog sFileName=oFilebar.selectedfile
Set oFilebar = nothing

You would then use sFilename variable in place of the filename.

For the second question, it is possible but you can't use the equation editor.  You could create a dialog with an edit box to put the equation in or you could use an inputbox, but there would be no error checking.  You can also add varaibles to an equation.  So if you have an equation such as AMOUNT > 1000 you could change the field and/or the amount through a dialog or inputbox. 

You might want to check out the videos I have created on makimg a simple script, this might help you out.