Page 1 of 1
Do a search of control behaviour
Posted: Wed May 06, 2020 10:15 am
by trevix
I had to change the name of my main stack, where I stored my buttons with script behaviour.
So, each control that had a behaviour like
button id 1120 of stack "MainStackX"
had to be changed to
button id 1120 of stack "MainStackY"
.
Unfortunately
there are a lot of controls as such, often nested inside groups, and doing a search for "MainStackX", with ALL the check of the Find and Replace panel turned to on, does not search the word in the inspectors.
Is there any other way to do it?
Re: Do a search of control behaviour
Posted: Wed May 06, 2020 11:38 am
by Klaus
Make a nested loop over your cards and controls!
Code: Select all
...
repeat with i = 1 to the num of cds
repeat with k = 1 to the num of controls of cd i
put the behavior of control k of cd i into tBehav
if tBehav = EMPTY then
next repeat
end if
## Do your check and neccessary changes here if the behavior is the one you are looking for
## ...
end repeat
end repeat
...
Re: Do a search of control behaviour
Posted: Wed May 06, 2020 4:46 pm
by FourthWorld
Wouldn't the built-in Find/Replace do the job? Good to practice scripting skills, but is that necessary for this task?
Re: Do a search of control behaviour
Posted: Wed May 06, 2020 4:50 pm
by trevix
The build-in Find apparently does not search the behaviour link
Re: Do a search of control behaviour
Posted: Wed May 06, 2020 5:32 pm
by FourthWorld
trevix wrote: ↑Wed May 06, 2020 4:50 pm
The build-in Find apparently does not search the behaviour link
Ah, right.
Hmmm...I can appreciate the challenge of adding properties to the Find/Replace stack, but as one of the two hard problems of computer science* this comes up often enough that it's worth making a tool for.
Anyone care to make a plugin for this? I'd do it but with my client workload right now I wouldn't be able to get to it until summer.
* "There are only two hard things in Computer Science: cache invalidation and naming things." - Phil Karlton
Re: Do a search of control behaviour
Posted: Wed May 06, 2020 7:08 pm
by kdjanz
You could also use ScriptTracker to take all the scripts out to text files and make the change in your favourite text editor...
Brian Milby -
https://github.com/bwmilby/scriptTracke ... /README.md
Re: Do a search of control behaviour
Posted: Wed May 06, 2020 7:33 pm
by trevix
In my case, Klaus solution was fast and solved (but I manually modified the behaviour links. Did not have time to handle this too)
I used the script adding to it a repeat for stacks
Re: Do a search of control behaviour
Posted: Thu May 07, 2020 6:07 pm
by jacque
For next time, couldn't you name your stack whatever you want and set its label to whatever the user should see? That saves a lot of trouble.
Re: Do a search of control behaviour
Posted: Fri May 08, 2020 8:09 am
by trevix
I tell you what happened:
My App, after a in depth research, was called "Segnapunti". I searched the App stores, I bought the domain, I prepared all the help, documentation, privacy, email and developed the App (it was created with 1 Main stack and ten or more sub-stacks). The main stack was holding most of the common script and a card with all the behaviour buttons (around 20) and images.
When I started on the App Store Connect, Apple did not accept my App name. Probably used by someone else without having published their App.
The only fact of registering a name on App Store Connect, for a TestFlight, somehow reserve that name "forever".
I had to choice:
- ask Apple to retain my name, that I repeat wasn't available on a search on the App Store, and start a uncertain complicate dispute.
- change the name of the App
There it is. It took me 2 days to change everything.
Re: Do a search of control behaviour
Posted: Fri May 08, 2020 5:41 pm
by jacque
Sorry you had to spend two days fixing it. I think you could have just changed the stack label, I do most of my apps that way. My current project's mainstack is named "FPMobile" and its label is the real name.
In standalone settings you can change the default name to use the real name and that is what Apple sees. LC always uses the stack name to resolve behaviors, so all my behaviors still work because they are looking for a stack named FPMobile. But in the App Store it will be listed as The Real Name.