- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Can JMP launch an excel.xlsm file?
Is JMP jsl able to "launch" an Excel .xlsm (macro'ed) file, such that it essentially "double clicks" the file to open it and does not try to import it?
I am using an Excel macro for database extraction because it is 100X faster than the JMP ODBC extraction tool and would like my jsl code to run the macro'ed file.
Thanks in advance!
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Can JMP launch an excel.xlsm file?
Woops, I missed the file extension in the last line:
/* Function: openFileInOSDefault
Open file in the operating system default program
Include this once at the top of your script
Arguments:
filepath - local path file
*/
openFileInOSDefault = Function({filepath},
If( Host is( "Windows" ),
Run Program(
Executable( "PowerShell.exe" ),
Options(
Eval Insert( "\[-Command "& {Start-Process '^filepath^'}"]\" )
),
Read function( "text" )
);
,
RunProgram(
Executable( "/usr/bin/open" ),
Options( filepath ),
ReadFunction( "text" )
)
);
);
//Now in your script you can just call the function
openFileInOSDefault("C:\Users\Me\Desktop\test.xlsx")
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Can JMP launch an excel.xlsm file?
See the function
in the Scripting Index
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Can JMP launch an excel.xlsm file?
Thanks @txnelson , but I am not sure this is the answer. If I do not know where the "Excel.exe:" is kept on someone else's computer, how can I share my script with others?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Can JMP launch an excel.xlsm file?
If you know everyone is on windows or has Powershell installed you can use Run Program to open the file using the default program defined by the OS:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Can JMP launch an excel.xlsm file?
Let's say I want to open a file called "Test.xlsx" that is located at "C:\Users\Me\Desktop\". What would the code look like?
I have tried the following but it does not seem to work:
rp0 = Run Program(
Executable( "Excel.EXE" ),
Options("C:\Users\Me\Desktop\test"),
Read Function("text")
);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Can JMP launch an excel.xlsm file?
Give this a try:
/* Function: openFileInOSDefault
Open file in the operating system default program
Include this once at the top of your script
Arguments:
filepath - local path file
*/
openFileInOSDefault = Function({filepath},
If( Host is( "Windows" ),
Run Program(
Executable( "PowerShell.exe" ),
Options(
Eval Insert( "\[-Command "& {Start-Process '^filepath^'}"]\" )
),
Read function( "text" )
);
,
RunProgram(
Executable( "/usr/bin/open" ),
Options( filepath ),
ReadFunction( "text" )
)
);
);
//Now in your script you can just call the function
openFileInOSDefault("C:\Users\Me\Desktop\test")
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Can JMP launch an excel.xlsm file?
I get this error, thoughts?
"Start-Process : This command cannot be run due to the error: The system cannot find the file specified.
At line:1 char:4
+ & {Start-Process 'C:\Users\Me\Desktop\test'}
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [Start-Process], InvalidOperationException
+ FullyQualifiedErrorId : InvalidOperationException,Microsoft.PowerShell.Commands.StartProcessCommand
"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Can JMP launch an excel.xlsm file?
Woops, I missed the file extension in the last line:
/* Function: openFileInOSDefault
Open file in the operating system default program
Include this once at the top of your script
Arguments:
filepath - local path file
*/
openFileInOSDefault = Function({filepath},
If( Host is( "Windows" ),
Run Program(
Executable( "PowerShell.exe" ),
Options(
Eval Insert( "\[-Command "& {Start-Process '^filepath^'}"]\" )
),
Read function( "text" )
);
,
RunProgram(
Executable( "/usr/bin/open" ),
Options( filepath ),
ReadFunction( "text" )
)
);
);
//Now in your script you can just call the function
openFileInOSDefault("C:\Users\Me\Desktop\test.xlsx")
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content