cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Try the Materials Informatics Toolkit, which is designed to easily handle SMILES data. This and other helpful add-ins are available in the JMP® Marketplace
Choose Language Hide Translation Bar

Inserting hyperlinks

As two separate exercises, I want to (a) allow users of a JSL script I'm writing to link to a web page that I've referenced in one of the output windows, and (b) open MS Outlook to email someone by clicking on a link that I've supplied, with the address of the recipient and the subject of the email already prepopulated, but with the actual content of the message to be filled in by the user.  I've found the "web" and "mail" functions, but can't see how to use them in this context.  I'm running the script from Windows only, and I'd like to be able to do this in either JMP 8 or 9, if that's relevant to the question.

Many thanks

1 ACCEPTED SOLUTION

Accepted Solutions
ms
Super User (Alumni) ms
Super User (Alumni)

Inserting hyperlinks

Mail() takes an optional fourth argument for attachments. It should be possible to save the log window content as a textfile and then attach it to the email. Another possibility is to add the Log output at the end of the message. Below is an expanded version of the above script that enables the user to describe the problem in her own words and the current log content is added below automatically. I tried on Windows 7 and JMP 9. The Mail ended up in Outlook's outbox and appeared as intended.

New Window( "test",

  Lineup Box(

                    2,

  Text Box( "Follow this link" ),

                    bb1 = Button Box( "http://www.jmp.com/", Web( "http://www.jmp.com/" ), Underline Style( 1 ) ),

  Text Box( "Send mail to" ),

                    bb2 = Button Box( "test@example.com",

  New Window( "Message text",

                                        <<modal,

                                        message = Text Edit Box( "Write mail message", <<set width( 200 ), <<setnlines( 10 ) ),

  H List Box(

  Button Box( "Ok",

                                                            content = message << get text || "\!r\!rLog Window\!r" || (Window( "Log" )[1] << show window( 1 ) << get text)

                                                  ),

  Button Box( "Cancel" )

                                        )

                              );

                              subject = "Problem with your application";

                              Mail( "test@example.com", subject, content )

                    ),

                    bb2 << Underline Style( 1 )

          )

);


View solution in original post

4 REPLIES 4
ms
Super User (Alumni) ms
Super User (Alumni)

Inserting hyperlinks

I am not sure I have understood what you want, but maybe you can use the underline style of Button Box() as a hyperlink substitute? The example below is only tested in JMP9 for Mac (Mail() not working!).

New Window( "test",

  Lineup Box(

                    2,

  Text Box( "Follow this link" ),

                    bb1 = Button Box( "http://www.jmp.com/", Web( "http://www.jmp.com/" ), Underline Style( 1 ) ),

  Text Box( "Send mail to" ),

                    bb2 = Button Box( "test@example.com", Mail( "test@example.com", "example", "Windows only" ), Underline Style( 1 ) )

          )

);

Inserting hyperlinks

That's most of what I need, and very helpful in its own right, thank you: I hadn't actually realised that the "Underline Style" property of a button box would make a button look like a hyperlink (or to be more accurate, I'd forgotten it - it's a long time since I've attempted to do this sort of thing).

What I'm trying to do in the second part of the question is simply to launch Outlook from within JMP, so that the user can quickly type in a description of a problem he's having, and email it to me.  I'd want the resulting email automatically entitled "Problem with your application", or something like that.  As an afterthought, it occurs to me that it would be phenomenally useful also to have the log automatically attached to the email.  Would something like that be possible?

Many thanks,

David

ms
Super User (Alumni) ms
Super User (Alumni)

Inserting hyperlinks

Mail() takes an optional fourth argument for attachments. It should be possible to save the log window content as a textfile and then attach it to the email. Another possibility is to add the Log output at the end of the message. Below is an expanded version of the above script that enables the user to describe the problem in her own words and the current log content is added below automatically. I tried on Windows 7 and JMP 9. The Mail ended up in Outlook's outbox and appeared as intended.

New Window( "test",

  Lineup Box(

                    2,

  Text Box( "Follow this link" ),

                    bb1 = Button Box( "http://www.jmp.com/", Web( "http://www.jmp.com/" ), Underline Style( 1 ) ),

  Text Box( "Send mail to" ),

                    bb2 = Button Box( "test@example.com",

  New Window( "Message text",

                                        <<modal,

                                        message = Text Edit Box( "Write mail message", <<set width( 200 ), <<setnlines( 10 ) ),

  H List Box(

  Button Box( "Ok",

                                                            content = message << get text || "\!r\!rLog Window\!r" || (Window( "Log" )[1] << show window( 1 ) << get text)

                                                  ),

  Button Box( "Cancel" )

                                        )

                              );

                              subject = "Problem with your application";

                              Mail( "test@example.com", subject, content )

                    ),

                    bb2 << Underline Style( 1 )

          )

);


Inserting hyperlinks

Ingenious: that neatly avoids the need to open Outlook at all, and it also suggests other possibilities as well - like asking the user to fill in a form of check boxes, radio buttons or summarize what he was doing at the time the problem became apparent, after which the results of such a survey could be summarised in JSL and automatically appended to the content.  That's perfect - many thanks!

David