• twapi clipboard

    From Manfred Stelzhammer@21:1/5 to All on Fri Jul 21 15:05:08 2023
    Hi

    1. try:
    I copy a file (.pdf) from Outlook.
    I past this file to the filesystem.
    Everything is ok.


    2. try:
    I copy a file (.pdf) from Outlook.

    Now I run this small script.

    ## script start
    package require twapi

    proc test10 {} {
    twapi::open_clipboard
    foreach format [list 49342 49341 49365 49268] {
    set data($format) [twapi::read_clipboard $format]
    }
    twapi::close_clipboard
    twapi::open_clipboard
    twapi::empty_clipboard
    foreach format [array names data] {
    twapi::write_clipboard $format [set data($format)]
    }
    twapi::close_clipboard
    }

    test10

    ### script end

    In my opinion it should possible to paste this file to the filesystem,
    because in both cases the clipboard should have the same contents.


    But it doesn't, why?


    Regards

    Manfred

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Ashok@21:1/5 to Manfred Stelzhammer on Fri Jul 21 23:03:35 2023
    I'm not sure what all those numbers you are using are. The following
    works for me

    (Ctrl-C file from Explorer), then
    % set data [read_clipboard 15]; # 15 -> CF_HDROP
    % close_clipboard
    (copy something else to the clipboard to make sure the original file is
    not persisted)
    % open_clipboard
    % empty_clipboard
    % write_clipboard 15 $data
    % close_clipboard
    (Paste to some other directory in Explorer)

    That works for me.

    /Ashok



    On 7/21/2023 6:35 PM, Manfred Stelzhammer wrote:
    Hi

    1. try:
    I copy a file (.pdf) from Outlook.
    I past this file to the filesystem.
    Everything is ok.


    2. try:
    I copy a file (.pdf) from Outlook.

    Now I run this small script.

    ## script start
    package require twapi

    proc test10 {} {
        twapi::open_clipboard
        foreach format [list  49342 49341 49365 49268] {
            set data($format) [twapi::read_clipboard $format]
        }
        twapi::close_clipboard
        twapi::open_clipboard
        twapi::empty_clipboard
        foreach format [array names data] {
            twapi::write_clipboard $format [set data($format)]
        }
        twapi::close_clipboard
    }

    test10

    ### script end

    In my opinion it should possible to paste this file to the filesystem, because in both cases the clipboard should have the same contents.


    But it doesn't, why?


    Regards

    Manfred



    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Manfred Stelzhammer@21:1/5 to All on Fri Jul 21 21:21:47 2023
    Hi

    I'll not copy from one directory to another.
    I'll copy from a attachment (pdf file) from my application to a directory.
    (for testing I try it with an attachment from outlook).


    Regards

    Manfred



    Am 21.07.23 um 19:33 schrieb Ashok:
    I'm not sure what all those numbers you are using are. The following
    works for me

    (Ctrl-C file from Explorer), then
    % set data [read_clipboard 15]; # 15 -> CF_HDROP
    % close_clipboard
    (copy something else to the clipboard to make sure the original file is
    not persisted)
    % open_clipboard
    % empty_clipboard
    % write_clipboard 15 $data
    % close_clipboard
    (Paste to some other directory in Explorer)

    That works for me.

    /Ashok



    On 7/21/2023 6:35 PM, Manfred Stelzhammer wrote:
    Hi

    1. try:
    I copy a file (.pdf) from Outlook.
    I past this file to the filesystem.
    Everything is ok.


    2. try:
    I copy a file (.pdf) from Outlook.

    Now I run this small script.

    ## script start
    package require twapi

    proc test10 {} {
         twapi::open_clipboard
         foreach format [list  49342 49341 49365 49268] {
             set data($format) [twapi::read_clipboard $format]
         }
         twapi::close_clipboard
         twapi::open_clipboard
         twapi::empty_clipboard
         foreach format [array names data] {
             twapi::write_clipboard $format [set data($format)]
         }
         twapi::close_clipboard
    }

    test10

    ### script end

    In my opinion it should possible to paste this file to the filesystem,
    because in both cases the clipboard should have the same contents.


    But it doesn't, why?


    Regards

    Manfred




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