ScriptMaster is a free, general-purpose, modular plugin for FileMaker Pro. It comes out of the box with modules for file manipulation, URL and network utilities, Web Services, shell scripting, event/script triggering, and many others. Please use this discussion area to post questions and suggestions.



5069 Views    -    8 Replies


Username Post: can scriptmaster do this?        (Topic#192328)
Your continued generosity and support of FMForums is greatly appreciated.
Infomatics 
newbie
Posts: 3

Post Rank (AVG):
            


FMP: 10 Advanced
OS: Mac OS X Snow Leopard

Member: TechNet
Skill: Expert



Tweet This! Tweet This Post!
   Welcome Infomatics's first post!
01-07-08 02:48 AM - Post#277132     - Post Rank:             


Hi,

Since SwingBuilder can handle menu's and ScriptMaker can handle calling FM scripts
is it possible to make a dropdown box at the cursor position, or at the position of a button
(or at a given position) with the script parameters to pass on to a script?

That way I can use one print button with a dropdown to select several options to print
like:

List with prices
List without prices
List internal


Best regards,

Ruben van den Boogaard
Infomatics Software











This Post:
Client: 9 Advanced  OS: Mac OS X Tiger  Host: Server 9 Advanced

360Works offers a complete line of FileMaker plugins
and add-ons
targeted at FileMaker developers.

JamesBand 
enthusiast
Posts: 67

Post Rank (AVG):
            


FMP: 7
OS: Windows XP



Tweet This! Tweet This Post!
01-07-08 08:00 AM - Post#277147     - Post Rank:             
    In response to Infomatics

I am not sure that you could accomplish this with Scriptmaster... However, I have not really begun to push it's Groovy scripting limits...

That being said, you can accomplish what you want with a relationship and a portal with the list and each line a button. Any further look into this method would, of course, be best served in the Relationships Forum.












Colin K 
journeyman
Posts: 240

Loc: Philadelphia
Post Rank (AVG):
            


FMP: 11 Advanced
OS: Mac OS X Snow Leopard

Member: Platinum
Skill: Certified Trainer

Certified:
     

 FMPug

Tweet This! Tweet This Post!
01-07-08 08:28 AM - Post#277151     - Post Rank:             
    In response to Infomatics

  • Infomatics Said:
Hi,

Since SwingBuilder can handle menu's and ScriptMaker can handle calling FM scripts





Are you asking if you can build a dropdown in a Groovy application that calls a ScriptMaker script in FileMaker, based on the dropdown value selected by the user?

Or if you can generate a dropdown list within the FM application using SwingBuilder/Groovy, to control FM behavior?

If the latter, you might want to consider using FM's built in dropdown functionality, which, if you leave the cursor position requirement aside, is more than capable of handling the feature you want to build.

I'd love to see the results of what you're describing - it would be a very cool widget. And I have no real idea what's involved in building Java code or how it might integrate with other apps.

But my guess is, weighing the coding involved in creating a Java app to do something that 5 minutes of work using native FM tools can resolve (minus the cursor position)...

Well, seems like a lot of work, no?

Anyway, on the Mac platform FM is AppleScript aware, and on the PC ActiveX aware. You'd probably want to have your app figure out which FM file is frontmost, what table and layout it's open to, etc - and base your widget's dropdown values and script calls accordingly. I see loads of opportunities for breakage here.
Colin Keefe
IT Solutions Consulting, Inc
Fort Washington, PA USA

http://www.itsolutions-inc.com/
Employee ownership - fueling our innovation, strengthening your business.

Chapter Coordinator, Philadelphia FileMaker User Group
http://www.phillyfilemaker.org/

FBA Platinum Member
Authorized FileMaker Trainer
7, 8, 9, 10 and 11 Certified












Jesse Barnum 
journeyman
Posts: 237
Jesse Barnum

Loc: Atlanta, GA
Post Rank (AVG):
            


FMP: 11 Advanced
OS: Mac OS X Snow Leopard

Member: TechNet, FBA, Platinum
Skill: Expert

Certified:
     

 FMPug

Tweet This! Tweet This Post!
01-07-08 08:58 AM - Post#277152     - Post Rank:             
    In response to Infomatics

Try this code. You'll need to customize it obviously, but I think it can do what you're looking for. I'm also attaching it, in case it gets mangled on the web.

The trick is to create a full-screen invisible, modal JDialog. Once you have that, you can draw anything you want onto it. I get the mouse position using MouseInfo.getPointerInfo().getLocation().
====

Code:

  package swing; import javax.swing.*; import javax.swing.event.PopupMenuEvent; import javax.swing.event.PopupMenuListener; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.ComponentListener; import java.awt.event.ComponentEvent; import java.lang.reflect.InvocationTargetException; /**  * Created by IntelliJ IDEA. User: jesse Date: Jan 7, 2008 Time: 8:31:33 AM  */ public class PopupMenu implements ActionListenerPopupMenuListenerComponentListener {     /*If I set transparency to 0, then it doesn't detect background clicks to close the popup, so I set it to 7, which seems like the minimum threshold */     private static final Color TRANSPARENT = new Color(255255255);     public JDialog menuFrame;     public JPopupMenu popup;     private void drawPopupMenu() {         menuFrame = new JDialog( (Frame)nulltrue );         popup = new JPopupMenu"Popup" );         popup.addPopupMenuListenerthis );         JMenuItem choice1 = new JMenuItem"Choice 1" );         choice1.addActionListenerthis );         popup.addchoice1 );         JMenuItem choice2 = new JMenuItem"Choice 2" );         choice2.addActionListenerthis );         popup.addchoice2 );         JMenuItem choice3 = new JMenuItem"Choice 3" );         choice3.addActionListenerthis );         popup.addchoice3 );         menuFrame.setUndecoratedtrue );         menuFrame.setBackgroundTRANSPARENT );         Dimension screenSize Toolkit.getDefaultToolkit().getScreenSize();         menuFrame.setBounds00, (int)screenSize.getWidth(), (int)screenSize.getHeight() );         menuFrame.addComponentListenerthis );         menuFrame.setVisibletrue );     }     public static void main(String[] argsthrows InterruptedExceptionInvocationTargetException {         new PopupMenu().drawPopupMenu();     }     public void actionPerformedActionEvent e ) {         String menuText = ( (JMenuItem)e.getSource() ).getText();         /* Replace this with some call to a FileMaker script, like this:         fmpro.performScript(fileName, scriptName, menuText ); */         JOptionPane.showMessageDialognull"You picked " menuText );     }     public void popupMenuWillBecomeVisiblePopupMenuEvent e ) {}     public void popupMenuCanceledPopupMenuEvent e ) {}     public void popupMenuWillBecomeInvisiblePopupMenuEvent e ) {         menuFrame.dispose(); /* Get rid of invisible window after making a selection */     }     public void componentResizedComponentEvent e ) {}     public void componentMovedComponentEvent e ) {}     public void componentHiddenComponentEvent e ) {}     public void componentShownComponentEvent e ) {         Point mouseLoc MouseInfo.getPointerInfo().getLocation(); /* Absolute coordinates, need to convert to component coordinates */         mouseLoc.-= menuFrame.getX();         mouseLoc.-= menuFrame.getY();         popup.showmenuFrame, (int)mouseLoc.x, (int)mouseLoc.);     } }  





