Jump to content

How to switch between two open databases


BFH

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

Recommended Posts

What are the appropriate AppleScript commands to do this?

I have two database files open. The one that is active has buttons linked to an AppleScript that tells the other database which layout to display. I want to add AppleScript commands that will bring the other database to the front (make it active) to make life easier for the user.

I've tried

activate "db 1"

select window 1

and that results in an error message.

Likewise

activate "db 1"

activate window 1

Thanks in advance.

Link to comment
Share on other sites

No need for AppleScript to do this.

Create a script in the target file that goes to the desired layout, finds records, sorts, sets up the window etc and ends with the "Refresh Windiow [bring to front]" script step.

In the source file, create a script that uses the "Perform Script [external]" step. As the external script select the target file and the script you made above.

Now run this script in the source file and you'll switch between databases instantly. No need to even worry whether the file is already open, FMP will do that if necessary as part of running the external script.

This technique is 100% cross-platform.

Link to comment
Share on other sites

Many thanks for the prompt and helpful reply, Vaughn. I totally missed that FMP's Refresh Window command has a built-in Bring to Front feature. Bad user, bad user. frown.gif

Questions:

1. Curiosity: should I avoid using AS, even though it works? If so, how come?

2. In database 2, I have a button with the following FMP script.

Go to Layout ["1"]

Perform AppleScript ["tell database 1 . . . end tell"]

View As [View As Form]

Refresh Window [bring to Front]

The last command works on database 2, not database 1. Is that correct?

Thanks again! frown.gif

Link to comment
Share on other sites

Speed as well. AS will never execute as quickly as simply using Filemaker scripting for this kind of thing.

Simplicty also, since with AS you'll need to maintain those scripts, and anyone else who will be working on the development or maintainence of the systems needs to be familiar with AS.

Link to comment
Share on other sites

Captkurt:

Many thanks for taking time to reply. I'll keep that in mind.

I want the windows of my two open databases to stay in the same place and have the same size across sessions. If a data-entry person manipulates the window size and/or location, I want those restored when the person changes layouts.

I don't have FMP Developer, which I understand supports a kiosk-mode feature that would fix the database window's size and location. The "client" version of FMP, to my knowledge, lacks this feature.

With AS, I can specify the window size and location for my open databases. I've written the scripts, they work properly and reliably, and they take little time to do their job.

I've searched these forums and read over the User Guide and Help, but am unable to find how to do this using FM's built-in scripting.

Can you tell me where I would find info on how to manipulate the database window's size and location using FM's built-in scripting so that I could replace my AS with this?

Many thanks in advance and cheers!

Link to comment
Share on other sites

You cannot specifically manipulate those from within Filemaker scripting, and those are good reasons to use AS. Although there are tricks to accomplish this. There are a couple of plugins which will allow you to specify position and size, also you can make use of "sizer" layouts. Setup a box the size that you want the screen to be, then goto this layout, hide the status area and Toggle Window [Zoom], which will size it to this.

I regualrly use this as part of a general Window/Status script which runs whenever a user switches layouts.

Link to comment
Share on other sites

Captkurt:

Many thanks for the prompt and helpful reply.

My secondary (database) window actually is simply a layout that shows the user where she is in the main database (which has *lots* of data-entry and search layouts). It is a visual guide rather than a data-entry or -manipulating tool.

It would be better if I could make this secondary window a true floating palette rather than an FMP db window on both Mac and Windows, but that's beyond my skills.

When I open the two files in Win2K (under Virtual PC on my Mac), I remembered that Windows (unlike the Mac) opens a window for the application, and then it opens document windows within that window.

Consequently, my secondary window opened behind the database window!

Could you please explain to me how I could implement your "sizer" layout concept to accomplish my goal of ensuring that my two database windows are sized and positioned appropriately?

Or can you refer me to an appropriate plugin?

To reiterate, AS does this trick on the Mac very effectively and efficiently.

Many thanks and cheers! smile.gif

Link to comment
Share on other sites

On Windows, just maximise all the windows. Leave them maximised.

FMP does not offer floating palettes, however you can add buttons to a layout and build the interface that way.

Link to comment
Share on other sites

Hi Vaughn.

Thanks for taking time to reply.

Maximizing does not meet my needs. I need to have the two windows sized and positioned in a way that will facilitate data entry. Maximizing is inconsistent with that.

I already was aware that FMP did not support floating palettes. However, one of the previous replies in this thread suggested a plug-in, and I'm waiting for info about which plug-in would do the job on Windows of sizing and positioning a db window.

As mentioned previously, I already have a solution for my need on the Mac; I have an AppleScript that meets my needs. Now I need a solution for sizing and positioning the windows on the PC.

And I already have created a layout with the necessary buttons in it that is in the second of the two windows. I only mentioned a floating palette in my previous posting because that would be even better.

Cheers!

Link to comment
Share on other sites

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