IE Com Save Dialog - Auto Save using ACC

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
c4p
Posts: 21
Joined: 18 Jan 2017, 18:38

IE Com Save Dialog - Auto Save using ACC

21 Apr 2017, 17:15

I have a csv file on a webpage I wish to download. I am doing through COM control instead of URLDownload (or similar) because of all the login credentials, https encryption, authentication tokens, etc.

I am able to use Send !s (Alt-s) and successfully save it, however I need to keep the window hidden, so this won't work. I attempted numerous iterations of ControlSend using !s or {f6}{tab}{Enter} (another keystroke shortcut to it) but none seem successful.

I found this post which successfully uses the ACC to cancel the same dialog. Thanks jeeswg

https://autohotkey.com/boards/viewtopic ... 43#p127543

Code: Select all

;internet explorer - notification bar interactions
;to test whether it's visible and retrieve its name (it should be 'Notification')
#Include Acc.ahk
WinGet, hWnd, ID, A
ControlGet, hCtl, Hwnd, , DirectUIHWND1, ahk_id %hWnd%
ControlGet, vIsVisible, Visible, , DirectUIHWND1, ahk_id %hWnd%
oAcc := Acc_ObjectFromWindow(hCtl)
MsgBox % vIsVisible " " oAcc.accName(0)

;to close the notification bar
;Acc_Get(Cmd, ChildPath="", ChildID=0, WinTitle="", WinText="", ExcludeTitle="", ExcludeText="") 
oAcc := Acc_Get("Object", "4.5", 0, "ahk_id " hCtl)
oAcc.accDoDefaultAction(0)
Return
Despite this, I cannot figure out the correct argument settings to reach the save button despite looking via ACC viewer.
Screen Shot 2017-04-21 at 6.05.30 PM.png
Screen Shot 2017-04-21 at 6.05.30 PM.png (74.34 KiB) Viewed 5127 times
User avatar
jeeswg
Posts: 6902
Joined: 19 Dec 2016, 01:58
Location: UK

Re: IE Com Save Dialog - Auto Save using ACC

22 Apr 2017, 05:03

Changing it from 4.5 to 4.3 worked for me.
oAcc := Acc_Get("Object", "4.5", 0, "ahk_id " hCtl)
oAcc := Acc_Get("Object", "4.3", 0, "ahk_id " hCtl)

Btw I tried different things relating to the Notification control and hidden/visible windows, I'm not entirely sure what the problem is.

I used this as a test website: https://autohotkey.com/download/

Btw is that a special icon on the AccViewer window? From one of the editors maybe?

Best of luck.
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
c4p
Posts: 21
Joined: 18 Jan 2017, 18:38

Re: IE Com Save Dialog - Auto Save using ACC

22 Apr 2017, 08:10

Thanks. Works Perfectly.

For learning purposes how did you determine 4.3? Hopefully not trial and error.

I figured it out by selecting less focus to get the Open/Save/Cancel Dialog
Screen Shot 2017-04-22 at 9.20.43 AM.png
Screen Shot 2017-04-22 at 9.20.43 AM.png (36.69 KiB) Viewed 5096 times
Second question. how would you replace the WINGET determination of hidden ie hwnd? Loop all instances Checking for known title or URL?

As for the icon, it was set when I did a compile using CompileAHK.

THANKS AGAIN
User avatar
jeeswg
Posts: 6902
Joined: 19 Dec 2016, 01:58
Location: UK

Re: IE Com Save Dialog - Auto Save using ACC

22 Apr 2017, 10:50

Trial and error. No, actually, you see the numbers in the image? So, the window (control) has window handle (hWnd): hCtl, then child 4, then child 3 for Save (or 5 for the 'x' button). Usually I try to find the window/control (or an element/control/window above it) and navigate down. I've been working on a modification for AccViewer that I might release that tries to focus the element/control/window under the cursor based on the hotkey, rather than just a hotkey for the element. AccViewer has a Ctrl+/ hotkey which I didn't know about for a long time.

