Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

Add an object to all layouts in the solution


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

Recommended Posts

Posted

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

Posted (edited)
36 minutes ago, carlsson said:

some kind of third party tool

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

 

Edited by comment
Posted
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.

:) 

Posted

Not being used <>not referenced. I would use fm perception to truly understand what is referenced. 

Posted (edited)

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
Posted (edited)

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
Posted

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. 

Posted

Are you running this from the Script Editor application? You should see a more detailed error message in the Result pane. Also make sure you have copied the text block just before running.

Posted

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!

 

Posted

I am not at work anymore, but I just tried at another solution and now it works. In both 17 and 18. 

Really strange. Will be back with a result next week.

🤪

This topic is 1784 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.