• Solutions
    • FERC XBRL Reporting
    • FDTA Financial Reporting
    • SEC Compliance
    • Windows Clipboard Management
    • Legato Scripting
  • Products
    • GoFiler Suite
    • XBRLworks
    • SEC Exhibit Explorer
    • SEC Extractor
    • Clipboard Scout
    • Legato
  • Education
    • Training
    • SEC and EDGAR Compliance
    • Legato Developers
  • Blog
  • Support
  • Skip to blog entries
  • Skip to archive page
  • Skip to right sidebar

Friday, November 18. 2016

Legato Developers Corner #10: Hooking Functions to Application Startup

So far in this blog, we’ve mentioned a couple of ways that Legato can improve or replace existing functionality and add new features entirely to GoFiler through the use of hooks that can happen pre- or post-process on a GoFiler function or by hooking a script to custom menu items. Now we’ll talk about a third method of enhancing GoFiler’s functionality.


The AddFrameInitializeFunction hook runs a script on application startup. This lets you customize what functions GoFiler runs automatically when it starts.


When GoFiler starts, it initializes and runs things in a very specific order. That initialization order is:

  1. Scripts added using AddFrameInitializeFunction
  2. Command Line Actions (second processing)
  3. News RSS Feed Run
  4. Crash File Recovery Process
  5. Dashboard Processing
  6. Error Report Upload Request
  7. User Account Control Edit
  8. Application “First Run” Actions

AddFrameInitializeFunction takes four parameters, only one of which is required. The function signature is (optional parameters are written in brackets):


int = AddFrameInitializeFunction ( [word order], string name,[string function], [parameters ...] );

The parameters are defined as:


order


An optional word that specifies the priority order of the script. This allows scripts/calls to be ordered in the manner in which they are executed. If omitted, the script is set to the bottom priority.


name


A string containing the name of the script to run. If name is empty, the script calling the AddFrameInitializeFunction is used. If a root path is not provided, the calling script’s path is used as a basis for the filename.


function


An optional string containing the name of the function in the script file to run. If omitted or empty, the default entry point is located and run.


parameters


Zero or more optional parameters to pass to the script. Variables cannot be passed by reference. When parameters are employed, the function parameter must be provided. However, it can be a simple "" empty string. Handles cannot be passed. The parameter string should be formatted like “variable1 : value1; variable2 : value2”.


This all sounds well and good, but what can you actually do with this? It’s a bit outside the scope of this post to provide the code for how these could be implemented, but in general terms I’ll talk about three ways you could use a function like this to perform powerful tasks and achieve different goals.


1. Authenticate Users


GoFiler can hold some sensitive information, like client names, CIKs, CCCs, etc., and can let a user file documents to the SEC. This data and functionality is definitely something you would want to protect from unauthorized access. The Collaboration functions in GoFiler can lock individual pieces of the application behind a password or Windows authentication, but what if you want to lock the entire application so that it cannot be run unless by an authorized user?


That’s where this type of hook can come it. To authenticate a user on application startup, you would want to write a script that asks for a username and password. It could do something simple like checking the provided username and password against something hard coded into the script (this wouldn’t be very secure, as someone could open the script file to see the password!) or something more complex. A more secure method of authenticating a user on startup would be to set up an ODBC connector to a database and use a SELECT statement to retrieve the user ID of someone with the same username and password. If no ID is returned, then the login failed. You could also use HTTPPost to POST the username and password to a website, which could handle authentication, and respond back if the user is valid or not.


You could execute any of these scripts when the application is run to authenticate a user. Anyone logging onto a workstation that can access GoFiler would then have to verify their identity before using the software to add an additional layer of security.


2. Automatically Update Templates


GoFiler supports a lot of user templates. For more information, see our previous blog post, Customizing GoFiler Through Templates. If you’re using these customizable templates, and have multiple installations of GoFiler in your environment, it can be difficult to make sure that all of your users are always using the most recent versions of the templates. You can automate the update process by having a Legato script run on application startup.


To do this, I would first suggest keeping all of your templates, along with a file called “version.ini” or something similar, in a Templates folder on a shared directory. On application startup, GoFiler could use the SDK function GetParameter to get the version number out of the INI file on the network and compare it to a version number it stores itself. If these two version numbers match, great, you’re done and the application starts as normal. Otherwise, the script would then copy all of the template files out of the Templates folder on the network drive using the CopyFile SDK function, which overwrites any files that have the same name in the target directory. If you wanted to get fancy, or you have a lot of template files, you could use the ProgressOpen SDK function to create a progress bar as it updates, so users will see that the application is doing something (copying files) instead of just taking a long time to start up.