Although Acc can be simple in theory, I do always seem to have a surprising difficulty every time I have a new need for it. I've been trying to send a click via accDoDefaultAction to the highlight button, 'Fill Color', in Excel 2007. [EDIT: I got it working, see the link below.] Using macros can't be undone, so sometimes sending clicks or key presses is better.

[At least I have this so far, if anyone wants to confirm whether it works on other versions of Excel than Excel 2007:]
Get text from status bar - AutoHotkey Community
https://autohotkey.com/boards/viewtopic ... 59#p144259

Although I haven't had that problem of finding the hidden IE window before. Some ideas for identifying the window:

Code: Select all

q:: ;create IE COM object and set url
WinGet, hWnd, ID, A
oWB := JEE_WBGet("ahk_id " hWnd)
oWB.Navigate("about:blank#MyUniqueString")
;document.url is usually preferable but not in this case
MsgBox, % oWB.LocationURL ;about:blank#MyUniqueString
MsgBox, % oWB.document.url ;res://ieframe.dll/navcancl.htm
oWB := ""
return

w:: ;get IE COM object's hWnd
oWB := ComObjCreate("InternetExplorer.Application")
MsgBox, % oWB.HWND
oWB.quit
oWB := ""
return
Cheers re. the icon.
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
bodosko
Posts: 19
Joined: 05 May 2017, 10:49

Re: IE Com Save Dialog - Auto Save using ACC

19 May 2017, 12:29

jeeswg wrote:I've been working on a modification for AccViewer that I might release that tries to focus the element/control/window under the cursor based on the hotkey, rather than just a hotkey for the element. AccViewer has a Ctrl+/ hotkey which I didn't know about for a long time.
Please let us know if you have any success on this modification. I would appreciate a lot, because I need something like that to get the path from an object that disappear when mouse is clicked on ACCViewer.
User avatar
jeeswg
Posts: 6902
Joined: 19 Dec 2016, 01:58
Location: UK

Re: IE Com Save Dialog - Auto Save using ACC

19 May 2017, 12:42

I might try and do it this weekend. Btw did you try the Ctrl+/ hotkey?

I find AccViewer and iWB2 Learner so awkward to modify, that I'm tempted to rewrite them from scratch. (I wanted to make iWB2 Learner handle Internet Explorer with any zoom %, instead of 100% only, plus offer options regarding putting text on the clipboard to make both consistent with each other, and I've tried to convert them to AHK v2, the whole thing has been a nightmare.)
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
bodosko
Posts: 19
Joined: 05 May 2017, 10:49

Re: IE Com Save Dialog - Auto Save using ACC

19 May 2017, 12:46

ctrl+/ doesn't help because I still have to click the crosshair in AccViewer, and when I do it, the object I want to get disappears.
User avatar
jeeswg
Posts: 6902
Joined: 19 Dec 2016, 01:58
Location: UK

Re: IE Com Save Dialog - Auto Save using ACC

19 May 2017, 12:53

Have the Acc Structure window visible before you begin, and then use Ctrl+/, it should work, also try pressing Ctrl+/ a second time. It seems to have an on/off mode.

Btw what information are you trying to retrieve, I might try and update my 'AccViewer Basic' script which is a no-frills version of AccViewer.
Last edited by jeeswg on 19 May 2017, 13:24, edited 1 time in total.
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
bodosko
Posts: 19
Joined: 05 May 2017, 10:49

Re: IE Com Save Dialog - Auto Save using ACC

19 May 2017, 13:12

I'm trying to get the path to the "Save As" button of IE11 save file notification bar.

Image
User avatar
jeeswg
Posts: 6902
Joined: 19 Dec 2016, 01:58
Location: UK

Re: IE Com Save Dialog - Auto Save using ACC

19 May 2017, 13:44

See this link, I've answered your original question there:
Internet Explorer Save Open Cancel Popup - AutoHotkey Community
https://autohotkey.com/boards/viewtopic.php?f=5&t=26223
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: csbellmd, Google [Bot], Shifted_Right and 201 guests