Ifwinexist - It's opening a new window all the time

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
Johana
Posts: 189
Joined: 02 May 2017, 02:34

Ifwinexist - It's opening a new window all the time

02 May 2017, 02:41

Hello everyone! I am trying a simple code after my co worker introduced me to this awesome software!

Here's the code: (I have change the urls for security reasons)

Code: Select all

^':: 
IfWinExist http://bla.blfa.com/Something/Somedocuments/processes/One Note for them/some-file-for-me.pdf - Internet explorer
 WinActivate
Else 
{ 
 Run http://bla.blfa.com/Something/Somedocuments/processes/One Note for them/some-file-for-me.pdf - Internet explorer
} 
Return
This is opening up the url time after time even if there's a open window already.

In the spy tool it truncates the url showing something similiar:

http://bla.blfa.com/Something/Somedocum ... cesses/One Note for them/s - Internet explorer

I tried the truncated url as well, still didn't help.. Any suggestions? The PDF opens inside IE
BoBo
Posts: 6564
Joined: 13 May 2014, 17:15

Re: Ifwinexist - It's opening a new window all the time

02 May 2017, 05:41

Johana wrote:Hello everyone! I am trying a simple code after my co worker introduced me to this awesome software!

Here's the code: (I have change the urls for security reasons)

Code: Select all

^':: 
IfWinExist http://bla.blfa.com/Something/Somedocuments/processes/One Note for them/some-file-for-me.pdf - Internet explorer
 WinActivate
Else 
{ 
 Run "http://bla.blfa.com/Something/Somedocuments/processes/One Note for them/some-file-for-me.pdf" - Internet explorer
} 
Return
This is opening up the url time after time even if there's a open window already.

In the spy tool it truncates the url showing something similiar:

http://bla.blfa.com/Something/Somedocum ... cesses/One Note for them/s - Internet explorer

I tried the truncated url as well, still didn't help.. Any suggestions? The PDF opens inside IE
a) I'd first try to use a set of quotation marks in a path that contains space characters "http:/......... "
b) probably AHK isn't able to deal with such a long path in here (?), so why not shorten it using a variable instead?
c) have you checked IE's "internet options" already? There's a tab section to (re)configure some settings too.
d) in case you want to start a specific set of pages/pdfs every day using IE's tabs, you can configure/set this via IE's "Startpage" registry settings.
Check out AHK's RegWrite command for this.

BTW, I'm pretty sure that you've to correct this ...

Code: Select all

Run http://bla.blfa.com/Something/Somedocuments/processes/One Note for them/some-file-for-me.pdf - Internet explorer
to that ...

Code: Select all

Run "http://bla.blfa.com/Something/Somedocuments/processes/One Note for them/some-file-for-me.pdf"
... for a well known reason ;)
User avatar
DyaTactic
Posts: 221
Joined: 04 Apr 2017, 05:52

Re: Ifwinexist - It's opening a new window all the time

02 May 2017, 06:54

For the WinTitle issue you can try to specify "SetTitleMatchMode, 2" before IfWinExist and change the WinTitle to "some-file-for-me.pdf". (All whithout the quotation marks)

Code: Select all

^':: 
SetTitleMatchMode, 2		; Make WinTitle search anywhere in the title, not just the start of the title.
IfWinExist some-file-for-me.pdf
	WinActivate
Else 
{
	Run "http://bla.blfa.com/Something/Somedocuments/processes/One Note for them/some-file-for-me.pdf"
} 
Return
Hope this helps and adds to Bobo.
Johana
Posts: 189
Joined: 02 May 2017, 02:34

Re: Ifwinexist - It's opening a new window all the time

03 May 2017, 09:03

Thanks guys but none of these worked. It opens window after window and not finding the existing window. How would I go about to put the url in a variable? What can I do? :(
BoBo
Posts: 6564
Joined: 13 May 2014, 17:15

Re: Ifwinexist - It's opening a new window all the time

03 May 2017, 12:02

AFAICS it's an IE issue and not especially related to AHK ...
There are plenty of request like yours on the web like [here] :wtf:

It might make sense to have a request with Microsoft directly!
Johana
Posts: 189
Joined: 02 May 2017, 02:34

Re: Ifwinexist - It's opening a new window all the time

08 May 2017, 03:21

BoBo wrote:AFAICS it's an IE issue and not especially related to AHK ...
There are plenty of request like yours on the web like [here] :wtf:

It might make sense to have a request with Microsoft directly!
Thanks but not sure if it is related to IE to be honest. Because it's not about opening in a new tab or window. It's about it not finding that the window already exists and instead of activating the window, it opens a new window.. And a new.. and a new, each time i press the command.

So the issue seems to be ifwinexist if I understand this correctly.

Anyone got some other suggestions? Someone said something about a variable. How would I go about that?

Edit: It works if I change the url to: http://mysite.com/blabla/default.aspx. Then it activates that window. But not with the url in the origin post:S
phaleth
Posts: 38
Joined: 13 Apr 2015, 03:49

Re: Ifwinexist - It's opening a new window all the time

08 May 2017, 03:34

hi,

Join the #ahk irc channel and ask for help there. I might be able to help you.

https://autohotkey.com/board/topic/2585 ... add-water/
BoBo
Posts: 6564
Joined: 13 May 2014, 17:15

Re: Ifwinexist - It's opening a new window all the time

08 May 2017, 03:56

There's a good chance that a (pdf) add-on setting triggers this behavior (are you using the Adobe Reader plugin/add-on)?

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Google [Bot], peter_ahk, TAC109 and 345 guests