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

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

Recommended Posts

Posted

I have a bit of a head-scratcher. Any ideas are helpful!

I am using a KeystrokeScriptTrigger on certain fields and am passing a "MaxCharacter" value to the script. The script checks to see if the Length( FieldContents ) = MaxCharacterValue, then the script performs a "Go to Next Field" script step. Basically, I'm only allowing X number of characters in the field (example: 5 characters in a zip code).

However, I don't always want to go to my Next Field....often, my next item in the tab order is an object...of which I don't know/can't calculate the name, so I can't use "Go To Object[ NAME ]".

Any ideas on

1) If there's a way to "Go to Next Object"

2) Perform Keystroke["TAB"]

etc...

THANKS everyone!

Posted

just a thought, and hope it helps, but you could pass on the name of the object or field as a Script Parameter using a calculation, getting the name of the object dynamically based on whatever criteria you want

Posted

I guess you could get a list of all the objects on the layout, get the position of the current layout object, then work out the next object from there.

But it begs the question: what is the next object and how can it be controlled? I don't know.

Posted

Vaughn states the million dollar question well. dayzrespite, while I can pass the current object to the script via a calculation, I don't know a dynamic/calculatory way to get the name of the next object. I could going through the painstaking process of hard-programming the next-object-names in to the previous objects scripts themselves, but that kind of defeats the flexibility and simplicity of the function itself.

normanicus: I'm not entirely sure what you mean. It's fixed in the way that I've set up a specific tabbing sequence but jumps around the layout in a non-static fashion...

There are two script parameters that would be useful in a situation like this:

Go To Next Object (similar to Go To Next Field; I've submitted it to Filemaker as a feature request)

PerformKeystroke

....wait a tic. What if I were to use PerformApplescript and have it execute a text character of Enter, Tab, or Return? That would take me to the next field. Can you do that with Applescript? Have it "type" or perform characters for you?

Hmm! I gotta check this out.

Posted

...I don't know a dynamic/calculatory way to get the name of the next object...

... but you could if the names of your objects are sequential, like 1, 2,... 5.

Passed as script parameter the Get ( ActiveLayoutObjectName ) to an OnObjectExit trigger, the next object's name will be:

Mod ( Get ( ScriptParameter ) ; 5 ) + 1

( if there are five objects )

Posted

raybaudi -- NICE! That would definitely work, too...and be compatible for both Macs and PCs.

Right now I'm only dealing with a database for a Mac so I might cop out with the quicker fix and stick with the Applescript ---> which does work! I read somewhere that you might need to "Enable access for assistive devices" in System Prefs > Universal Access, but in a few tests I haven't encountered a computer that you had to in order for this to work:

Perform Applescript( tell application "System Events" to keystroke tab )

Thanks for all your help!

Posted

Update: the Applescript I posted works fine for locally hosted files, but it doesn't work for ones hosted on a server. That makes sense.

So instead, here's a better solution that is cross-platform. What I'm doing now is passing the "max" character value to the script via the ScriptTrigger's ScriptParameter. I also have the option of passing a "nextObj" value to the script. If nextObj has a value it will go to that object on validation; if nextObj is null (i.e. it wasn't included in the ScriptParameter), the script will go to the next field.

This allows a considerable amount of flexibility (function can be used on any layout or in any table) with the least amount of modifications.

See attached example (yes, I've scripted it a little more complicated then necessary, but this allows for future expansion/flexibility of the script if you wanted to send other variables in the ScriptParameter to do other things).

Thanks again for your input!

ScriptTrigger_NextObject.fp7.zip

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