Hallo Jacqueline,
Well I wouldn’t expect you asking such a question..!

Scanning all the concerned script, get nScript and set nScript

…
put replacetexte (nScript, „screen“, „screen with visual effect“) into nScript
…

or for safer result (to turn around eventual individual „screen" chunk) of 
varying blank width) something like this should also works:
….
put 0 into n0
Repeat 
    put wordoffset(„screen", nScript, n0) into n00
    If n00 is 0 then exit repeat
    Add n00 to n0
    If „lock“ is char -4 to -1 of word n0-1 of nScript then put „ visual 
effect" after word n0 of nScript
End repeat 
….
Safer seems not to be possible!

Jean-Jacques Wagner
(Involved since 20 years in only one for ever lasting patent process)



> Am 22.11.2022 um 18:00 schrieb use-livecode-requ...@lists.runrev.com:
> 
> Send use-livecode mailing list submissions to
>       use-livecode@lists.runrev.com
> 
> To subscribe or unsubscribe via the World Wide Web, visit
>       http://lists.runrev.com/mailman/listinfo/use-livecode
> or, via email, send a message with subject or body 'help' to
>       use-livecode-requ...@lists.runrev.com
> 
> You can reach the person managing the list at
>       use-livecode-ow...@lists.runrev.com
> 
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of use-livecode digest..."
> 
> 
> you can find the archives for this list at:
> 
> http://lists.runrev.com/pipermail/use-livecode/
> 
> and search them using this link:
> 
> http://www.google.com/advanced_search?q=site:lists.runrev.com
> 
> 
> Today's Topics:
> 
>   1. Lock screen challenge (J. Landman Gay)
>   2. Re: Lock screen challenge (Craig Newman)
>   3. Re: Lock screen challenge (Paul Dupuis)
>   4. Re: Lock screen challenge (J. Landman Gay)
> 
> 
> ----------------------------------------------------------------------
> 
> Message: 1
> Date: Mon, 21 Nov 2022 15:24:15 -0600
> From: "J. Landman Gay" <jac...@hyperactivesw.com>
> To: LiveCode Mailing List <use-livecode@lists.runrev.com>
> Subject: Lock screen challenge
> Message-ID: <45bc51f7-cafc-c8a3-f09c-c2a3ade3f...@hyperactivesw.com>
> Content-Type: text/plain; charset=UTF-8; format=flowed
> 
> 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 <effect>
> 
> These all need to be changed to:
> 
> lock screen for visual effect
> -- do any number of things
> unlock screen with visual effect <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
> 
> 
> 
> ------------------------------
> 
> Message: 2
> Date: Mon, 21 Nov 2022 16:30:57 -0500
> From: Craig Newman <cr...@starfirelighting.com>
> To: How to use LiveCode <use-livecode@lists.runrev.com>
> Subject: Re: Lock screen challenge
> Message-ID:
>       <03e5e47a-10e5-4a74-9ad7-8bcf95b0a...@starfirelighting.com>
> Content-Type: text/plain;     charset=utf-8
> 
> 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 
>> <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 <effect>
>> 
>> These all need to be changed to:
>> 
>> lock screen for visual effect
>> -- do any number of things
>> unlock screen with visual effect <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
> 
> 
> 
> 
> ------------------------------
> 
> Message: 3
> Date: Mon, 21 Nov 2022 16:43:08 -0500
> From: Paul Dupuis <p...@researchware.com>
> To: use-livecode@lists.runrev.com
> Subject: Re: Lock screen challenge
> Message-ID: <ed7a3a63-46c3-6b76-52ff-dfbc5bd34...@researchware.com>
> Content-Type: text/plain; charset=UTF-8; format=flowed
> 
> 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 
>>> <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 <effect>
>>> 
>>> These all need to be changed to:
>>> 
>>> lock screen for visual effect
>>> -- do any number of things
>>> unlock screen with visual effect <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
> 
> 
> 
> 
> ------------------------------
> 
> Message: 4
> Date: Mon, 21 Nov 2022 21:47:57 -0600
> From: "J. Landman Gay" <jac...@hyperactivesw.com>
> To: How to use LiveCode <use-livecode@lists.runrev.com>
> Subject: Re: Lock screen challenge
> Message-ID:
>       <1849d7319c8.276f.5e131b4e58299f54a9f0b9c05d4f0...@hyperactivesw.com>
> Content-Type: text/plain; format=flowed; charset="UTF-8"
> 
> 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 
> <use-livecode@lists.runrev.com> 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 
>>>> <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 <effect>
>>>> 
>>>> These all need to be changed to:
>>>> 
>>>> lock screen for visual effect
>>>> -- do any number of things
>>>> unlock screen with visual effect <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
> 
> 
> 
> 
> 
> 
> ------------------------------
> 
> Subject: Digest Footer
> 
> _______________________________________________
> use-livecode mailing list
> use-livecode@lists.runrev.com
> http://lists.runrev.com/mailman/listinfo/use-livecode
> 
> 
> ------------------------------
> 
> End of use-livecode Digest, Vol 230, Issue 17
> *********************************************


_______________________________________________
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

Reply via email to