Does Jmp have a possibility to trigger "paste clipboard" in Powerpoint - after copying a graph to the clipboard.
Hi @hogi,
My favorite way to do things like this (on my Mac) is to use RunProgram() to run some AppleScript. Here's my process there, which I hope will be helpful if you're adapting for Windows.
On the JMP side, we're going to use RunProgram() to execute a bash script we'll make:
Run Program( Executable( "~/Desktop/pastePowerpoint" ) );
To make the bash script, we open a plain text file and write the bash to AppleScript invocation, and then the AppleScript. Here's the full contents of that plain text file:
#!/bin/bash osascript <<END tell application "Microsoft PowerPoint" activate tell application "System Events" keystroke "v" using {command down} end tell end tell END
Once we save that (with no extension), we need to make it executable. In Terminal, we can run the following (still assuming this is on your desktop):
chmod 755 ~/Desktop/pastePowerpoint
And that's it! Hope this helps!
@jules
Thanks @jules.
Concening Windows, ChatGPT suggested to use a PowerShell Script:(assuming that the JSL script and ps1 code are saved in the same folder)
Try(Current Report()<< Copy Picture(); If( Host is( "Windows" ), PowerShellScriptName= Convert File Path( "", windows ) ||"PastePicture.ps1"; runOptions = "-File \!""|| PowerShellScriptName||"\!""; MyResult = Run Program( Executable( "PowerShell.exe" ), Options( {runOptions} ), ReadFunction( Function( {this}, Write( this << read ) ) ) ) ));
pastePicture.ps1:
$ppt = New-Object -ComObject PowerPoint.Application $ActivePPT = $ppt.ActiveWindow if ($ActivePPT -eq $null) { return "no active ppt" } else { $slide=$activeppt.Presentation.Slides($ppt.ActiveWindow.Selection.SlideRange.SlideNumber) $shape = $slide.Shapes.Paste() return 0 }
I added the windows version (via PowerShell) to the GraphBuilder toolbar:Graph Builder Toolbar