Jump to content

Tim W

  • Content Count

  • Joined

  • Last visited

  • Days Won


Tim W last won the day on July 2 2012

Tim W had the most liked content!

Community Reputation

2 Neutral

About Tim W

  • Rank
  • Birthday 07/20/1963

Profile Information

  • Gender
  1. 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 );¶ }¶ ¶
  2. 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("(&nbsp;)", " ");¶ _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¶ " ) ]
  3. 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
  4. 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
  5. Hi Donna, should not $$offset = Case ( dayNow < Start Date ; -1 ; 0 ) ; be $$offset = Case ( dayNow < dayEntry ; -1 ; 0 ) ; HTH, Tim
  6. 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
  7. 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
  8. 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
  9. 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.
  10. 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
  11. 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
  12. 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
  13. 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
  14. It is as Soren describes, so move_outDate - move_inDate = number of days elapsed. HTH Tim
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.