Jump to content

Am seeing an error msg when registering my scripts


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

Recommended Posts

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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