Text in layout formatted as hyperlink with script attached.
You can use the Open URL Script step in ScriptMaker to open URL's.
About the Open URL script step:
Open URL [No dialog; <URL>]
- Perform without dialog prevents the "Open URL" Options dialog box from displaying when the script step executes.
- Click Specify to display the "Open URL" Options dialog box, where you can type the URL directly in the text entry area or click Specify to create your URL from a calculation.
This script step is web-compatible.
Allows the user to open a URL. Open URL supports http, ftp, file, and mailto URL types. For example, if the URL starts with http, FileMaker Pro opens the user's web browser and processes the URL.
Note FileMaker Pro uses the preferences stored in the Windows system file URL.DLL to determine the application to handle the URL. The URL is then passed to ShellExecute for execution.
If the user has configured the Internet system preferences, this script step allows the user to open a URL. Open URL supports http, ftp, file, and mailto URL types, using the applications specified in either the control panel or system preferences. For example, if the URL starts with http, FileMaker Pro opens the user's web browser and processes the URL.
1. The following example is a script that can be assigned to a button which opens the user's web browser and displays the URL specified in a field within the file:
Open URL [No dialog; MyFile::MyField]
where `MyFile' is the FileMaker Pro database name and 'MyField' is the field that stores different URL's to navigate to.
2. The following example opens the user's web browser and displays the FileMaker, Inc. home page (the URL specified when the Open URL script step was defined):
Open URL [No dialog; "http://www.filemaker.com/"]
3. The following example opens Windows Notepad and opens the file My_File.txt on the root level of the user's hard disk:
Open URL [No dialog; "file://c:/My_File.txt"]
4. The following example launches the preferred email application, opens a new email message, and uses the value in the Email Address field to address the message. The email address must start with mailto:.
Open URL [No dialog; "mailto:email address"]
5. You can also use the Open URL script step to open a shared FileMaker Pro file running on another system, as follows:
Open URL [No dialog; "fmp7://system:user@testlab-mac/testdb"]
where `system' is the FileMaker Pro account name, `user' is the password, `testlab-mac' is a DNS entry for the machine where the file resides (you can also use an IP address for this parameter), and `testdb' is the FileMaker Pro filename.
Important Account name and password information entered in an Open URL script step is visible to users with script editing access privileges, and is therefore not secure.
- Open Manage Scripts
- Click new
- give your script a name.
- Double click Open Url on the list of steps down the left hand side of the script editor to add this step to your script.
- Click the specify button.
- click the Specify button in the dialog that pops up when you click the first specify button.
- Find your field in the list of fields at the top of the specify calculation dialog and double click it to add it to this calculation.
- Click OK in both dialogs to close them and get back to the script editor.
- You should see: Open URL [Yourtable::yourField], but with your table and field names.
- Click OK to close the script editor, saving your new script.
- Return to your layout.
- Enter layout mode
- Click your field. Select button Setup... from the format menu.
- Select the perform script option.
- Click the specify button and select your script as the script to be performed when the field is clicked.
Please note: this may not work without first using a calculation to modify the data in your imported text. This is why I asked you to post an example of what you are importing as a hyperlink so that I could suggest such a calculation if one is needed. You can use the Post A Answer box here to post that info as part of these same discussion thread.
Thanks for the steps you outlined. Very helpful.
Here is a sample file path in the FM Pro 12 text field that I would like to make linkable. Do I need to add anything in calculations to make it work correctly?
I followed the steps you outlined and for some reason the link opens my pictures directory and not the file the link corresponds to.
That should have opened the file, but I should have had you also click the "no dialog" button to get:
Open URL [No dialog ; Yourtable::yourField]
But make sure that you do not have:
Open URL ["YourTable::YourField"]
This works very well.... thanks again!
I have followed the steps for this exactly. I have successfully created a button from the Form View and List View. The button doesn't appear in the Table View though. How can I make that happen?
Buttons are not visible in the body of the layout when you are in table view. Use list view instead. You can arrange fields in a row and reduce the size of the body layout part to just the minimum needed to display a row of fields and your buttons. In browse mode, this will look and function very similar to your table view.
You can put buttons in the header of a table view when you use layout setup and select the options for table view that makes the header visible, but I don't imagine that a button in the header will work for you.
Okay. In table view, what is the easiest way to create a hyperlink with text to display? I can add a hyperlink, but it comes out as simply text.
I suggest that you not use table view. Table view is best suited as a "debugging overview" of your data for diagnosing issues with your data or your database design. It's not the most user friendly view for general users to use when they access your database.
If you must use table view, add the URL field to your layout while in layout mode. It doesn't matter where you put it as long as it is in the layout body somewhere. Right click this field and add an OnObjectEnter trigger to perform the Open URL script.
Can you please provide step by step instructions for the table view option.
Enter layout mode.
Use the field tool from the tool bar to drag and drop a field onto your layout. Drop it anywhere.
Specify fields pops up. Select the the field you want from this dialog.
Right Click the field (or the Mac equivalent) and select Script Triggers from this pop up menu.
Click OnObjectEnter check box.
Click Specify and select the script you want performed when you click or tab into this field.
Return to browse mode and test.
You may need to click the modify button to place this field where you want it in your table view.