3. Create Custom Wizards/Walk-Throughs


If you have a very specific workflow process at your organization, you can modify GoFiler to prompt the user for inputs and guide them through the process. For example, let’s say you have a user who only prepares Section 16 filings. When GoFiler starts up, you could have a dialog window automatically open, which would ask the user if they are creating a new Form 3, 4, or 5. It could then ask the user if they want to use an existing data file or start from scratch. The script could then automatically create a project file, create an XML data file, attach the data file to the project file, auto-fill in some fields, and generally just guide the user to where you want them to be. It could automate saving/creating files and folders. These are all things users can do themselves but actively guiding the user through the steps of a process reduces training time, removes a lot of ambiguity in how the software works, and streamlines your workflow.


This idea could be adapted to pretty much anything; the UI on startup could ask the user what task they are doing and then run them through a predefined wizard for each and every task the user does.


These are just a couple of examples as to how you can use the AddFrameInitializeFunction SDK function to customize GoFiler on startup. You can do a lot more with this, from changing the name of the application (if you want to call it My Fancy SEC Software instead of GoFiler Complete, you can absolutely do that with this hook combined with the SetApplicationName function) to pulling data from databases and setting up a customized user environment at the start of each session. The end goal here is to allow you to customize the application to suit your company’s needs, and this function is a great place to start.


 


 




Steven Horowitz has been working for Novaworks for over five years as a technical expert with a focus on EDGAR HTML and XBRL. Since the creation of the Legato language in 2015, Steven has been developing scripts to improve the GoFiler user experience. He is currently working toward a Bachelor of Sciences in Software Engineering at RIT and MCC.

 


Additional Resources

Novaworks’ Legato Resources

Legato Script Developers LinkedIn Group

Primer: An Introduction to Legato 

Posted by
Steven Horowitz
in Development at 11:56
Trackbacks
Trackback specific URI for this entry

No Trackbacks

Comments
Display comments as (Linear | Threaded)
No comments
Add Comment
Enclosing asterisks marks text as bold (*word*), underscore are made via _word_.
Standard emoticons like :-) and ;-) are converted to images.
E-Mail addresses will not be displayed and will only be used for E-Mail notifications.

To prevent automated Bots from commentspamming, please enter the string you see in the image below in the appropriate input box. Your comment will only be submitted if the strings match. Please ensure that your browser supports and accepts cookies, or your comment cannot be verified correctly.
CAPTCHA

 
   
 

Quicksearch

Categories

  • XML Accounting
  • XML AICPA News
  • XML FASB News
  • XML GASB News
  • XML IASB News
  • XML Development
  • XML Events
  • XML FERC
  • XML eForms News
  • XML FERC Filing Help
  • XML Filing Technology
  • XML Information Technology
  • XML Investor Education
  • XML MSRB
  • XML EMMA News
  • XML FDTA
  • XML MSRB Filing Help
  • XML Novaworks News
  • XML GoFiler Online Updates
  • XML GoFiler Updates
  • XML XBRLworks Updates
  • XML SEC
  • XML Corporation Finance
  • XML DERA
  • XML EDGAR News
  • XML Investment Management
  • XML SEC Filing Help
  • XML XBRL
  • XML Data Quality Committee
  • XML GRIP Taxonomy
  • XML IFRS Taxonomy
  • XML US GAAP Taxonomy

Calendar

Back May '25 Forward
Mo Tu We Th Fr Sa Su
Monday, May 19. 2025
      1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31  

Feeds

  • XML
Sign Up Now
Get SEC news articles and blog posts delivered monthly to your inbox!
Based on the s9y Bulletproof template framework

Compliance

  • FERC
  • EDGAR
  • EMMA

Software

  • GoFiler Suite
  • SEC Exhibit Explorer
  • SEC Extractor
  • XBRLworks
  • Legato Scripting

Company

  • About Novaworks
  • News
  • Site Map
  • Support

Follow Us:

  • LinkedIn
  • YouTube
  • RSS
  • Newsletter
  • © 2024 Novaworks, LLC
  • Privacy
  • Terms of Use
  • Trademarks and Patents
  • Contact Us