Attachment: Popup_menus.txt (2.65 KB) 454 View(s)

--Jesse Barnum, President, 360Works
http://www.360works.com
(770) 234-9293











Angelo Luchi 
newbie
Posts: 2

Loc: Seattle, WA
Post Rank (AVG):
            


FMP: 10 Advanced
OS: Cross Platform

Member: TechNet FBA
Skill: Advanced

Certified:
     

 FMPug

Tweet This! Tweet This Post!
   Welcome Angelo Luchi's first post!
01-28-09 11:06 AM - Post#316027     - Post Rank:             
    In response to Jesse Barnum

Has anyone been able to get this Groovy Script to call an FMpro script or return a result? I've been trying to re-write it so it can, but haven't had much success.

Thanks!










ShosMeister 
enthusiast
Posts: 42
ShosMeister

Loc: Harpers Ferry, WV
Post Rank (AVG):
            


FMP: 6
OS: Mac OS X Panther
Skill: Advanced



Tweet This! Tweet This Post!
02-03-09 10:42 AM - Post#316629     - Post Rank:             
    In response to Angelo Luchi

Searching for a solution to my issue and thinking ScriptMaster may help. I'm just not sure it's worth going through all the issues with the plug-in just to be able to do what I want.

Rather than completely reposting here (unless you want or a new thread), Topic Here is the thread I've been working on.

Thanks!!!!
[image]http://www.rhgclan.com/modules/Uploads/files/ShosMeister/EF111A_Forum Sig.jpg[/image]

Boinc Stats

Old Prorammers Never Die ... They just lose their bits











Jesse Barnum 
journeyman
Posts: 237
Jesse Barnum

Loc: Atlanta, GA
Post Rank (AVG):
            


FMP: 11 Advanced
OS: Mac OS X Snow Leopard

Member: TechNet, FBA, Platinum
Skill: Expert

Certified:
     

 FMPug

Tweet This! Tweet This Post!
02-03-09 01:12 PM - Post#316645     - Post Rank:             
    In response to Angelo Luchi

