Copy to/from clipboard

I have an routine to copy text to or from clipboard via autlisp. It worked fine up to V22.

Now we upgraded to V26 and it doesn't run anymore.

At the codeline

(vlax-get (vlax-create-object "htmlfile") 'ParentWindow)

I get an error

----- Error around expression -----

'PARENTWINDOW

error : Unknown Error in Lisp or CAD system or 'Stack Overflow'

Is ParentWindow actually not yet implementet or do i need a different approach to access the clipboard under V26 ?

Mathias

Comments

  • Use Windows Clipboard Manager (Windows Key & V) as an alternative?

  • In my opinion, the easiest way is to use function ‘dos_clipboard’ from DosLib library, free to use from McNeel. This library contains a lot of other useful functions. DosLib is not developed any more, but still is available to most of Bricscad, Autocad or ZwCad versions (if for other AC clones I do not now).

    See also:

  • Quite a few DOSlib functions are available with BricsCAD lisp by default. doc_clipboard is one of these.

    https://developer.bricsys.com/bricscad/help/en_US/CurVer/DevRef/source/doc_clipboard.htm

  • it's being obviously misspelled in BC's doc - it is doS_clipboard… :)

  • ALANH
    edited December 5

    What about the Copyclip command also Pasteclip. Using V25.

  • Roumen
    edited December 5

    the OP obviously means windows' clipboard; the old trick is not suported in v26
    (vlax-create-object "htmlfile")) 'ParentWindow)

    this is perfect, works for v25 too:

    dos_clipboard


    (dos_clipboard  [string])

    Returns the current system clipboard text content or copies the specified.string to the system clipboard.

    string : if specified, the string to be copied to the system clipboard

    Returns the string if successful (when saving to clipboard, and when the text is properly retrieved from the clipboard);
    returns NIL in case of any error

    Examples :

    (dos_clipboard "My Sample Text")     saves the text to the clipboard
    (dos_clipboard)     returns "My Sample Text"

  • Roumen
    edited December 5

    another one of dos_ family I find quite useful : dos_popupmenu


    (dos_popupmenu  menuitems  [itemmodes])

    Shows a popup menu at actual cursor (mouse) position on screen. The user can dismiss the menu by ESCAPE key or clicking anywhere outside the menu.

    menuitems : list of strings, specifying the menu item labels; an empty string "" creates a separator item

    itemmodes : optional argument; list of integers specifying the item state for each menu item
    0 enabled
    1 disabled
    2 checked, enabled
    3 checked, disabled

    each menu item defaults to state 0 (enabled, not checked)

    Return : the index of selected item, or NIL on error or escaped menu;
    Note : separator items do not count for the item indices !

    Examples :

    (setq items '("Select" "" "First Entity" "Second Entity"))

    (setq modes '(0 0 3 0))


  • Thanks for all your suggestions. After upgrading to 26.1.06 it's working again.

    Mathias