WinClip.Snap(clipData) lost, when saving clipData to an array

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
autocart
Posts: 214
Joined: 12 May 2014, 07:42

WinClip.Snap(clipData) lost, when saving clipData to an array

20 Jun 2019, 04:06

Hi all,

this question is connected to this WinClip thread/lib: https://www.autohotkey.com/boards/viewtopic.php?f=6&t=29314

This is weired: If I store the clipboard data retrieved with WinClip.Snap(clipData) into an associative (or simple) array, then when I want to restore it, the clipboard is empty afterwards. If I use a normal variable to store the retrieved data (instead of the array), the clipboard gets restored as expected.

Here is some sample code. (To test, please download the library from the linked thread.) To compare, make sure that before each try there is some text on the clipboard. Try the code and then toggle the commenting out (";~") of the last two lines, copy some text onto the clipboard again, and try the code again.

Code: Select all

#Include WinClipAPI.ahk
#Include WinClip.ahk

arr := Object()
WinClip.Snap(clipData)
arr.clipOrg := clipData
clipRestore := arr.clipOrg
;~ WinClip.Restore(clipRestore)
WinClip.Restore(clipData)
Does anybody have an idea why this does not work with an array?

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Bing [Bot] and 397 guests