Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

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

how about posting the function

bit hard to guess otherwise.

  • Author

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¶
" ) ]

  • Author

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 );¶
    }¶

Create an account or sign in to comment

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.