Quick Tip: Changing Dexterity Script Debugger Context

David Meego - Click for blog homepageThis post is the first of a new style of blog post.  The idea is to publish the response to a question that I have been asked as a "Quick Tip" so that others can benefit from the information.  Over time we should end up with a few real gems of information... You never know, I could present 50 of them in a 50 minute session at a conference.... No wait ... Mark already did that.

How can I change the Script Debugger Context to work on my dictionary?

The Dexterity Script Debugger is enabled using the ScriptDebugger=TRUE Dex.ini setting.  Once Microsoft Dynamics GP is restarted, the Debug menu will be displayed.  By default the Script Debugger runs in the context of the core Dynamics.dic (Product 0). This means when selecting scripts using the Open Script window, it will show the resources and scripts from the Dynamics.dic dictionary (assuming the dictionary was compiled with the Compile with Debug Information enabled and includes source code).

  • To change the default product context you can add the ScriptDebuggerProduct=XXX Dex.ini setting, where XXX is the product or dictionary ID of the addon product.  Most of the time this is all that is needed.
     
  • To change the context programmatically from sanScript, you can use the system call system 5737, XXX;   The Resource Explorer window (found in Field Level Security as well as the Support Debugging Tool) uses this system call to change the context of the Open Script dialog (from the Dex.dic) which it uses to help it explore the dictionary resources.  This could leave the context pointing at an incorrect dictionary. 
     
    Note: The later builds of the Support Debugging Tool reset the context back to the value of the ScriptDebuggerProduct Dex.ini setting when the code has finished using the Open Script dialog.  If the Support Debugging Tool is installed, you code also use the Runtime Execute window to run a script with the system call in it.
     
  • Another method of changing the context is to use Ctrl-F1 to activate the Script Debugger Selection mode.  The cursor will change and when you click on a field or window, the context will be changed to the product that window resides in and the Open Script window will open to the selected resource.  This is really useful when debugging multiple "cross dictionary" addons and you need to swap context to see what is happening.
     
    Note: Press Esc to turn off the selection mode.
     
  • Now, what happens if I want to use the Ctrl-F1 method and I am running in a Citrix environment where the Ctrl-F1 key combination has another use? Well, there is one more trick you can use.  Select Debug >> Script Debugger from the menus while holding down the Shift key. This will enable the selection mode in the same way as Ctrl-F1 does and open the Script Debugger.
     
  • An extra tip while we are on the topic. The Shift-Ctrl-F1 key combination will also open the Open Script window, but instead of opening the Script Debugger when a selection is made it will go straight to the Script Editor window.
     
  • Following on with the theme.  If you select Debug >> Open Script from the menus while holding down the Shift key, you can open the Open Script window which will go to the Script Editor window when a selection is made.

I hope you find this Quick Tip handy. 

David