-
Posts
213 -
Joined
-
Last visited
-
Days Won
1
Everything posted by Tim W
-
Am seeing an error msg when registering my scripts
Tim W replied to Tim W's topic in ScriptMaster by 360 Works
Update, Thru trial and error this is the function which will not register. I think i see the problem with line 1. Should i change the reference to package swing ?? RegisterGroovy( "PopupMenu( choices )" ; "package swing;¶ ¶ import javax.swing.*;¶ import javax.swing.event.PopupMenuEvent;¶ import javax.swing.event.PopupMenuListener;¶ import java.awt.*;¶ import java.awt.event.*;¶ import java.lang.reflect.InvocationTargetException;¶ ¶ def popup = new PopupMenu();¶ popup.setChoices( choices.split("n") );¶ popup.drawPopupMenu();¶ return popup.getSelectedItem();¶ ¶ public class PopupMenu implements ActionListener, PopupMenuListener, ComponentListener, MouseListener {¶ /*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 1nChoice 2nChoice 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, 0, 0 );¶ menuFrame.addComponentListener( this );¶ menuFrame.addMouseListener( this );¶ menuFrame.setVisible( true );¶ }¶ ¶ -
Am seeing an error msg when registering my scripts
Tim W replied to Tim W's topic in ScriptMaster by 360 Works
Here is the first one #Register ZipCode Query Function - Scriptmaster // Set Variable [ $ZipQuery; Value:RegisterGroovy( "QueryUSPSZipCode( _addr1 ; _addr2; _city ; _state )" ; "URLConnection conn = new URL("http://zip4.usps.com/zip4/zcl_0_results.jsp" ).openConnection();¶ ¶ //Send POST data¶ conn.setDoOutput( true );¶ Writer w = new OutputStreamWriter( new BufferedOutputStream( conn.getOutputStream() ) );¶ w.write( "address1=" + URLEncoder.encode( _addr1 ) );¶ w.write( "&address2=" + URLEncoder.encode( "" ) );¶ w.write( "&city=" + URLEncoder.encode( _city ) );¶ w.write( "&state=" + URLEncoder.encode( _state ) );¶ w.write( "&visited=1&pagenumber=0&firmname=&urbanization=&zip5=" );¶ w.close();¶ ¶ //Read result¶ String _html = conn.getInputStream().getText();¶ ¶ // get rid of r, n and t¶ _html = _html.replaceAll("(rn|r|n|nr|t)", "");¶ // replace each & nbsp; and <br /> with a space¶ _html = _html.replaceAll("(& nbsp;)", " ");¶ _html = _html.replaceAll("( )", " ");¶ _html = _html.replaceAll("(<br />)", " ");¶ ¶ _output = ""¶ //grab the addresses w/ zips¶ match = _html =~ /<td headers=.*?>(.*?)</td>/¶ if(match.count == 0) {return "None found."}¶ for(i in 0..match.count-1)¶ {¶ _output += match[1]¶ if(i % 2 == 0) ¶ {_output += " "}¶ else¶ {_output += "n"}¶ }¶ ¶ return _output¶ " ) ] -
Am seeing an error msg when registering my scripts
Tim W posted a topic in ScriptMaster by 360 Works
The error is: "java.lang.IllegalArgumentException. You cannot specify a package for scriptmaster modules.Remove the first line and try again. Any ideas?? Java 7 v 15, Windows 7 64bit OS, FM 11 v 3, FMS 11 v 5, SM v 4.201 When I comment the SetVariable script step registering the functions for SM the error no longer appears. I tried to get the 7 v25 java to work updated the plugin but could not maintain connection to server. I created a plugin earlier when I had SM 4 Advanced. Could that be the problem with Java 7 . 25? Thanks for the help, Tim -
"Strongest" way to pass multiple parameters.
Tim W replied to Drew Sanderson's topic in Script Workspace and Script Triggers
Hi Drew, I first latched-on to using a simple string syntax with a "¶" between each element and using a shorthand custom function like http://www.briandunning.com/cf/581 GSP() for extraction. It is simple and powerful with the only exception so far that paragraph text needs a helper function to substitute the "¶" on each end to preserve the element. I like the SFR concept, but have not really warmed up to it's use. An XML style format has also occurred to me as a possiblility with the self describing nature of XML, but thus far simple has won out. Tim -
Case Statement - only last statement not working
Tim W replied to dschaal's topic in Calculation Engine (Define Fields)
Hi Donna, should not $$offset = Case ( dayNow < Start Date ; -1 ; 0 ) ; be $$offset = Case ( dayNow < dayEntry ; -1 ; 0 ) ; HTH, Tim -
I hate to extend this point, but I cannot see how the attached file could be closed without my script firing and giving the use a chance to change their mind and stay in the file. Could someone please expose the hole in my logic without modification to the file, remembering that users do / will not have layout, script or design database access? please see the sample file attached. QuckReference12.zip
-
Hi Reid, Why not create a record field (brain ahead of fingers again) in the employee table and refer/update it each time a task starts or finishes. You could tie it to a date field which could be set when it is not equal to the current date. The max function or any find would bring a certain degree of overhead since it would have to create a found set and walk the records to get the greatest value. Also, with this way of doing it am/pm would be controlled with less effort. HTH, Tim
-
Thanks, Vaughn My situation is a Separation model with one interface file. Under that model, I can trap for the quiting of the application since all layouts, for the user, are in the interface file. As for WHY, it seemed like a good idea in version 5 and just got copied over version after version. Error code 13 doesn't halt/pause execution( silent failure) so I did not notice. With the move to version 12, many things are being refined and questioned, for the possibility of a better way. Tim
-
David, Add a "Close File[ datafile]" to your relogin script just before you insert the new credentials. That way filemaker will open the file when you hit the data layout with the credentials of the new user. HTH, Tim BTW, have your relogin script change the layout to one based on the interface file before you do the above.
-
Dashboard Opinion and advice Two Monitors
Tim W replied to Walter-MainFrame's topic in External Data Sources
Walter, I am not experienced with IWP, however windows 7 does remember what monitor programs were last viewed in. I know this does not help much. What you are after is moving the application window which is best done thru the OS. Try googleling "windows management win xp" a few hits look promising. HTH, Tim -
Hi Agnes, It is a system shut down script. The logic is that on the response from the user this script (which is in the interface file) sends a close file command for each of the 6 datafiles which may or may not be actively open on this users client. After each datafile is addressed it goes to the splash layout and Exit Application. Two scripts work to trap users who click on the Red X at the top of the application window to close the database. Attached are the scripts. Thanks, Tim CloseScript.pdf ForceCloseScript.pdf
-
Hi All, In a FM Server hosted database with multiple files, is it necessary to close each file as the user exits? I see the need to do this in a single user environment, but when the files are hosted on server they are always open until closed by the server. The reason i ask is that while debuging my quit script one of the data files(Separation Model) threw an error 13 (file in use) since that data file was opened on the client by reference. Any one know the best practice is relative to the "Close File" script step?? Thanks in advance, Tim
-
How many days between two dates calculation?
Tim W replied to JTSmith's topic in Calculation Engine (Define Fields)
No problem, We all have to learn the basics, best way to learn .... Keep asking questions. Use a Let and a case statement as the field formula like so.... Let( dys = Move_In_Date - Get(CurrentDate); Case( dys > 0; dys & " Days"; "Moved In") ) Look up these two functions in help to get the syntax so you understand how to use them. They are very useful and learning them will be worth much more than the effort. HTH, Tim -
How many days between two dates calculation?
Tim W replied to JTSmith's topic in Calculation Engine (Define Fields)
It is as Soren describes, so move_outDate - move_inDate = number of days elapsed. HTH Tim -
Hi Sandy, It is in the edit privilege set window. It must be set for all accounts in the privilege set. >File>Manage>Accounts & Privileges>Privilege Sets Hope that helps, Tim
-
Hi Jesse, Thanks for the offer. I am trying to learn to fish, ("Give a man a fish... feed him once, teach him to fish... feed him for a lifetime") so I guess I must push on researching for myself. Thanks for the great tool "Scriptmaster", it has and continues to make the learning easier. Tim
-
Thanks Jesse, Not the best news, but I can live with it. In the Popup Menu (one of the GUI functions in question), I cannot seem to get the part which needs to be set to change the background color of the dialog. Is it the JDialog? or should I address the object itself? or do I need to look at modifying the method? Just a direction would help alot. I'm trying to learn groovy, but java seems to be getting in the way. This module seems to be pure java, ;'s and all. Thanks again, Tim
-
Hi, I use this in a system I am developing. See http://www.kevinfrank.com/demo-files.html for the technique file "Absolute Layout References" for the details. Basically two custom functions are used one to read the ID and one to get the layout number for the ID to navigate. Ray Cologon also has a demo file related to this http://www.nightwing.com.au/FileMaker/demos9/demo915.html He calls it UNBREAKABLE, so I believe it to be good practice to use a similar technique. HTH, Tim
-
I am using v.4 on windows xp sp3 and experiencing a screen redraw twice during the execution of my scriptmaster function. Is there a way to avoid the screen redraws? Thanks, Tim p.s. I have this same issue if registering the function in my startup script or running the function from the sample file.
-
Hi Ron, Another thing occurred to me, if you are still having this same problem. How does the layout get loaded? Is the TO the same as the previous layout? You might have a record that has not been committed? Add a commit record step in your script to load the new layout. Maybe worth a try. Hope this helps, Tim
-
Hi Dennis, Works fine for me could be a filemakereaz terminology. I attached my copy of the sample file with a working calc field. Hope this helps, Timothy R Whisenant PS, if you run into any other problems learning the forum has many skilled contributors & lest I forget....WELCOME to the Forum. Mod_Sample.zip
-
Hi Ron, A little background would be very helpful here. What do you mean by focus? OnLayoutLoad script trigger? go to field in startup script? I script the type of thing it sounds like you want, bear in mind the order of script steps can trip you up. So, if this is what you are trying a copy of the script will be needed to help you properly. Thanks, Tim
-
Calculation seems simple (of course) but isn't working..
Tim W replied to kath's topic in Calculation Engine (Define Fields)
Hi Kath, I would use relationships to accomplish this task. Please see the attached file for an example. Thanks, Tim Mod_Student_Record_081609.zip -
Hi JW; I would use an autoenter calc in table a field x like relatedtable::fieldx with the "do not replace existing" checked in the field definitions. You could also use the calculation in the field definitions. Case( isempty(Field Y);relatedtableB::Field X; Field Y) ps, my syntax may not be exact(typing from memory) Hope this Helps, Tim