Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
1

Programmatically Copying a Screenshot to the Clipboard

Community Beginner ,
Feb 10, 2018 Feb 10, 2018

When extending the functionality of Microsoft Word and Excel, one can program with Visual Basic (VBA) to do some clever things.  I had created a small VBA function to take a screenshot. It works well when called from Excel. And when I save it as a local .VBS file and double-click it from my desktop, it works fine.

I would like to do the same thing from Captivate.

Here's a sample of the VBS code:

Sub TakeScreenShot()

   With CreateObject("Word.Basic")
       .SendKeys "{prtsc}"
   End With

    WScript.Sleep 1000
End Sub
   

Call TakeScreenShot

I have two separate problems:

  • From Captivate (On Success)
    • When I have an object (Click Box or SmartShape used as a button) and then On Success to Open URL or File, the .VBS file generates two separate banners in the browser, neither of which are desired.
      • Do you want to open or save [filename.vbs] (460 bytes) from (location) > with Open, Save, and Cancel.
        • I click Open (and it leads to the next warning).
      • The publisher of [filename.vbs] couldn't be verified. Are you sure you want to run the program > with Open and View Downloads
        • I click Open (and it copied the screen as a graphic into the clipboard)
  • From Captivate (JavaScript)
    • I would think there is a way to translate the code above into a similar JavaScript formatted syntax to accomplish the same thing; however, I've not been able to do that as of yet.

Questions:

  • Would you be able to guide me in how to fashion the VBS into the JavaScript syntax that Captivate would require?
  • Do you have a method/means (or code) that would enable a full screenshot being copied to the clipboard?

Thanks, in advance.

741
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 10, 2018 Feb 10, 2018

Hi,

That is an interesting challenge.

Can you describe what you want to achieve? without using the technical VB description.

for example: when the learner does X, a screenshot is captured, then Y happens. I think you might overcomplicate things and we can have a workaround to achieve your goal.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Feb 10, 2018 Feb 10, 2018

I would like to have a button, that when clicked, would take a copy of the screen just as it is.  (This would be similar to pressing WIN+PrnScr). Nothing else happens.

The only difference at this point is that the user obtained the screen copy by a clicking an object rather than having to remember a keyboard combination.

From here, I would like to extend it so that the graphical image in the Clipboard can either be:

a) pasted in an email

b) pasted into a file & saved

For now, baby steps. If I can achieve a screen shot into the clipboard with a click of an object (instead of keystrokes), that would be a great start.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 13, 2018 Feb 13, 2018

Hi,

that makes sense. In the past, I used a script that would save a 'certificate of completion' (quiz result slide) as an image by 'printing' a pdf or saving a windows bmp (not great).

If I find the script again I will post here

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jul 04, 2018 Jul 04, 2018
LATEST

Hope you're enjoying the holiday and not worrying about issues/requests.

That said, any update on this?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Help resources