Skip to main content
InSource Solutions

TN - 1225 Searching for Script - Strings in a Galaxy

Description

 

This article from InSource shows a couple mechanisms available for locating scripts - strings within a Galaxy. 

  • Author: Mario Meza
  • Published: 03/10/2022
  • Applies to: Application Server and InTouch OMI 

Details

You may find you need to search for references in scripts within your galaxy. For example Galaxy references used in OMI are not supported and can cause issues.  

The following  two options may be of value in locating string / scripts depending on where they are defined.

 Note the options outlined in this document are not officially supported by AVEVA. Always execute caution when running any script or utility in a production environment. 

 

Option 1:

  • A utility known as  the GRScript search utility which is actually not a Utility as you might imagine. It’s actually a SQL script written by a technical support engineer as a useful tool and is not an official tool AVEVA supports. There is no documentation associated with the product. In theory the tool should work with all versions however it will not have gone through extensive testing.
  • To use it just remove the .txt from the filename and open from SSMS or copy and paste the text in a query. 
  • A copy of the utility can be accessed from the following link.

 

In testing a script was updated in a test object called hudClar1Flow.  A unique comment was added saved and checked it in.

'Needle.In.Haystack can you find this? d[-!-]b

'Galaxy:"Object.attribute"

clipboard_e35dd1a7a777172465dd535152a7e1fa1.png

 

In SQL Server Management Studio the GRScript search Query was opened and  the Database / Galaxy Name  to use was updated. For this example the name of the Galaxy is (test).

The second thing to update is the string to search for.  For this example we use  (‘Haystack’).

 

As you can see in the result set it returns the relevant object information so you can take that information and  can go to the Galaxy and locate or 'find' any Object(s) and Script(s) containing that string.

 

clipboard_ed3eb059dca9a42fec8cda10979666864.png

 

 

Option 2:

 

  • Use a deep search utility to search object exports. This can be layouts, OMI apps, objects or any combination.

 

While the GRScript search utility is terrific at what it does, it does not search in any scripts contained / defined in OMI (for example layout scripts).

This is where using a deep search utilty like Agent Ransack, File locator Pro, File seek can come in handy.   

 

For this test a script comment was added to a layout called Root Layout in a Galaxy called OMI_USA_DEMO.

The object was  saved and checked it in.

'YetAnother Haystack.Needle d[-!-]b

clipboard_eefca8e334821c14d8888be32c13d9eda.png

 

OMI Apps which contain Layouts were then exported

 

clipboard_e1e526c90c3e6907a719507804659d74f.png

 

 

The OMI app .aapkg  was extracted with 7-zip (you can also update the extension to .zip manually and extract)

clipboard_e5b1b86b79713b40789cfe5c8fd2205d0.png

 

 

 

In the containing folder of an .aapkg is a File1.cab.  Again extract with 7-zip (you can also update the extension to .zip manually and extract)

clipboard_ecec123a93e23ecac6aaa5e26079d9089.png

 

For this test  FileLocator was used, which is the updated version of Agent Ransack.

To use simply specify the following: 

  • The folder to search in the 'Look in:' field (This is the file path to the extracted File1.cab)
  • The search term  in the 'Containint text:' field (haystack)

As you can see we get a hit.  Scripts are contained in numbered .txt files, you can right click the .txt file and select how you would like to open it. 

 

clipboard_ed08195a7459793b6faab25d427ce12a5.png

 

 

 

For these tests the  .txt file was opened in notepad. As you can see of the text that is not obfuscated you can pick out where this script is located. Remember the comment was defined in a layout called RootLayout and we searched an OMI applications export from a Galaxy called OMI_USA_DEMO.

 

clipboard_e71990eddb205ae626afd53b5f8e9ef61.png

 

 

Following the same procedure the same information can be gleaned from an export of all the layouts

 

clipboard_ed9e3e5171e1cffa85a207aa917f184ce.png

 

  In summary the SQL search utility is more convenient however it’s only limitation is that it doesn’t work on OMI containers such as layouts. While a deep file search is a bit more cumbersome  testing determined  that it worked in every scenario / export. 

 

Final things to be aware of :

 

  • Was this article helpful?