Move cursor in a window upon activation?

I'd like the cursor to move a line down and a character right when a window opens in an application, but I can't figure out how.

The App opens, I select a action in app that opens a window (that has a specific phrase in the title though the whole phrase changes.. part is consistent)

When that window opens, I'd like the cursor to move from its starting point (always the same in the window – top left of that window) to one line down and one character right so typing begins at the correct place.

And I'd like it to happen automatically (without a hot key) .

Can do?

This can be done, but it depends on the details:

  1. What app are you using?
  2. Is this a new empty document, or does it have text in it?
    • If it has text in it, exactly what is the text?
    • If it does not have text, then to "move" the cursor we actually have to enter characters. Is that what you want?
    • It would be best to provide a screen shot of the target window
  3. After the cursor is moved, and you have entered text, will you save, changing the title, before switching to any other window?
    • We have to know whether or not this is a new document, and IF the macro has already run on it.

Thanks...

The app is "PhotoMechanic" (a photo browser. editor).

The new window has text (the window is called IPTC Info for xxxxx ...

with xxxx changing for each photo.

After the cursor is moved, I will be entering text at that insertion point (the point of the macro is to leave me at the right spot to enter text without having to mouse to it... many times in a hurry!

Then I will save that window's changes before moving to next task in the program, then open a similar window from another file in main browser where I would expect same macro to run?

Thanks for the help!

OK, thanks for the info.

I created a dummy Macro Group, which you will need to edit:

EDIT: 2018-07-24 17:59 GMT-5
image

Give this macro a try. When you import into KM, it will be in this group. Either change this group, or move the macro to your existing group, which is ONLY active when Photomechanic frontmost.

NOTE: This macro will trigger & run every time you switch to another window, and then back to this app with a window with this key phrase: "IPTC info".


MACRO:   Move Text Cursor When App Document Opens


#### DOWNLOAD:
<a class="attachment" href="/uploads/default/original/3X/5/4/548fd155ce8c1564e6d0d7661af7e6e60d5a242b.kmmacros">Move Text Cursor When App Document Opens.kmmacros</a> (4.3 KB)
**Note: This Macro was uploaded in a DISABLED state. You must enable before it can be triggered.**

---



![image|548x986](upload://hyPIywszUTP2ojJ9i7KEpjZ3DkG.jpg)

---

[quote="jmorris, post:3, topic:10945"]
Then will save that window's changes before moving to next task in the program, then open similar window from another file in main browser where I would expect same macro to run?
[/quote]
Yes, it should, since it will have a different window title.
1 Like

Hoo boy, that soooo worked:) . Many many thanks:):)!!!

1 Like

Hi, upon further review, although working it's not quite what I thought...

If I read you right (and you did say so explicitly... (NOTE: This macro will trigger & run every time you switch to another window, and then back to this app with a window with this key phrase: "IPTC info")...

It requires me to "tap out" of the app and back in to run. Is there a way to have it activate when I open that "iptc info" window without having to go out of Photomechanic and back in when I do so?

So I am in the Photomechanic app, open the "iptc info" window, and the cursor moves as directed, without having to do anything else?

Many thanks...

Revisiting this...

Any suggestions?

Hey @jmorris

This works for me in testing, although I'm having to use BBEdit as a test app instead of PhotoMechanic.

I've made the macro ignore secondary activations of the same window name, although this might not be the best method available.

You'll need to have another macro in the PhotoMechanic group that will clear the processedWindowList variable when the app quits.

Try it and see if it doesn't at least give you some ideas for moving forward.

-Chris


Example -- Working with a Focused Window Trigger v1.00.kmmacros (8.5 KB)

1 Like

Hi Chris,
Many, many thanks for this follow up, it is indeed working:)

As to having the macro ignore secondary activation, is that necessary to it's working? For me, I don't think I need that, but if it is part of the successful activation, I can use it as is. I typically only go to the IPTC caption once per photo anyway, and if I go back to re edit I wouldn't need the macro.

If I do need the secondary activation check, and if I do need to clear the Processed WindowList variable. any suggestions on how to do this? I am obviously a newbie here:)

Again, thanks so much for helping on this... J

Hey @jmorris

I wouldn't think so.

Make a copy of the macro and experiment to your heart's content. See what's effective for you in your workflow.

You would have a GLOBAL macro with an Application Trigger (On Quit) to zero-out the given variable when PhotoMechanic quits.

Something like this:

Test -- Application Quits Trigger.kmmacros (2.0 KB)

You could also have a manually activated macro for special occasions.

-Chris

Hi Chris,
Before I saw your reply I tried my own version, Example -- Working with a Focused Window Trigger v1.00.kmmacros (8.8 KB)
( I hope I did that right!)

It seems to work well and delete the variables also. Please let me know if I did something bad, otherwise it works and will get me started. In my free time I shall try your version also and play with the macro, but for now, a million thanks!

It seems trivial but in my world, trying to caption and upload dozens of photos in a very brief time (halftime of a NFL game), saving several seconds on every photo adds up quickly. Thanks!

Hey @jmorris,

The only issue I see offhand is this:

image

It should be this:

image

I think I used %DELETE% in my previous example, and that too was incorrect.

-Chris

Hi Chris,
Change made, thanks again!