Re: Lock screen challenge
I resemble that remark! j > On Nov 21, 2022, at 7:47 PM, J. Landman Gay via use-livecode > wrote: > > more old-timers ___ 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
Re: Lock screen challenge
A random thought: if you converted to script-only stack behaviors first, then you would have a bunch of text files you can use whatever tool you like on. gc On Mon, Nov 21, 2022 at 1:25 PM J. Landman Gay via use-livecode < use-livecode@lists.runrev.com> wrote: > I'm updating a very old set of stacks that use old HC syntax for "lock > screen". A search with > LC's Find utility says there are 723 instances that may need to be > changed. Right now they look > like this: > > lock screen > -- do any number of things > unlock screen with > > These all need to be changed to: > > lock screen for visual effect > -- do any number of things > unlock screen with visual effect > > The challenge is that not all "lock screen" commands use a visual effect, > some are simple > lock/unlock pairs. I need to automate this. The visual effects are not all > the same. Some > handlers have multiple instances of locking the screen with or without a > visual effect. > > I'd use a regex if I could, but back references aren't supported (or are > they now?) I really > don't want to do this manually. > > -- > 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
Re: Lock screen challenge
Navigator has support for test-based filtering of controls, and can copy/paste scripts, but it doesn't support copying/pasting to more than one control at a time. That would be an interesting problem to solve. What's your time frame? gc On Mon, Nov 21, 2022 at 1:25 PM J. Landman Gay via use-livecode < use-livecode@lists.runrev.com> wrote: > I'm updating a very old set of stacks that use old HC syntax for "lock > screen". A search with > LC's Find utility says there are 723 instances that may need to be > changed. Right now they look > like this: > > lock screen > -- do any number of things > unlock screen with > > These all need to be changed to: > > lock screen for visual effect > -- do any number of things > unlock screen with visual effect > > The challenge is that not all "lock screen" commands use a visual effect, > some are simple > lock/unlock pairs. I need to automate this. The visual effects are not all > the same. Some > handlers have multiple instances of locking the screen with or without a > visual effect. > > I'd use a regex if I could, but back references aren't supported (or are > they now?) I really > don't want to do this manually. > > -- > 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
Re: Lock screen challenge
My first thought is to export all scripts to a single file, with customized headers for each object (maybe with a user-definable format). Then look for that same format when pasting, to restore/update the scripts. Does that make sense? Or would it be better to have an export function to create individual files, one ofr each control, with the script in the file? That's probably more robust, but not everyone knows how to make bulk changes to a bunch of text files. On Tue, Nov 22, 2022 at 1:11 PM Geoff Canyon wrote: > Navigator has support for test-based filtering of controls, and can > copy/paste scripts, but it doesn't support copying/pasting to more than one > control at a time. That would be an interesting problem to solve. What's > your time frame? > > gc > > On Mon, Nov 21, 2022 at 1:25 PM J. Landman Gay via use-livecode < > use-livecode@lists.runrev.com> wrote: > >> I'm updating a very old set of stacks that use old HC syntax for "lock >> screen". A search with >> LC's Find utility says there are 723 instances that may need to be >> changed. Right now they look >> like this: >> >> lock screen >> -- do any number of things >> unlock screen with >> >> These all need to be changed to: >> >> lock screen for visual effect >> -- do any number of things >> unlock screen with visual effect >> >> The challenge is that not all "lock screen" commands use a visual effect, >> some are simple >> lock/unlock pairs. I need to automate this. The visual effects are not >> all the same. Some >> handlers have multiple instances of locking the screen with or without a >> visual effect. >> >> I'd use a regex if I could, but back references aren't supported (or are >> they now?) I really >> don't want to do this manually. >> >> -- >> 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
Re: Lock screen challenge
One option to use an external editor would be ScriptTracker. You could export the scripts, do your bulk changes, and then import them back. Brian Milby br...@milby7.com > On Nov 22, 2022, at 4:10 PM, Geoff Canyon via use-livecode > wrote: > > A random thought: if you converted to script-only stack behaviors first, > then you would have a bunch of text files you can use whatever tool you > like on. > > gc > >> On Mon, Nov 21, 2022 at 1:25 PM J. Landman Gay via use-livecode < >> use-livecode@lists.runrev.com> wrote: >> >> I'm updating a very old set of stacks that use old HC syntax for "lock >> screen". A search with >> LC's Find utility says there are 723 instances that may need to be >> changed. Right now they look >> like this: >> >> lock screen >> -- do any number of things >> unlock screen with >> >> These all need to be changed to: >> >> lock screen for visual effect >> -- do any number of things >> unlock screen with visual effect >> >> The challenge is that not all "lock screen" commands use a visual effect, >> some are simple >> lock/unlock pairs. I need to automate this. The visual effects are not all >> the same. Some >> handlers have multiple instances of locking the screen with or without a >> visual effect. >> >> I'd use a regex if I could, but back references aren't supported (or are >> they now?) I really >> don't want to do this manually. >> >> -- >> 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 ___ 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
Re: Lock screen challenge
One small point on this: it doesn't matter since we're dealing with HC files here, but in LC there can be backgrounds that don't appear on any card. So it would be necessary to add: repeat with j = 1 to the number of backgrounds in stack i repeat with k= 1 to the number of controls of background j of stack i Note that this *doesn't* guarantee a single loop through all the controls. The code would need to handle controls in groups that appear on multiple cards. In Navigator I needed something like this. I created this, some of which I wrote years ago, and no warranty is expressed or implied: function allIDsOfStack stackID local tReturnIDList put empty into tReturnIDList repeat for each line bgID in backgroundIDsOf(stackID) put allControlIDsOf(bgID) after tReturnIDList end repeat repeat for each line cdID in cardIDsOf(stackID) put nonGroupChildControlIDsOf(cdID) after tReturnIDList end repeat return (the long id of stackID) & cr & tReturnIDList end allIDsOfStack function allControlIDsOf pContainerID local cIDend, cIDendString, controlIDList, controlList if not exists(pContainerID) then return empty put the long id of pContainerID into pContainerID --breakpoint switch word 1 of the name of pContainerID case "stack" return allIDsOfMainstack(pContainerID) case "card" put the controlIDs of pContainerID into controlList if controlList is empty then return pContainerID & cr repeat for each line cID in controlList put (the long id of control id cID of pContainerID) & cr after controlIDList end repeat return pContainerID & cr & controlIDList case "group" if word -6 of pContainerID is "card" then put -7 into cIDend else put -10 into cIDend put (word cIDend + 5 to -1 of pContainerID) & cr into cIDendString put the controlIDs of pContainerID into controlList if controlList is empty then return pContainerID & cr repeat for each line cID in controlList put "control" && (word 2 to cIDend of the long id of control id cID of pContainerID) && cIDendString after controlIDList end repeat return pContainerID & cr & controlIDList default --return "control" && word 2 to -1 of pContainerID return pContainerID end switch end allControlIDsOf function allUniqueIDsOf pControlList,includeBehaviors local tReturn, tWorking, X -- returns all the controls within put format("group,1\ncard,2\nstack,3") into X split X using cr and comma put canonicalIDsOf(pControlList) into pControlList sort lines of pControlList descending by X[word 1 of each] --answer pControlList repeat for each line cID in pControlList --put the long id of cID into cID if tReturn[cID] is not empty then next repeat --put true into tReturn[cID] if includeBehaviors then put canonicalIDsOf(allControlIDsOf(cID),false) into tWorking put addBehaviorChains(tWorking) into tBehaviors if tBehaviors is not empty then put cr & tBehaviors after tWorking split tWorking by cr as set else put canonicalIDsOf(allControlIDsOf(cID),true) into tWorking end if --answer tWorking --split tWorking by cr as set union tReturn with tWorking end repeat --answer the number of lines of the keys of tReturn return the keys of tReturn end allUniqueIDsOf function nonGroupChildControlIDsOf pContainerID local controlIDList, tReturnIDList put empty into tReturnIDList put the long id of pContainerID into pContainerID put the childControlIDs of pContainerID into controlIDList if controlIDList is empty then return pContainerID & cr put "control id " before controlIDList replace cr with " of" && pContainerID & cr & "control id " in controlIDList repeat for each line controlID in (controlIDList && "of" && pContainerID) if word 1 of the name of controlID is not "group" then put controlID & cr after tReturnIDList end repeat return pContainerID & cr & tReturnIDList end nonGroupChildControlIDsOf function canonicalIDsOf cIDList, returnArray local cID, cIDend, R repeat for each line cIDx in cIDList put the long id of cIDx into cID if word 5 of cID is "group" then if word -6 of cID is "card" then put -7 into cIDend else put -10 into cIDend put 1 into R[word 1 to cIDend of cID && word cIDend + 5 to -1 of cID] else put 1 into R[cID] end if end repeat if returnArray is true then return R else return (the keys of R) & cr end canonicalIDsOf function backgroundIDsOf stackID local backgroundIDList, bgID put empty into backgroundIDList repeat with i = 1 to 9 if not (there is a background i of stackID) then return backgroundIDList put (the long id of background i of stackID) into bgID if word 5 of bgID is not "group" t
Re: Lock screen challenge
Yep, that makes sense. Looks nice! On Tue, Nov 22, 2022 at 1:28 PM Brian Milby via use-livecode < use-livecode@lists.runrev.com> wrote: > One option to use an external editor would be ScriptTracker. You could > export the scripts, do your bulk changes, and then import them back. > > Brian Milby > br...@milby7.com > > > On Nov 22, 2022, at 4:10 PM, Geoff Canyon via use-livecode < > use-livecode@lists.runrev.com> wrote: > > > > A random thought: if you converted to script-only stack behaviors first, > > then you would have a bunch of text files you can use whatever tool you > > like on. > > > > gc > > > >> On Mon, Nov 21, 2022 at 1:25 PM J. Landman Gay via use-livecode < > >> use-livecode@lists.runrev.com> wrote: > >> > >> I'm updating a very old set of stacks that use old HC syntax for "lock > >> screen". A search with > >> LC's Find utility says there are 723 instances that may need to be > >> changed. Right now they look > >> like this: > >> > >> lock screen > >> -- do any number of things > >> unlock screen with > >> > >> These all need to be changed to: > >> > >> lock screen for visual effect > >> -- do any number of things > >> unlock screen with visual effect > >> > >> The challenge is that not all "lock screen" commands use a visual > effect, > >> some are simple > >> lock/unlock pairs. I need to automate this. The visual effects are not > all > >> the same. Some > >> handlers have multiple instances of locking the screen with or without a > >> visual effect. > >> > >> I'd use a regex if I could, but back references aren't supported (or are > >> they now?) I really > >> don't want to do this manually. > >> > >> -- > >> 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 > > ___ > 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
RE: Lock screen challenge
Not to be Johnny Rain Cloud... What if handler "A" locks and it calls either hander "B" OR handler "C" to unlock? Ralph DiMola IT Director Evergreen Information Services rdim...@evergreeninfo.net -Original Message- From: use-livecode [mailto:use-livecode-boun...@lists.runrev.com] On Behalf Of J. Landman Gay via use-livecode Sent: Monday, November 21, 2022 10:48 PM To: How to use LiveCode Cc: J. Landman Gay Subject: Re: Lock screen challenge Thanks to both you and Craig. I couldn't think of any other way to do it either, but was hoping there was something other than brute force. Magic, maybe. It took LC's search/replace dialog a long time just to find all the instances, and actually editing them will be longer. But, it's just a one-off. Craig, I posted here because I more comfortable with it, and because more old-timers tend to be on the list. -- Jacqueline Landman Gay | jac...@hyperactivesw.com HyperActive Software | http://www.hyperactivesw.com On November 21, 2022 3:45:16 PM Paul Dupuis via use-livecode wrote: > I was also going to suggest just brute forcing it. Something like: > (code not complete or syntax checked) > > repeat with i=1 to the number of stacks > repeat with j = 1 to the number of cards in stack i > repeat with k= 1 to the number of controls of card j of stack i > put the script of control k of card j of stack i into tScript > -- look through the lines of tScript for "lock screen", note the > line number A, then search from there onward for "unlock screen" and > note the line number B > -- if line B begins with (after trimming spaces) "unlock screen > with" then > -- replace line B with "unlock screen with visual effect" > -- and replace line A with "lock screen for visual effect" > end repeat > end repeat > end repeat > > > On 11/21/2022 4:30 PM, Craig Newman via use-livecode wrote: >> Jacque. >> >> Why aren’t you on the forum? >> >> Cant you just loop through each line in your handlers, and find the >> ones that contain “lock screen”, both with and without the visual effect >> thing. >> Search downstream until you find the “unlock” line, That gives you >> the start and finish lines for each handler. Then you can just >> replace the start and finish lines with the new ones. >> >> Am I missing this? >> >> Craig >> >>> On Nov 21, 2022, at 4:24 PM, J. Landman Gay via use-livecode >>> wrote: >>> >>> I'm updating a very old set of stacks that use old HC syntax for >>> "lock screen". A search with LC's Find utility says there are 723 >>> instances that may need to be changed. Right now they look like this: >>> >>> lock screen >>> -- do any number of things >>> unlock screen with >>> >>> These all need to be changed to: >>> >>> lock screen for visual effect >>> -- do any number of things >>> unlock screen with visual effect >>> >>> The challenge is that not all "lock screen" commands use a visual >>> effect, some are simple lock/unlock pairs. I need to automate this. >>> The visual effects are not all the same. Some handlers have multiple >>> instances of locking the screen with or without a visual effect. >>> >>> I'd use a regex if I could, but back references aren't supported (or >>> are they now?) I really don't want to do this manually. >>> >>> -- >>> 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 > > > ___ > 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 ___ 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
Re: Lock screen challenge
Yup. That happens, and I thought of it. I'm still trying to figure out how to approach this. On 11/22/22 3:50 PM, Ralph DiMola via use-livecode wrote: Not to be Johnny Rain Cloud... What if handler "A" locks and it calls either hander "B" OR handler "C" to unlock? Ralph DiMola IT Director Evergreen Information Services rdim...@evergreeninfo.net -Original Message- From: use-livecode [mailto:use-livecode-boun...@lists.runrev.com] On Behalf Of J. Landman Gay via use-livecode Sent: Monday, November 21, 2022 10:48 PM To: How to use LiveCode Cc: J. Landman Gay Subject: Re: Lock screen challenge Thanks to both you and Craig. I couldn't think of any other way to do it either, but was hoping there was something other than brute force. Magic, maybe. It took LC's search/replace dialog a long time just to find all the instances, and actually editing them will be longer. But, it's just a one-off. Craig, I posted here because I more comfortable with it, and because more old-timers tend to be on the list. -- Jacqueline Landman Gay | jac...@hyperactivesw.com HyperActive Software | http://www.hyperactivesw.com On November 21, 2022 3:45:16 PM Paul Dupuis via use-livecode wrote: I was also going to suggest just brute forcing it. Something like: (code not complete or syntax checked) repeat with i=1 to the number of stacks repeat with j = 1 to the number of cards in stack i repeat with k= 1 to the number of controls of card j of stack i put the script of control k of card j of stack i into tScript -- look through the lines of tScript for "lock screen", note the line number A, then search from there onward for "unlock screen" and note the line number B -- if line B begins with (after trimming spaces) "unlock screen with" then -- replace line B with "unlock screen with visual effect" -- and replace line A with "lock screen for visual effect" end repeat end repeat end repeat On 11/21/2022 4:30 PM, Craig Newman via use-livecode wrote: Jacque. Why aren’t you on the forum? Cant you just loop through each line in your handlers, and find the ones that contain “lock screen”, both with and without the visual effect thing. Search downstream until you find the “unlock” line, That gives you the start and finish lines for each handler. Then you can just replace the start and finish lines with the new ones. Am I missing this? Craig On Nov 21, 2022, at 4:24 PM, J. Landman Gay via use-livecode wrote: I'm updating a very old set of stacks that use old HC syntax for "lock screen". A search with LC's Find utility says there are 723 instances that may need to be changed. Right now they look like this: lock screen -- do any number of things unlock screen with These all need to be changed to: lock screen for visual effect -- do any number of things unlock screen with visual effect The challenge is that not all "lock screen" commands use a visual effect, some are simple lock/unlock pairs. I need to automate this. The visual effects are not all the same. Some handlers have multiple instances of locking the screen with or without a visual effect. I'd use a regex if I could, but back references aren't supported (or are they now?) I really don't want to do this manually. -- 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 ___ 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 ___ 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:
Re: Lock screen challenge
On 11/22/22 3:08 PM, Geoff Canyon via use-livecode wrote: A random thought: if you converted to script-only stack behaviors first, then you would have a bunch of text files you can use whatever tool you like on. This project is a huge HC world. There are a lot of stacks, hundreds of cards, and probably thousands of controls. It's written the old HC way, so behaviors probably wouldn't help; almost every control is independent and performs a different action. I've already converted the few common actions to a backscript, but there's nothing much to hang a behavior on. Navigator has support for test-based filtering of controls, and can copy/paste scripts, but it doesn't support copying/pasting to more than one control at a time. That would be an interesting problem to solve. What's your time frame? Indeterminate, but not infinite. ;) I won't need to copy scripts though, every one of them is different. It's truly old-style HC. In fact, I'm still running with HCAddressing set to true, which breaks the property inspector a lot. My next task is to get rid of that. My first thought is to export all scripts to a single file, with customized headers for each object (maybe with a user-definable format). Then look for that same format when pasting, to restore/update the scripts. Does that make sense? Or would it be better to have an export function to create individual files, one ofr each control, with the script in the file? That's probably more robust, but not everyone knows how to make bulk changes to a bunch of text files. Either way would probably work for most things, though if you exported all the controls in this project to a single file, you'd have a 20 MB novel. TBH, I already have a handler somewhere that writes out all scripts in a stack with headers; an old HC friend wrote it 30 years ago and it still works. Maybe I can dig that up. -- 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
Re: Lock screen challenge
On 11/22/22 3:27 PM, Brian Milby via use-livecode wrote: One option to use an external editor would be ScriptTracker. You could export the scripts, do your bulk changes, and then import them back. That's worth a thought. Thanks. -- 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