Re: Speed up a slow loop

2022-03-03 Thread Ken Ray via use-livecode
BTW you an also use this "split" trick to remove dupes (although you lose the order of the word list): function stripDupes pWordList split pWordList by cr and tab return (the keys of pWordList) end stripDupes on mouseUp put stripDupes("test" & cr & "ball" & cr & "test" & cr & "orange")

Re: Speed up a slow loop

2022-03-03 Thread Ken Ray via use-livecode
Jacque, How about using the 'difference' command? Here's a simple example: on mouseUp put "true" into tDict["test"] put "true" into tDict["word"] put "true" into tDict["ball"] put "test" & cr & "ball" & cr & "boat" & cr & "unicorn" into tUserWords split tUserWords by cr and

Re: lineOffset wildcard

2021-04-19 Thread Ken Ray via use-livecode
> On Apr 19, 2021, at 1:47 PM, Mark Wieder via use-livecode > wrote: > > On 4/19/21 11:04 AM, J. Landman Gay via use-livecode wrote: > >> I don't think lineoffset supports wildcards, but you could do it with >> matchChunk. > > Ah! matchChunk and the the number of lines of... etc... > That

Re: We don't need a Player (was Re: New(?) Idea for Standalones)

2021-04-13 Thread Ken Ray via use-livecode
> On Apr 13, 2021, at 5:28 AM, Andre Garzia via use-livecode > wrote: > > I like all that I read here. There are things that are really hard when > building standalone apps that I don’t think should be handled by LC HQ, such > as “adding AppleScript dictionary” to your app. This is harder

Re: sort container parameters

2021-03-03 Thread Ken Ray via use-livecode
Craig, It's because when you try to sort something, it's got to be a variable that's being sorted. So all of the examples you used put "toSort" into the statement to be "done" coming out compiled as: sort items of "A,C,T,B" ascending ... which won't work. You need to execute: do

Re: "within graphic" question

2021-02-22 Thread Ken Ray via use-livecode
If you're willing to do something "hackish", you could do this: on mouseDown lock screen show grc "mygraphic" put within(grc "mygraphic",the clickloc) hide grc "mygraphic" unlock screen end mouseDown :D Ken > On Feb 22, 2021, at 1:49 PM, jbv via use-livecode > wrote: > > Hi list,

Re: How to find the offset of the first character in a string that's not a tab?

2021-01-22 Thread Ken Ray via use-livecode
> On Jan 21, 2021, at 8:36 AM, Keith Clarke via use-livecode > wrote: > > Thanks Brian. I looked at matchChunk in the dictionary & it seems to return a > boolean, rather than the offset. The boolean is just whether or not the matchChunk operation was successful; you need to provide

Re: return "error" code from standalone compile

2020-12-11 Thread Ken Ray via use-livecode
Wow... I've been using Livecode since its inception (and Revolution before that, and even MetaCard before *that*!), and I never knew this existed! Just goes to show that there's always something new to learn about our favorite development tool. (I wonder if anyone's put together a "list of

Re: Naive XML questions

2020-10-25 Thread Ken Ray via use-livecode
Graham, here's the basic approach (assuming your XML is in the variable 'tXML'): put revXMLCreateTree(tXML,false,true,false) into tTreeID put "/gpx/trk/trkseg/trkpt[1]" into tNode -- the brackets identify the instance of "trkpt" to work with put revXMLAttribute(tTreeID,

Re: macOS, is my app active?

2019-11-23 Thread Ken Ray via use-livecode
Klaus, I have a function that generally works with this AppleScript: function stsGetFrontmostProcess  put "tell app `System Events`" & cr & \ "get (the name of every application process whose frontmost is true) as string" & cr & \ "end tell" into tScript replace