locked
Suggestions to automate grabbing and inserting most recent image deposited on Mac into Word Document RRS feed

  • Question

  • I'd like to set up some sort of automation that would allow me to speed up a process that I use frequently.

    I record videos of MS Office classes being taught online (via WebEx or Zoom) at work and then create personal outlines based on those recordings.  I use Snagit to capture each action happening on the screen, add an arrow to highlight the function or button on the screen that's being discussed, then I save it to a specified folder on my Mac.  I then switch to WORD 2016 on MAC, and then manually pick that most recent image and insert it into the WORD Document, add a few lines in text explaining the action.

    I then go back to the video and move to the next image to grab and keep repeating this process.

    Typically I'm manually inserting hundreds of images in my outlines.

    I've created a keyboard shortcut to bring up the INSERT PICTURE command, and it's sitting in the right folder where I deposit the most recent screen grab, but I still have to select it and hit OK.

    I'm not really familiar with scripting or macros', but am wondering if there is some way to automate this process such that the moment I save the last screen grab to the mac, I can hit some automation (or maybe not even have to) and have that most recent image be grabbed and inserted into WORD in the spot where I left my cursor.  This would save alot of manual key hitting.

    Don't know if this is possible but was wondering how other might approach this workflow, and speeding it up as I described.

    Thanks.

    Thursday, May 14, 2020 9:07 PM

All replies

  • Hi Brvid,

    Thanks for posting here. Since this forum focuses more on general questions related to Office desktop applications, if you need further assistance on this problem, I'd recommend you post a new question to the following forum: Microsoft Office for Developers > General Office Development. You may get more helpful replies there.

    As you mentioned in your question, there is no such build-in feature in Office for Mac to help you get your needs. You may need scripting, macros or workflows to get the process done automatically. 

    If you have any updates, feel free to post back to let us know.

    Best Regards,

    Herb


    Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.

    Click here to learn more. Visit the dedicated forum to share, explore and talk to experts about Microsoft Office 2019.

    Friday, May 15, 2020 8:45 AM
  • It can be done, but there are quite a lot of steps involved. I'll just step through them as best I can and maybe that will help you decide whether to try to proceed or not.

    The overview is that you can specify an AppleScript that will run whenever one or more new files are added to a specified folder. 

    1. This is an AppleScript I wrote to take those files and insert them at the end of a pre-specified Word document. Copy the text into a file called insertsnagit.applescript and save it on your Mac. NB, to work with this script, you'll have to have Word installed on the Mac.

    (*
    insert new snagit capture pictures into Word
    *)
    
    -- set this to the old-style "full name" of the document you want to work with
    property picture_doc_full_name : "Macintosh HD:Users:demo1:Documents:snagitpics.docx"
    
    
    on adding folder items to this_folder after receiving added_items
    	try
    		tell application "Microsoft Word"
    			activate
    			set doc_is_open to false
    			set theDocs to the documents
    			repeat with doc in theDocs
    				-- if the doc is already open, make a reference to it
    				if the (full name of doc) as text is picture_doc_full_name as text then
    					set doc_is_open to true
    					set theDoc to doc
    					exit repeat
    				end if
    				
    			end repeat
    			if not doc_is_open then
    				--otherwise try and open it
    				open picture_doc_full_name
    				set theDoc to document picture_doc_full_name
    			end if
    			tell theDoc
    				repeat with added_item in added_items
    					set theRange to collapse range (the text object) direction collapse end
    					insert paragraph at theRange
    					set theRange to collapse range (the text object) direction collapse end
    					make new inline picture at theRange with properties {file name:added_item as text, link to file:false}
    				end repeat
    			end tell
    		end tell
    		
    	end try
    end adding folder items to

    2. Double-click on the file and with any luck it will open in the Mac Os(x) Script Editor. If not, navigate to your APplications Folder then the Utilities subfolder and try to open the Script Editor from there, then open the .applescript.
     
    3. You will see that I have specified the name of a Word document at the top, here:

    property picture_doc_full_name : "Macintosh HD:Users:demo1:Documents:snagitpics.docx"
    

    4. You need to change that to be the path and name, using "AFS" syntax with the colons of an existing Word Document where you want to insert the pictures from Snagit.

    5. Now you need to save that file to a special folder. There are at least two places that Mac OS looks for this kind of script - the global Library, and your User library. Let's just deal with the User Library option as there are fewer security issues.

    6. In the finder, Select the Go menu, then press the Alt (Option) key and you should see the Library option appear in the menu. (Or hold the Alt key and select Go if you prefer). Select Library, and look for a folder called Scripts. If you don't see it, create it. Inside the Scripts folder, look for a folder called Folder Action Scripts. If it isn't there, create it. Then save your script there if you can. You will probably need to use the File->Export option in the Script Editor, and preferably choose the "Script" option, which has a .scpt extension. (Actually, leaving it as a.applescript .text file seems to work pretty well here).

    7. Back in Finder, select the folder where you are saving your images from Snagit. AN important point is that as things stand, the script I have written assumes that you are just saving the images that you want in your document there. If you are saving other stuff such as Snagit Project files, you will need to change the Applescript so it ignores them. But initially, you can test this script just by using FInder to drag and rop copies of image files into that folder.

    8. Right click on the folder, and click on the Folder Actions Setup option (or you may need to open the Services option, then the Folder Actions Setup option). At various points you will probably get some messages which you'll need to deal with. e.g. there's a dialog box where you need to choose "Run Service"

    9. You should see a dialog box with a checkbox titles "Enable Folder Actions". Check it. Get through all the questions. Then in the right-hand column of the dialog box, click the + sign at the bottom. You should see a ist of predefined Actions (these are stored in that Global Library folder) and you should see the script you put in your personal Library folder. Select it, and the script name should appear in the right-hand box. Ensure that the checkbox next to the folder name in the left hand box and the one to the left of the script name are both checked. Then close th dialog.

    10. I suggest you then open Word, open the image document we discussed earlier, then in the FInder, drag an image file into the folder you've just configured and see what happens. In theory you shouldn't have to open Word first, but at first it's best to avoid any dialogs Word chooses to pop up.

    At the moment the script just adds a paragraph at the end of the document then inserts the image after that (and repeats if you drag multiple images in).

    To be honest I will be pretty amazed if you get through that lot and it works, but at least you wll have some idea about how it can be done and what kinds of things you need to do to make it all happen. Although I have just used an Applescript here in an attempt to cut down the number of steps involved, personally I would probably do as much as possible in a VB macro and call that from the AppleScript. It's just so much easier to get things to work and debug stuff in VBA.



    Peter Jamieson

    Monday, May 18, 2020 4:52 PM
  • Hi,

    I am checking the status of this issue. Do you have any update for it?

    If the replies are helpful to this question, please remember to mark them as answers. Your action would be helpful to other users who encounter the same issue and read this thread. Thanks for your understanding.

    Anything unclear or any questions, feel free to post them back to let us know. I will be glad to follow up and help you.

    Best Regards,

    Herb


    Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.

    Click here to learn more. Visit the dedicated forum to share, explore and talk to experts about Microsoft Office 2019.

    Friday, May 22, 2020 2:05 AM