• on windows platform, [clipboard get] and [selection get -selection CLIP

    From luocl@21:1/5 to All on Fri Apr 8 08:42:02 2022
    call the below tcl script selectit.tcl, when running selectit, selectit
    can collect your continuous clipboard string content to a file and the
    stdout. on linux, everything is ok, but on windows platform, [clipboard
    get] and [selection get -selection CLIPBOARD] throw exceptions:

    clipboard cannot be opened, another application grabbed it
    clipboard cannot be opened, another application grabbed it
    while executing
    "selection get -selection $::selection"
    (procedure "selectget" line 2)
    invoked from within
    "selectget"


    clipboard cannot be opened, another application grabbed it
    clipboard cannot be opened, another application grabbed it
    while executing
    "clipboard get"
    (procedure "selectget" line 2)
    invoked from within
    "selectget"



    #the tcl script
    package require Tk
    wm withdraw .

    set selection CLIPBOARD
    set selection PRIMARY
    if {$tcl_platform(platform) ne {unix}} {
    set selection CLIPBOARD
    }
    proc register {} {
    selection own -command selectget -selection $::selection .
    }
    proc selectget {} {
    set clip [clipboard get]
    set clip [selection get -selection $::selection]
    puts $::chan $clip
    flush $::chan
    if {$::chan ne {stdout}} {
    puts $clip
    }
    register
    }
    puts selection:<$selection>
    set chan stdout
    lassign $argv fn
    puts fn:<$fn>
    if {$fn ne {}} {
    set chan [open $fn a]
    puts chan:<$chan>
    }

    register

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Andreas Leitgeb@21:1/5 to luocl on Fri Apr 8 08:00:22 2022
    luocl <vimperatorluo@qq.com> wrote:
    clipboard cannot be opened, another application grabbed it

    Some other program seems to have its hand on the clipboard.

    That doesn't seem like a general Windows problem, but rather a
    problem with that other task on your machine that reserved the
    clipboard for itself.

    If it isn't just some other instance of the tcl interpreter
    blocked in a debugging session or some security tool trying
    to protect *you* from that application "spying" on the clipboard,
    then it might as well be a virus...

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Harald Oehlmann@21:1/5 to All on Fri Apr 8 11:04:42 2022
    Am 08.04.2022 um 02:42 schrieb luocl:
    call the below tcl script selectit.tcl, when running selectit, selectit
    can collect your continuous clipboard string content to a file and the stdout. on linux, everything is ok, but on windows platform, [clipboard
    get] and  [selection get -selection CLIPBOARD] throw exceptions:

    clipboard cannot be opened, another application grabbed it
    clipboard cannot be opened, another application grabbed it
        while executing
    "selection get -selection $::selection"
        (procedure "selectget" line 2)
        invoked from within
    "selectget"

    Yes, that is known and outside of Tk.
    You should be happy, that you get the error message. For example, the
    Windows calculator crashes, when this issue arises.

    You have an application which holds the clipboard open.
    In my case, an application doing this is "UltraVNC Viewer". If this is
    running, you get the error.

    So check, which application is open and holds the clipboard.

    Take care,
    Harald

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From luocl@21:1/5 to Harald Oehlmann on Mon Apr 11 17:19:12 2022
    On 4/8/22 5:04 PM, Harald Oehlmann wrote:
    You have an application which holds the clipboard open.
    In my case, an application doing this is "UltraVNC Viewer". If this is running, you get the error.

    So check, which application is open and holds the clipboard.

    Take care,
    Harald

    I know selectit don't have the owner of clipboard, because this is the
    way selectit judge the clipboard have new content, then selectit get the
    string content and claim selectit have the owner of clipboard, if
    another application copy to clipboard, then selectit lose the owner of clipboard, then another loop.

    Running firefox, then I copy some string to clipboard, then I manually
    run wish, and manually run [clipboard get ] or [selection get -selection CLIPBOARD], successfully. so before [clipbaord get] or [selection get] I
    add [after 300]. selectit just work as I designed.

    Any way, Thank you all!!! finally I solve this issue.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)