Hey, the "put true into tSame" line needs to be above the "repeat for reach key tKey in tClipA" line. DOH.
On Wed, May 27, 2015 at 8:12 PM, Mike Bonner <bonnm...@gmail.com> wrote: > Skip, > > Here is a simple but working example of a clipboard listener. > To test I just placed the code in a button so that I could easily toggle > it on and off. > Its an very quick draft, but hey. It works. > > > ################# > > local sRunning,sLastClipA > > -- mouseup toggles the loop on and off > on mouseUp > if sRunning is empty then put false into sRunning > put not sRunning into sRunning > clipCheck > end mouseUp > > command clipcheck > -- if sRunning is toggled to false, the loop stops. > if sRunning then > put the keys of the clipboarddata into keyList > repeat for each line tKey in keyList > -- bulid an array for comparison > -- I couldn't get it to work using the keys directly so > -- created a keyList instead > put the clipboarddata[tKey] into tClipA[tKey] > end repeat > if sLastClipA is empty then > -- on runstart put the first contents of the clipboard into > sLastClipA > put tClipA into sLastClipA > else > repeat for each key tKey in tClipA > put true into tSame > -- do the comparison. Any thing that differs toggles tSame > if tClipA[tKey] is not sLastClipA[tKey] then put false into > tSame > end repeat > end if > if not tSame then > -- Here is where you could do something with sLastClipA before > -- replacing its contents with the new clipboard contents > put tClipA into sLastClipA > > -- this is just here to show the keys and seconds > -- whenever the clipboard changes Comment or remove > put the keys of sLastClipA && the seconds > end if > -- 100 millisec works well enough > send "clipCheck" to me in 100 millisec > > end if > end clipcheck > > > On Wed, May 27, 2015 at 11:50 AM, Mike Bonner <bonnm...@gmail.com> wrote: > >> The code I posted still would not have worked as it was. To do the >> comparison and see if there is a change, you would indeed have to cycle >> through the keys and look for the difference. There are definitely some >> quirks involved here. Headed out the door, but it might be fun to mess with >> the clipboard monitoring idea when i get back home. >> >> On Wed, May 27, 2015 at 11:35 AM, J. Landman Gay < >> jac...@hyperactivesw.com> wrote: >> >>> No, you're right. I just posted a correction and then saw this reply. >>> >>> When testing, "is an array" returns false on the retrieved content, but >>> when asking for each key type the values are still there. That must be why >>> the dictionary calls it a "false array". >>> >>> >>> On 5/27/2015 12:31 PM, Mike Bonner wrote: >>> >>>> Ah k, thx! Sorry for steering you slightly wrong skip. The basic >>>> premise >>>> should still work, but you'll have to jump through the extra hoops of >>>> checking the keys each time through. Should still be plenty fast. (game >>>> loops do the same thing, and do considerably more than what you're >>>> looking >>>> at while still retaining enough speed.) >>>> >>>> On Wed, May 27, 2015 at 11:14 AM, J. Landman Gay < >>>> jac...@hyperactivesw.com> >>>> wrote: >>>> >>>> You'll have to walk through all the keys when both retrieving and >>>>> setting >>>>> the array. The default when getting or setting the clipboarddata >>>>> without >>>>> specifying a key is to return only the plain text. The array is lost. >>>>> >>>>> On 5/26/2015 9:58 PM, Magicgate Software - Skip Kimpel wrote: >>>>> >>>>> Oooo... I will try that tomorrow! >>>>>> >>>>>> Is there any way to save an alt+f keystroke to the clipboard data? I >>>>>> am >>>>>> trying to automate some tasks during this entire exercise and this is >>>>>> also >>>>>> one of my hurdles. >>>>>> >>>>>> Thanks again, >>>>>> >>>>>> SKIP >>>>>> >>>>>> On Tue, May 26, 2015 at 5:59 PM, Mike Bonner <bonnm...@gmail.com> >>>>>> wrote: >>>>>> >>>>>> One way would be to use a send in time loop. Check to see if the >>>>>> data in >>>>>> >>>>>>> the clipboard array is different, if so, act. Some untested quick >>>>>>> and >>>>>>> dirty code follows. >>>>>>> >>>>>>> command checkClipboard >>>>>>> if sLastClipA is empty then >>>>>>> put the clipboarddata into sLastClipA >>>>>>> -- do something with the data in sLastClipA >>>>>>> else >>>>>>> repeat for each key tKey in the clipboarddata >>>>>>> -- check the data in the keys here, against the keys you saved in >>>>>>> sLastClipA >>>>>>> -- if there is a change, do something with the data in the >>>>>>> clipboarddata >>>>>>> end if >>>>>>> put the clipboarddata into sLastClipA >>>>>>> >>>>>>> send "checkClipboard" to me in 100 millisec >>>>>>> end checkClipboard >>>>>>> >>>>>>> >>>>>> >>>>> -- >>>>> Jacqueline Landman Gay | jac...@hyperactivesw.com >>>>> HyperActive Software | http://www.hyperactivesw.com >>>>> >>>>> >>>>> _______________________________________________ >>>>> use-livecode mailing list >>>>> use-livecode@lists.runrev.com >>>>> Please visit this url to subscribe, unsubscribe and manage your >>>>> subscription preferences: >>>>> http://lists.runrev.com/mailman/listinfo/use-livecode >>>>> >>>>> _______________________________________________ >>>> use-livecode mailing list >>>> use-livecode@lists.runrev.com >>>> Please visit this url to subscribe, unsubscribe and manage your >>>> subscription preferences: >>>> http://lists.runrev.com/mailman/listinfo/use-livecode >>>> >>>> >>> >>> -- >>> Jacqueline Landman Gay | jac...@hyperactivesw.com >>> HyperActive Software | http://www.hyperactivesw.com >>> >>> _______________________________________________ >>> use-livecode mailing list >>> use-livecode@lists.runrev.com >>> Please visit this url to subscribe, unsubscribe and manage your >>> subscription preferences: >>> http://lists.runrev.com/mailman/listinfo/use-livecode >>> >> >> > _______________________________________________ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode