Capture Keystrokes

Discussion in 'AutoCAD' started by MickyV, Jan 19, 2005.

  1. MickyV

    MickyV Guest

    I want to make a command to make it easier to create script files.

    The idea is to click a start button in a modeless form, and from then on grab each key as it's pressed until a stop button is pressed, so that I can then save it to a *.scr file to run on multiple drawings.

    Now, seeing there's no KeyPress event for AutoCAD, does anyone know of a way to do this?

    Using the Begin/EndCommand events gives me the commands, but doesn't give me the options that may have been set from within the command.

    Thanks,
    Mick.
     
    MickyV, Jan 19, 2005
    #1
  2. Hi Mick,

    Search back through the NGs with Google. There was a program to do this
    posted some years ago.

    --

    Regards,


    Laurie Comerford
    www.cadapps.com.au
     
    Laurie Comerford, Jan 19, 2005
    #2
  3. MickyV

    MickyV Guest

    Laurie,

    I did find a Macro Recorder posted by Joe Sutphin, but this appears (at least to me - please correct me if I'm wrong) to only work with adding objects. While the same tact could be taken for modifying existing objects, it would mean going through every object type and creating a template for both adding and modifying each of them.

    I want to make a program that will allow the user to do anything that he/she could have done through the AutoCAD command line, not limit them to the commands/objects that I have already set up, hence the desire to find a way to capture keystrokes.
     
    MickyV, Jan 19, 2005
    #3
  4. Hi Micky,

    I have never used it. However, if it creates code, then you can use that as
    sample code and edit as you require.

    If you have ever used the Macro recorder in any of the MS Office software,
    you will know what I mean.

    --

    Regards,


    Laurie Comerford
    www.cadapps.com.au
     
    Laurie Comerford, Jan 19, 2005
    #4
  5. MickyV

    Ed Jobe Guest

    Since you already have a form, try this.
    Add a textbox control and set its Multiline property to True.
    Change the Stop button to a Save button and save the text to a txt file with
    a *.scr extension.
    Here's another method I use with a script manager program I wrote. I just
    shell to Notepad. I have a listbox with filenames. If the user selects one
    and clicks on edit, it opens the script in Notepad. If they click on the New
    button, it prompts for a filename and starts Notepad with the new file. So
    by putting them in the text editor, I don't have to capture keystrokes or
    copy from a temp editor to the permanent one.
     
    Ed Jobe, Jan 19, 2005
    #5
  6. Nathan Taylor, Jan 19, 2005
    #6
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.