Results 1 to 4 of 4
  1. Default Script debugging

    Hi,

    I am used to stepping through C++ and C# code in Visual Studio to see what is happening. I have tried several things: Attach ACP to Visual Studio Debugger, turn on debugging switches in ACP Preferences to get to the debugger when something chokes, MS7.exe, PrimalScript, etc.

    So far I see no way to set breakpoints and step through a script while it is running under control of ACP. I do not see how to use the ACP "host" process independently of the "console".

    Surely you guys are not debugging this stuff through the seat-of-your-pants. :-)

    How do I set up a proper debugging environment with breakpoints and stepping active?

    So far my 47 continuous years of scientific software development has not helped much here... :-)

    Thanks,

    Howard

  2. #2
    Join Date
    Oct 2005
    Location
    Mesa, AZ
    Posts
    30,904

    Default

    Visual Studio what? The full editions have script debugging built in and will simply catch errors. You'll see a Just in Time debugging popup. You do need to enable debugging in ACP (Preferences, Debugging tab). But I would first test the basic debugging capabilities of your Visual Studio version. Express does not do this. Office 2007 has a debugger that is marginally usable (no immediate window) and Office 2003 has a great debugger. For info on these see ACP Help, Scripting Guide.

    In the attached I picked Visual Studio 2008, not the Microsoft Script Editor that is hilited in the first image.

    To test debugging outside of ACP write a script consisting of

    debugger;

    Save as test.js. Then open a 32-bit command window(!! 64-bit systems are a pain !!) via c:\windows\syswow64\cmd.exe (yes the 32-bit sysdir is called syswow64) and type

    C:\whatever\> cscript //D test.js

    That should cause the debugger to be invoked.
    Attached Images Attached Images
    -- Bob

  3. Default

    Hi Bob, Thanks.

    I am an MSDN subscriber ("VS Prem w/MSDN intl DVD"). Currently have VS 2005, VS 2008, and VS 2010 installed. Have been using VS 2008 for all of my work on products I am selling at AZcendant.com and for work on Orion HandyAvi Special Edition. I primarily write in VC++ but have also had to write VC# to support licensing subsystems at handyavi.com. (I have a background with a wide variety of other languages including assembly languages such as TAC for the Philco 2000 and 6502 assembly language and of course Fortran, C, C++, PL/1, Jovial... Have written many programs using each of these...)

    I started an Administrator CMD window, changed directory to C:\Program Files\ACP Obs Control\Scripts and entered cScript //D acquireimages.js and immediately got "Prefs" undefined error. Easily entered the debugger and it showed the code and this line: var InitPUDone = !Prefs.PointingUpdates.Enabled;

    I would like to step through that code, use breakpoints, etc., just as I do in my programs that I write in VC++ and VC#. I see by using "Set Next Statement" to the line before the error line that I can set breakpoints and use them. So we are close. But I don't see how to simply start the .js program from within the debugger and step through starting with the first line. I don't want to have to enter the debugger only after an error occurs. I want to see what the program does line-by-line by stepping through it as it executes.

    I.e., I don't yet see how to open VS 2008 and directly open up a .js file for debugging or a .vbs file for debugging or a .wsc file for debugging IN THE CONTEXT of ACP.

    Acquireimages.js is not of course my focus. I just thought if I could make that work then I might be on track...

    What I really want to do is modify UserActions.wsc and debug it using stepping and breakpoints.

    The clue you provided, "cscript" helps. I will research further to see how to get debugging to work on these scripts.

    Thanks for your help Bob.

    Howard

  4. #4
    Join Date
    Oct 2005
    Location
    Mesa, AZ
    Posts
    30,904

    Default

    I started an Administrator CMD window, changed directory to C:\Program Files\ACP Obs Control\Scripts and entered cScript //D acquireimages.js and immediately got "Prefs" undefined error. Easily entered the debugger and it showed the code and this line: var InitPUDone = !Prefs.PointingUpdates.Enabled;
    Right, that script is designed to be run in ACP's script host, which populates its namespace with ACP's intrinsic objects. You cannot run ACP scripts under the Windows script host. I advised you to use cscript only to check out whether you could get to the debugger in a way that excluded ACP and the possibilities that it has bugs that prevent it from working with debuggers (it doesn't :-)).

    Now that you know you have a script debugger that works, do all of your work in ACP. For starters, all ACP scripts have a function main() that is called. So:

    Code:
    function main()
    {
        Console.PrintLine("Hello Howard");
        debugger;
        if(Telescope.Connected)
            Console.PrintLine(Telescope.RightAscension);
        else
            Console.PrintLine("Connect the scope please>");
    }
    Run this in ACP, not with cscript.
    -- Bob

 

 

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Active X script error in script with FocusMax
    By Paul Burke in forum FocusMax and PoleAlignMax Questions
    Replies: 1
    Last Post: Oct 30, 2013, 00:30

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •