Jump to content
Server Maintenance This Week. ×

Add an object to all layouts in the solution


carlsson

This topic is 1575 days old. Please don't post here. Open a new topic instead.

Recommended Posts

I'm currently optimizing a solution with approximately 1000 layouts. I know that at most 10% of these are being used, and would like to delete the others.

 

Usually when I do this I put a text block on all layouts saying something like "IS THIS LAYOUT USED? IF SO INFORM ME [DATE]"

Going throught 1000 layouts it's kinda tedious. Is there some kind of third party tool or other solution that can help me with this? Copy Paste is the only option I know of.

 

Tia,

Andreas

Link to comment
Share on other sites

25 minutes ago, comment said:

Your profile says you're using macOS, so why not AppleScript?

 

Thanks for the input!

I thought about that, and that's maybe also an option. But it will take me a lot more time to write that script than to ask if there's something simpler. ;)

 

I have written some very simple Apple Scripts, but I have never mastered. Maybe it goes something like this:

Tell application "Filemaker Pro"
Activate
Enter Layout mode
Create object "Info" of class "Text"
Set fill color of "Info" to "Red"
Set text color of "Info" to "Yellow"
Set text of "Info" to "IS THIS LAYOUT USED? IF SO INFORM ME [DATE]"
Go to Layout Next
Repeat in some way
End tell

...but to test this, understand all the errors and correct them, will take me a day. Copy Paste will probably do the job in a couple of hours.

:) 

Link to comment
Share on other sites

For a (hopefully) one-time job like this, you could do simply:

tell application "Filemaker Pro"
	repeat 1000 times
		go to layout after current layout
		paste
	end repeat
end tell

Before calling the script, enter Layout mode manually, go to the first layout, create your text block and copy it. Note that this will error out on the last layout, but again, who cares.

Make sure to have a backup copy before running this.

 

 

Edited by comment
Link to comment
Share on other sites

Thanks, but when pasting I get an error: "The event failed." number -10000

it works to paste manually.

:(

 

PS. I'm on Catalina and Filemaker 17 Advanced.

Edited by carlsson
Link to comment
Share on other sites

Yep, it's something about the "Paste" that doesn't work. Everything else works as it should, and as you said; It's a one time show so it doesn't have to be fancy.

Thanks again, will look into it some more. 

Link to comment
Share on other sites

1834307087_Skrmavbild2020-01-03kl_19_51_02.thumb.png.c64989eed860c222c6bfb336aa36f919.png

 

This is it. 

Note that "paste" is highlighted.

Can it be that the account need Apple Event privileges? Naah, then go to layout wouldn't work...

However! I just tried it in FM18, and then it works! 🤪

Thank you for the help!

 

Link to comment
Share on other sites

This topic is 1575 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.