#focus Chrome New Incognito Window  SOLVED

User-to-User discussion about the PhraseExpress macro programming.
Post Reply
wschloss
Posts: 23
Joined: 08 Apr 12, 20:16

#focus Chrome New Incognito Window

Post by wschloss » 15 Feb 19, 18:08

Hi, when I execute this code:

{#clipboard -copy}{#RUN -FILE "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" -params "-incognito"}{#focus New Tab - Google Chrome}

a new Chrome incognito Window opens with title "New Tab" however focus is not set. Instead I get this error message:

Macro Error "Specified window not found" I have also tried these variations but same result:

{#focus "New Tab"} {#focus New Tab}

Any assistance appreciated thank you.

Peter Stotz
PhraseExpress Expert
Posts: 768
Joined: 27 Feb 08, 15:07

Post by Peter Stotz » 17 Feb 19, 18:04

Hi wschloss,
what happens if you use a star * as wildchart?
E.g. {#focus New Tab*} or {#focus New*} or so ...

Peter
Windows 10 - PhraseExpress v14.0.122i - Beta

wschloss
Posts: 23
Joined: 08 Apr 12, 20:16

Post by wschloss » 18 Feb 19, 20:35

This worked: {#focus New Tab*} Thank you.

wschloss
Posts: 23
Joined: 08 Apr 12, 20:16

Post by wschloss » 18 Feb 19, 21:00

Hi sorry I was premature in marking this as solved. Using the placeholder wildcard * works only when the copied item is a single word.

If the text item being copied to the clipboard is more than one word then #focus does not work. The copy works correctly (I know because I can past it back into a text document and it pastes correctly, without extra spaces or characters).

Here is my complete attempted code:

{#clipboard -copy}{#RUN -FILE "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" -params "-incognito"}{#focus New*}{#sleep 75}image{#space}{#clipboard -paste}{#ENTER}

'image' is a Chrome "Google Search Engine"

Thank you.

Peter Stotz
PhraseExpress Expert
Posts: 768
Joined: 27 Feb 08, 15:07

Post by Peter Stotz » 19 Feb 19, 12:34

@wschloss
It's not the actual problem, but you'd better use {#insertclipboard} instead of {#clipboard -paste}

Does the window name change due to the use of 'image' ?
Maybe you need another #focus for this:

{#clipboard -copy}{#RUN -FILE "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" -params "-incognito"}{#focus New*}{#sleep 75}image{#focus ???*}{#space}{#insertclipboard}{#ENTER}

Peter
Windows 10 - PhraseExpress v14.0.122i - Beta

wschloss
Posts: 23
Joined: 08 Apr 12, 20:16

Post by wschloss » 19 Feb 19, 16:15

No, the window name does not change. I added a delay as follows, thinking maybe the Chrome incognito window was not yet available to Windows, as follows, but same result.

{#clipboard -copy}{#RUN -FILE "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" -params "-incognito"}{#sleep 75}{#focus New*}{#sleep 75}image{#space}{#insertclipboard}{#ENTER}

Klein
PhraseExpress Expert
Posts: 208
Joined: 24 Mar 14, 16:11

Post by Klein » 19 Feb 19, 16:33

I tested the phrase and it works.
I am using the portable german version of Chrome. But I only have to change the name of the tab from "new" to "neu".

Why don't you use the special functions of PEX? This is part of the free addons. The image search is a part of it. Download from here!

wschloss
Posts: 23
Joined: 08 Apr 12, 20:16

Post by wschloss » 20 Feb 19, 14:44

I don't speak German, but in English, the focus is not set. I have all the addons but don't see anything referring to image search. Can you please give me some direction, noting the idea is to achieve the search in"incognito" mode, seemlessly? It worked correctly for a long time till a few months ago. It does seem to work occasionally, but works less well the more Chrome windows and other apps I have open, but not an excessive number. I have a less than two year old Dell business laptop with 16gb RAM and all Windows 10 and apps are up to date, including Phrase, 13.6.11f. Thank you.

wschloss
Posts: 23
Joined: 08 Apr 12, 20:16

Post by wschloss » 20 Feb 19, 15:13

Possibly helpful; I am invoking the shortcut with hot keys ctrl-alt-i

Klein
PhraseExpress Expert
Posts: 208
Joined: 24 Mar 14, 16:11

Post by Klein » 20 Feb 19, 16:56

Unfortunately I can only test it with Windows 7.
Also the use of the Chrome browser with English language does not change the behavior. The focus is set correctly.

If you want to use the special functions for this, you might have to set up another search page. Simply create a new phrase in the folder, assign a meaningful name and fill it with the following content:

Code: Select all

http://www.google.com/#tbm=isch&q=
smartsearch.jpg
You do not have the required permissions to view the files attached to this post.

wschloss
Posts: 23
Joined: 08 Apr 12, 20:16

Post by wschloss » 20 Feb 19, 18:42

I already have and occasionally use PEX search pages, but it is not what I need. I am looking for an incognito/private window that will shield the image search from casual, local users (not marketers, cookies, etc.) of the laptop, when I am not around.

But that is much beside the point. Why is Phrase not able to set focus to a just prior opened Chrome incognito window? Is there some different method I can use to open the window—perhaps that captures the PID, or changes the window name explicitly; then set focus based on that?

You don't have access to a Windows 10 PC? I am happy to schedule a time for you to remote my laptop if that would help. Usually I am available between 9am and 1pm New York time—your late afternoon. Please advise.

Peter Stotz
PhraseExpress Expert
Posts: 768
Joined: 27 Feb 08, 15:07

Post by Peter Stotz » 20 Feb 19, 20:34

@wschloss
"Why is Phrase not able to set focus to a just prior opened Chrome incognito window?"
Maybe because this is an incognito/private window … ;-)
https://www.phraseexpress.com/docs13/09 ... larprogram :
Some target applications ... may prevent external text injection, e.g. programs with high security requirements ...

Please experiment with the paste method setting Sendkey (See "Paste Method" https://www.phraseexpress.com/docs13/09 ... astemethod).

Peter
Windows 10 - PhraseExpress v14.0.122i - Beta

Klein
PhraseExpress Expert
Posts: 208
Joined: 24 Mar 14, 16:11

Post by Klein » 21 Feb 19, 09:47

Peter Stotz wrote:
20 Feb 19, 20:34
Maybe because this is an incognito/private window … ;-)
...
Please experiment with the paste method setting Sendkey
@Peter
No. The incognito window is not specially shielded (in Windows 7). For me it works with different paste methods. So one source of error would be the operating system. Someone with Windows 10 would have to check the phrase. I can't do that.

wschloss
Posts: 23
Joined: 08 Apr 12, 20:16

Post by wschloss » 21 Feb 19, 23:22

How would Sendkey change the behavior of #focus? Everything else works perfectly, and occasional even #focus works.
Is it possible to contact the app developers on this? Security blocking, and testing on Win 7 seem like dead-end strategies.
Else, I am happy to allow you to remote my machine—next Monday or Tuesday around 10am, New York time would be splendid.
Otherwise I will tolerate the inconvenience (I use this 5-10 times per week at most), but then why use the app at all—this seems like core functionality right? Windows 7? Come on guys it's 2019!

wschloss
Posts: 23
Joined: 08 Apr 12, 20:16

Post by wschloss » 22 Apr 19, 15:34

The following code works. I recreated from scratch; note the 200ms pauses

{#clipboard -copy}{#sleep 200}{#RUN -FILE "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" -params "-incognito"}{#sleep 200}{#focus New*}{#sleep 200}image{#space}{#trim {#insertclipboard}}{#ENTER}

I had noticed a "program restriction" (do not execute in Excel and Notepad++) but that should not have affected the macro working in Chrome. Also it should have prevented it from executing at all, whereas I was seeing the macro WAS running but simply failed to execute #focus. Also, at some point I had installed a minor upgrade of PE, but nothing on the change list led me to believe that helped resolve the issue.

Anyway, it has been working for two weeks, I am happy, marking solved.

ps; note "image" is a Chrome Google search engine ( chrome://settings/searchEngines ) with the following code:

https://www.google.com/search?q=%s&neww ... 89&dpr=1.1

Hope it helps someone and thank you to those who gave enough information to eventually figure it out!

wschloss
Posts: 23
Joined: 08 Apr 12, 20:16

Post by wschloss » 22 Apr 19, 15:40

SOLVED but I don't see how to now mark it as such ?

admin
Site Admin
Posts: 1478
Joined: 10 Feb 06, 17:31

Post by admin » 22 Apr 19, 20:00

Marked as solved. It is the check mark button

Post Reply