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

  • Newbies

I have two function (GUI) in ScriptMaster Advanced, each show their own dialog (Save and Open), but if they are run in the same script (or subscript) they crash FileMaker, it does not matter whether they are registered with ScriptMaster or are from custom plugin. Also, if the same function is called in the same script (or subscript) FileMaker crashes. Here is the code for the two functions:

/*

Purpose: Asks a user to select a file to open.

Returns: File Path

Name: HIDRAOpenFileDialog ( saveTitle ; defaultDirectory )

Parameters: ( openTitle ) text

( defaultDirectory ) filepath

Dependencies: NONE

2011-09-01 JPS, Created.

NOTES:

NONE

*/

import java.awt.*;

import javax.swing.JOptionPane;

String title = openTitle;

FileDialog openDialog = new FileDialog(JOptionPane.getRootFrame(),title, FileDialog.LOAD);

openDialog.setDirectory(defaultDirectory);

openDialog.show();

if (openDialog.getFile() != null) {

selectedFile = fmpro.convertPathToFileMaker(openDialog.getDirectory() + openDialog.getFile())

openDialog = null;

return selectedFile;

} else {

openDialog = null;

return false;

}

/*

Purpose: Asks a user for a save location and filename.

Returns: File Path

Name: HIDRASaveFileDialog ( saveTitle ; defaultDirectory ; defaultFileName )

Parameters: ( saveTitle ) text

( defaultDirectory ) filepath

( defaultFileName ) text

Dependencies: NONE

2011-09-01 JPS, Created.

NOTES:

NONE

*/

import java.awt.*;

import javax.swing.JOptionPane;

String title = saveTitle;

FileDialog saveDialog = new FileDialog(JOptionPane.getRootFrame(),title, FileDialog.SAVE);

saveDialog.setDirectory(defaultDirectory);

saveDialog.setFile(defaultFileName);

saveDialog.show();

if (saveDialog.getFile() != null) {

selectedFile = fmpro.convertPathToFileMaker(saveDialog.getDirectory() + saveDialog.getFile())

saveDialog = null;

return selectedFile;

} else {

saveDialog = null;

return false;

}

Edited by jpscharf

  • Author
  • Newbies

To help determine the cause I did some additional testing:

Windows XP - no problems

Mac OS X 10.5 - no problems

Mac OS X 10.6 - no problems

Mac OS X 10.7 - crashes every time.

Tested FileDialog in the Groovy console (1.8.1). I had the script run the code four times consecutively and no crash. So the issue seems to be with either the the version of Groovy the plugin uses (1.7.6) or the plugin itself.


/*

Purpose: Asks a user to select a file to open.

Returns: File Path

Name: HIDRAOpenFileDialog ( saveTitle ; defaultDirectory )

Parameters: 	( openTitle ) text

            	( defaultDirectory ) filepath

Dependencies: NONE

2011-09-01 JPS, Created.

NOTES:

NONE

*/

import java.awt.*;

import javax.swing.JOptionPane;

String openTitle = "Hello World!";

String defaultDirectory = "/Users/jpscharf/Desktop/";

String title = openTitle;

FileDialog openDialog = new FileDialog(JOptionPane.getRootFrame(),title, FileDialog.LOAD);

openDialog.setDirectory(defaultDirectory);

openDialog.show();

if (openDialog.getFile() != null) {

  //selectedFile = fmpro.convertPathToFileMaker(openDialog.getDirectory() + openDialog.getFile())

  selectedFile = openDialog.getDirectory() + openDialog.getFile();

  //return selectedFile;

} else {

  //return false;

}

openDialog.setDirectory(defaultDirectory);

openDialog.show();

if (openDialog.getFile() != null) {

  //selectedFile = fmpro.convertPathToFileMaker(openDialog.getDirectory() + openDialog.getFile())

  selectedFile = openDialog.getDirectory() + openDialog.getFile();

  //return selectedFile;

} else {

  //return false;

}

openDialog.setDirectory(defaultDirectory);

openDialog.show();

if (openDialog.getFile() != null) {

  //selectedFile = fmpro.convertPathToFileMaker(openDialog.getDirectory() + openDialog.getFile())

  selectedFile = openDialog.getDirectory() + openDialog.getFile();

  //return selectedFile;

} else {

  //return false;

}

openDialog.setDirectory(defaultDirectory);

openDialog.show();

if (openDialog.getFile() != null) {

  //selectedFile = fmpro.convertPathToFileMaker(openDialog.getDirectory() + openDialog.getFile())

  selectedFile = openDialog.getDirectory() + openDialog.getFile();

  //return selectedFile;

} else {

  //return false;

}

Edited by jpscharf

  • Author
  • Newbies

The issue was with Default Folder, updating to version 4.4.4 resolves the issue.

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.