Jump to content
url=www.linustechtips.com ; 

F9::
run % "chrome.exe" ( winExist("ahk_class Chrome_WidgetWin_1") ? " --new-window " : " " ) url
return


^F9::
run % "chrome.exe" ( winExist("ahk_class Chrome_WidgetWin_1") ? " --new-window " " --incognito " : " " ) url
return

The code works, more or less. If I press F9 it opens up Chrome; if I press CTRL+F9 it opens an incognito window.

But If I don't have a chrome window already open, and press CTRL+F9, it will open a regular chrome window and I have to do it again before the incognito window opens.

Any idea on why this happens?

DELETE! DELETE!

EXTERMINATE! EXTERMINATE!

Silence will fall.

 

PSU Tier List - I keep forgetting where this is so I'm going to leave it here.

Link to comment
https://linustechtips.com/topic/781389-autohotkey-script-question/
Share on other sites

Link to post
Share on other sites

1 minute ago, deXxterlab97 said:

try their forum if ltt isn't helping https://autohotkey.com/boards/

Yeah, I probably will if I get curious enough. It just seemed weird to me. Also, the URL isn't working it's just opening a window not going to the website, but I suspect I'm using the wrong syntax somehow (that's usually what it is for me).

DELETE! DELETE!

EXTERMINATE! EXTERMINATE!

Silence will fall.

 

PSU Tier List - I keep forgetting where this is so I'm going to leave it here.

Link to post
Share on other sites

run % "chrome.exe" ( winExist("ahk_class Chrome_WidgetWin_1") ? " --new-window " " --incognito " : " " ) url

If you don't have a windows already, you use the second part of the ternary which you defined as just " ". It should be something like 

run % "chrome.exe" ( winExist("ahk_class Chrome_WidgetWin_1") ? " --new-window --incognito" : " --incognito" ) url

 

1474412270.2748842

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×