How to complete a File/Save box

I’m just getting started with KM and I’m having problems with a macro that is intended to save a file away. My object is to use the Print menu in a particular application, Snagit, to save an image away as a PDF file with the name “temp” which I’ll be dealing with later. I can open the Save as PDF menu OK but I’m having problems entering the “temp” filename and then clicking the Save button.

Normally when the Save menu is opened the Save As box has “Untitled” as the filename and it has the focus so I thought I just has to type in the “temp” name but sometimes it doesn’t have the focus. Also the Save button is highlighted and I thought I just had to tab out of the Save As field and press return to save the document but this doesn’t work. Here’s what I’ve been using:

Maybe this will help. This macro automates the SnagIT Save As process, and then reveals the file in Finder.

##Macro Library   SnagIT -- Save Image


####DOWNLOAD:
<a class="attachment" href="/uploads/default/original/2X/0/0260f741fa5b842f021a6c3dd64f828e4fc205a4.kmmacros">SnagIT -- Save Image .kmmacros</a> (6.0 KB)
**Note: This Macro was uploaded in a DISABLED state. You must enable before it can be triggered.**

---


<img src="/uploads/default/original/2X/4/457ed1f666e4943db1c88caa76506dbfb8152d4d.png" width="459" height="425">
1 Like

Many thanks for this, I’ve not tried it out yet. I would though very much like to know where I was going wrong. I had intended to show my macro but I couldn’t work out how to upload it in a form other than basic text and I sent off my posting without it by error and then found I wasn’t allowed, as a first time poster, to send another postimg within 24 hours. How should I upload my Macro?

See

Here's my macro which I couldn't upload originally:

“Print as PDF”

Print as PDF.kmmacros (4.1 KB)

Thanks for that, I’ve now uploaded the macro.

That’s grand thanks. I hadn’t realised that you can start a macro by adding it to a floating palette and I’ve changed the trigger to that as you had done. I’ve also made the other two changes and it’s working fine now.

Just one other thing. I’ve accepted the default folder to save the file to but if I wanted to change this how do I navigate to that field to change it?

1 Like

While you are in the "Save" dialog, you can switch to any folder:

Your English is very good. I was wanting, in my macro, to be able to save the file to the desktop, as I think your macro did - the default folder I’m shown is the Documents one. I suppose I could pause the macro and make this change manually but I’d like the macro to do this for me.

Yes I appreciate that but I wanted the macro to make the change without me having to do this manually.

In order to programmatically set a path in an Open/Save dialog I would use the "Go to the folder" sheet (G).

First, to understand what I mean, manually open an Open/Save dialog in any program. Then press G.

The "Go to the folder" sheet has two advantages:

  • Once invoked it has focus
  • You can enter any POSIX-style path (e.g. ~/Documents/blabla)

To implement it in the macro just use a "Type the Keystroke" action with "⇧⌘G", then a "Insert Text by Typing" action with the path, followed by a Return keystroke.

As always with GUI scripting, pay attention to the timing, that is, use "Pause" or "Pause until" actions where needed.

2 Likes

For the Documents folder, you can just type Command-Shift-O in the open/save dialog box. The macro can pause while the open/save dialog box appears, and then use the Type a Keystroke action to switch to the Documents folder.

I think @Tom nailed it for you in his above post.

That’s grand thanks, it gives me what I want.

Thanks for this. I’d not come across these keyboard shortcuts before, neither that one nor the ⇧⌘G one.

Yes @Tom has given me what I want.

Great!

If you are using some "standard" folders as destination then keep in mind Peter's post.

To see all available "standard" folders and their shortcuts…

  1. Go to the Finder
  2. Open the Go menu from the menu bar

You should see something like this:

(Toggle the Shift key will the menu is open to see all.)

Most of these shortcuts also work in Open/Save dialogs, that is, you can type them via a KM Keystroke action.

3 Likes

Ah, so that’s where these shortcuts are shown. I have used the Go menu in the past to go to a folder in the root and didn’t take in all these keyboard shortcuts. Many thanks for mentioning this.

If one of the above posts solves your problem/question as originally stated, please check the "Solved" checkbox (click for details) at the bottom of that post.

Otherwise, please post your remaining questions/issues about this problem.
If you have other questions, please start a new topic.

Ah yes, hadn’t appreciated what that checkbox was for, and I’ve now checked it. I did ask another question related to my query and @Tom also answered that. I suppose I really should have started another post about that. I’m assuming I shouldn’t also check the “Solved” checkbox for the answer that @Tom gave me for that as that could be confusing but I have checked the Like box.

1 Like