Finding That Line Of Code

Here’s the problem.  I have a line of code that I want to locate containing the words:

                             open-quote      files were not found

magnifying_glass_laptop_17652If you put all of your JSL code into a single file, then you can just use the script editor search (CTRL+F) to find specific elements of your code.  But I like to split my code by organisation units, each in their own include file.  Here is an example of what my script might look like before I start executing the Main block of code:

In this example I have about a dozen individual JSL files.  If I want to locate a segment of code then usually I know where to look because of the logical organisation of the files.  But not always.  There may be an error message that I want to look for, or a particular variable.

So I have written a script that will allow me to search all of my JSL files within a specific folder:

preview scripts
From here I just specify what I am looking for:

preview scripts2

Now it’s easy.  I can open the file (there is even an open button!) and search (CTRL+F) for the specific text.

Here’s the code to perform the script preview:

Share the joy:

2 thoughts on “Finding That Line Of Code”

  1. This is a handy tool, especially for anyone who is writing any sort of nontrivial scripts.

    Another way to approach this problem that might be useful would be a tool that “expands” the includes — so when you run the tool, a new script window shows up that has the original script except that all the includes have been replaced by the included files. You’d just want to make sure that none of the script(s) get evaluated when you’re putting the overall script into a new script window.

Leave a Reply