Hey Angelo - here's a modified version. This takes an input parameter called 'choices' and returns the user's selection:
Code:
package swing; import javax.swing.*; import javax.swing.event.PopupMenuEvent; import javax.swing.event.PopupMenuListener; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.ComponentListener; import java.awt.event.ComponentEvent; import java.lang.reflect.InvocationTargetException; def popup = new PopupMenu(); popup.setChoices( choices.split("\n") ); popup.drawPopupMenu(); return popup.getSelectedItem(); /** * Created by IntelliJ IDEA. User: jesse Date: Jan 7, 2008 Time: 8:31:33 AM */ public class PopupMenu implements ActionListener, PopupMenuListener, ComponentListener { /*If I set transparency to 0, then it doesn't detect background clicks to close the popup, so I set it to 7, which seems like the minimum threshold */ private static final Color TRANSPARENT = new Color(255, 255, 255, 7 ); private JDialog menuFrame; private JPopupMenu popup; private String selectedItem; private String[] choices; public static void main(String[] args) throws InterruptedException, InvocationTargetException { PopupMenu popup = new PopupMenu(); String choices = "Choice 1\nChoice 2\nChoice 3"; popup.setChoices( choices.split( "\n" ) ); popup.drawPopupMenu(); System.out.println( "Selection: " + popup.getSelectedItem() ); } public void setChoices( String[] choices ) { this.choices = choices; } public String getSelectedItem() { return selectedItem; } private void drawPopupMenu() { menuFrame = new JDialog( (Frame)null, true ); popup = new JPopupMenu( "Popup" ); popup.addPopupMenuListener( this ); for( int n=0; n<choices.length; n++ ) { JMenuItem choice = new JMenuItem( choices[n] ); choice.addActionListener( this ); popup.add( choice ); } menuFrame.setUndecorated( true ); menuFrame.setBackground( TRANSPARENT ); Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); menuFrame.setBounds( 0, 0, (int)screenSize.getWidth(), (int)screenSize.getHeight() ); menuFrame.addComponentListener( this ); menuFrame.setVisible( true ); } public void actionPerformed( ActionEvent e ) { selectedItem = ( (JMenuItem)e.getSource() ).getText(); menuFrame.dispose(); /* Get rid of invisible window after making a selection */ // If you would like this to trigger a script, reeplace this with some call to a FileMaker script, like this: //fmpro.performScript(fileName, scriptName, menuText ); */ //JOptionPane.showMessageDialog( null, "You picked " + selectedItem ); } public void componentShown( ComponentEvent e ) { Point mouseLoc = MouseInfo.getPointerInfo().getLocation(); /* Absolute coordinates, need to convert to component coordinates */ mouseLoc.x -= menuFrame.getX(); mouseLoc.y -= menuFrame.getY(); popup.show( menuFrame, (int)mouseLoc.x, (int)mouseLoc.y ); } public void popupMenuWillBecomeInvisible( PopupMenuEvent e ) {} public void popupMenuWillBecomeVisible( PopupMenuEvent e ) {} public void popupMenuCanceled( PopupMenuEvent e ) {} public void componentResized( ComponentEvent e ) {} public void componentMoved( ComponentEvent e ) {} public void componentHidden( ComponentEvent e ) {} }

--Jesse Barnum, President, 360Works
http://www.360works.com
(770) 234-9293











cobra 
enthusiast
Posts: 30

Post Rank (AVG):
            


FMP: 7
OS: Mac OS X Panther
Skill: Expert



Tweet This! Tweet This Post!
03-30-09 03:53 AM - Post#321610     - Post Rank:             
    In response to Jesse Barnum

Hi Everyone,

The script above seems to have an error in it ("choices" should be defined before "popup.setChoices..." towards the beginning of the script). The code that worked for me is as follows:
Code:
package swing; import javax.swing.*; import javax.swing.event.PopupMenuEvent; import javax.swing.event.PopupMenuListener; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.ComponentListener; import java.awt.event.ComponentEvent; import java.lang.reflect.InvocationTargetException; def popup = new PopupMenu(); String choices = "Choice 1\nChoice 2\nChoice 3"; popup.setChoices( choices.split("\n") ); popup.drawPopupMenu(); return popup.getSelectedItem(); /** * Created by IntelliJ IDEA. User: jesse Date: Jan 7, 2008 Time: 8:31:33 AM */ public class PopupMenu implements ActionListener, PopupMenuListener, ComponentListener { /*If I set transparency to 0, then it doesn't detect background clicks to close the popup, so I set it to 7, which seems like the minimum threshold */ private static final Color TRANSPARENT = new Color(255, 255, 255, 7 ); private JDialog menuFrame; private JPopupMenu popup; private String selectedItem; private String[] choices; public static void main(String[] args) throws InterruptedException, InvocationTargetException { PopupMenu popup = new PopupMenu(); String choices = "Choice 1\nChoice 2\nChoice 3"; popup.setChoices( choices.split( "\n" ) ); popup.drawPopupMenu(); System.out.println( "Selection: " + popup.getSelectedItem() ); } public void setChoices( String[] choices ) { this.choices = choices; } public String getSelectedItem() { return selectedItem; } private void drawPopupMenu() { menuFrame = new JDialog( (Frame)null, true ); popup = new JPopupMenu( "Popup" ); popup.addPopupMenuListener( this ); for( int n=0; n<choices.length; n++ ) { JMenuItem choice = new JMenuItem( choices[n] ); choice.addActionListener( this ); popup.add( choice ); } menuFrame.setUndecorated( true ); menuFrame.setBackground( TRANSPARENT ); Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); menuFrame.setBounds( 0, 0, (int)screenSize.getWidth(), (int)screenSize.getHeight() ); menuFrame.addComponentListener( this ); menuFrame.setVisible( true ); } public void actionPerformed( ActionEvent e ) { selectedItem = ( (JMenuItem)e.getSource() ).getText(); menuFrame.dispose(); /* Get rid of invisible window after making a selection */ // If you would like this to trigger a script, reeplace this with some call to a FileMaker script, like this: //fmpro.performScript(fileName, scriptName, menuText ); */ //JOptionPane.showMessageDialog( null, "You picked " + selectedItem ); } public void componentShown( ComponentEvent e ) { Point mouseLoc = MouseInfo.getPointerInfo().getLocation(); /* Absolute coordinates, need to convert to component coordinates */ mouseLoc.x -= menuFrame.getX(); mouseLoc.y -= menuFrame.getY(); popup.show( menuFrame, (int)mouseLoc.x, (int)mouseLoc.y ); } public void popupMenuWillBecomeInvisible( PopupMenuEvent e ) {} public void popupMenuWillBecomeVisible( PopupMenuEvent e ) {} public void popupMenuCanceled( PopupMenuEvent e ) {} public void componentResized( ComponentEvent e ) {} public void componentMoved( ComponentEvent e ) {} public void componentHidden( ComponentEvent e ) {} }





Edited by cobra on 03-30-09 03:54 AM. Reason for edit: No reason given.










Your continued generosity and support of FMForums is greatly appreciated.
patate 
novice
Posts: 10

Loc: Montreal
Post Rank (AVG):
            


FMP: 10 Advanced
OS: Cross Platform
Skill: Advance



Tweet This! Tweet This Post!
   This is patate's fourth post.
04-14-09 12:49 PM - Post#322964     - Post Rank:             
    In response to cobra

Hi cobra

The last modified version by Jesse Barnum is ok. You need to create a ScriptMaster parameter (if you prefer, an "input variables" in ScriptMaster.fp7) named "choices" and then, in Filemaker, you can pass a value list containing the different choices.

Edited by patate on 04-14-09 12:50 PM. Reason for edit: No reason given.










360Works offers a complete line of FileMaker plugins
and add-ons
targeted at FileMaker developers.

Icon Legend Permissions Topic Options
Print Topic

Email Topic

5069 Views
Welcome Guest...
Enter your username and password to login. If you do not have a username you can register one here

Username

Password

Remember me. Help



Forgot Password...


Quick Links
Recent Posts
Active Topics
No Replies
Recent Files
Functions & Scripts
FileMaker Pro Help
FileMaker on Twitter
FileMaker Marketplace

Custom Search

Find FileMaker Developers

Don't have time to wait,
hire a developer now!

Recent Members
Welcome them to our community!
Find FileMaker Jobs

Want a new career?
Find your new job now!

Joy of Tech
Latest Joy of Tech!

Recent Topics
Recent Hot Topics
Contribute
With your generosity we can make some real magic happen!. Support your favorite online FileMaker community...
FM Forums.com


Click here...


Or a Donation of any amount.


Thanks for your support!

Active Blogs
0 Recent blogs:
People to Post Lately in this Topic
Infomatics
JamesBand
Colin K
Jesse Barnum
Angelo Luchi
ShosMeister
cobra
patate
FM Forums Advertisers


FusionBB™ Version 3.0 FINAL | ©2003-2010 InteractivePHP, Inc.
Execution time: 1.402 seconds.   Total Queries: 117   Zlib Compression is on.
All times are . Current time is 09:02 AM
Content ©1996-2008 Ocean West Consulting, Inc. All Rights Reserved
Ocean West Consulting, Inc. can not and will not be held responsible for any of the contents in this site.
FM Forums™ is a trademark of Ocean West Consulting, Inc an independent entity, not affiliated with FileMaker Inc.
FileMaker® is a registered trademark of FileMaker Inc.
Top