VBA to Load Key-in Command

I wanted to setup and F Key, which I do know how to do. Only I wanted one to load the Key-in. I know the Utilities, pull down and the top item is Key-in When I use that it is fine and the courser is blinking on the line to put in a command. Tried to show example. When I made a simple VBA to open this window the courser is not blinking. you have to use the mouse to move up and click in the space to type??

 

Simple VBA:

Sub KeyInOpen()
' 110513 - New Test on key-in
'   Start a command
    CadInputQueue.SendCommand "DIALOG CMDBROWSE"

'   Send a keyin that can be a command string
    CadInputQueue.SendKeyin " "                           ' I tried it with this line and w/o it will not seem to effect where the courser goes.

End Sub

 

Example of already set F Keys

Someone out there give me a little help. I did do some searches in the help files, but did not get one on this to come up?

 

 

 

  • Driving the MicroStation interface is not highly recommended for programming when using the MicroStation APIs and should only be used as a last resort work-around to missing functionality.  Could you let us know a little bit more about your end goal since there may be a better or another way to accomplish the task?



  • under help look at action strings you want the

    Unterminated Key-in

    K,<key-in>

    Keys in an unterminated string of characters and waits for you to finish the string.

    lots more useful stuff there for F keys too.... I love  long keyin scripts joined by ; %d;

    Can make a F key extremely powerful tool... even to launch vba or basic macro... quicker the pull down menus or typing scripts.. I even use the mouse menu to assign print script to make a pdf with button 5 and data point ...

    Lorys

    Started msnt work 1990 - Retired  Nov 2022 ( oh boy am I old )

    But was long time user V8iss10 (8.11.09.919) dabbler CE  update 16 (10.16.00.80) 

    MicroStation user since 1990 Melbourne Australia.
    click link to PM me 

  • Sure, I have a Tool Bar I made and I added  a button to run the key-in command In the upper left corner under the L1 is the command button to open the Key-in box, do you want to see the commands that go with the button?

     

     

    RJB Phillips III - Praise the Lord for His Mercy and Grace

  • I saw the comment on the Key-in I am familiar with the ; semi between commands. I have been using the @C:\scripts\(name.txt) and it works great, but what is the %d all about? I also got the great tip where I add in the  extra command ;m,ms  Information goes in center section at bottom.

    ShowStatus "Status = " & MyMessage was another great tip from someone, it works in the VBA

    RJB Phillips III - Praise the Lord for His Mercy and Grace

  • RJB said:

    what is the %d all about?

    %d is a "reserved directive" that tells MicroStation's input queue to pause until a data point is pressed. It can be used in instances like this:

    place fence block;%d;%d;active color 0

    MicroStation sees 'place fence block' and then pauses. User enters one data point, then the next, and THEN the active color is set to 0.

     

      

    Answer Verified By: RJB 

  • Hi RJB,

    back to your original question: There are two different key-ins that can be used to open key-on dialog:

    • inputmanager cmdbrowse that is assigned to F9 by default and it opens key-in dialog temporarily to enter one command
    • inputmanager cmdbrowse [on | off | popup | toggle] that opens permanent key-in dialog.

    I tried both key-ins and keyboard focus was always set correctly to opened key-in dialog regardless I assign the commands to a function key or an icon.

    BTW how the command is related to VBA you used in your original post? I see no reason to open key-on from VBA code.

    With regards,

      Jan

    Answer Verified By: RJB 

  • Great reply Jan, I did not realize there was an Fkey for the KeyIn command. Is there already one for Datafields as well. I do not like the Ctrl B and picking through. I made a short macro, but it only brings the grid, I like the Toggle method, which you cannot have in a single macro button unless someone knows how to do a toggle. I used to write a number to a file and then check the number it 1 then I would go to an off statement, but Basic, Basica and this VBA is very different to me. I do appreciate you knowledgeable folks helping some like me. My Name is Richard John.... so I started in Military with the R.J.B. or just the RJB thanks again.

    RJB Phillips III - Praise the Lord for His Mercy and Grace

  • There's a non-programming way to do this as well.  If MicroStation's Input Focus is "Home" hitting the Enter key will activate the Key-in Window.  A new Key-in window will appear with the active cursor or if the Key-in window is docked the active cursor will be in the docked Key-in window.

    Either the ESC key sets MicroStation to Home or the out of the box Function key F12 or the command "inputmanager home"

    There's an icon in the lower left of the Status bar that shows which "focus" is active, just hover over the icons and a tool tip will describe each one.  When MicroStation's Input Focus is Home the icon is a House.

    Search in MicroStation's Help using "focus", it will describe how it works.