Jump to content
Sign in to follow this  
parrishjason

Download & Run File from Microsoft Edge

Recommended Posts

parrishjason

Hello all.

I currently have an AutoIT script that uses INetGet to retrieve and run files over a network. However, as it stands the app has currently changed to the point where I must open an actual browser in order to be able to get to the file (at least, this is the easiest way).

 

Right now I have an extremely unreliable and clunky set of Send and Click commands to accomplish this task with sleeps in between everything to the point where I *hope* my file was downloaded before I try to click the "Run" button in microsoft edge. 

 

I've been looking into IUIautomation, but I'm having quite a time understanding how to actually use it properly.

 

I'd think that a script to navigate to a URL, download a file, then click "Run" in the browser would be simple. If I can get any help that'd be highly appreciated.

 

Once I see a sample of how to download the file, the navigation part should be quite trivial to figure out.

Share this post


Link to post
Share on other sites
Juvigy

There is na IE UDF. Check it out. For example _IECreate and _IENavigate

Share this post


Link to post
Share on other sites
junkew
;~ *** Standard code maintainable ***
#include "UIAWrappers.au3"
AutoItSetOption("MustDeclareVars", 1)

_UIA_setVar("oP1","Title:=.*Microsoft Edge;controltype:=UIA_WindowControlTypeId;class:=ApplicationFrameWindow") ;Download Microsoft WebDriver - Release 10240 from Official Microsoft Download Center ?- Microsoft Edge
_UIA_setVar("oP2","Title:=Microsoft Edge;controltype:=UIA_WindowControlTypeId;class:=Windows.UI.Core.CoreWindow")   ;Microsoft Edge
_UIA_setVar("oP3","Title:=Melding;controltype:=UIA_ToolBarControlTypeId;class:=NotificationBar")    ;Melding

;~ $oUIElement=_UIA_getObjectByFindAll("Opslaan.mainwindow", "title:=Opslaan;ControlType:=UIA_ButtonControlTypeId", $treescope_subtree)
_UIA_setVar("oUIElement","Title:=Opslaan;controltype:=UIA_ButtonControlTypeId;class:=Button") ;ControlType:=UIA_ButtonControlTypeId;classname:=Button")

;~ Actions split away from logical/technical definition above can come from configfiles

_UIA_Action("oP1","highlight")
_UIA_Action("oP1","setfocus")
_UIA_Action("oP2","highlight")
;~ _UIA_Action("oP2","setfocus")
;~ _UIA_Action("oP3","highlight")
;~ _UIA_Action("oP3","setfocus")

_UIA_action("oUIElement","highlight")
;~_UIA_action("oUIElement","click")

Simplespy gave me above code and with some small tweaks it highlights the download button in edge

example link used https://www.microsoft.com/en-us/download/details.aspx?id=48212

then clicked manually download

and then run script which shows that it click on opslaan (you should write the actual language english or other language text)

 

Share this post


Link to post
Share on other sites
junkew

and to help a little more the example on how to enter an address in the edge addressbar

Be aware I am on a dutch windows so change in description can be needed

;~ *** Standard code maintainable ***
#include "UIAWrappers.au3"
AutoItSetOption("MustDeclareVars", 1)

_UIA_setVar("oP1",".*Microsoft Edge;controltype:=UIA_WindowControlTypeId;class:=ApplicationFrameWindow")    ;Download Microsoft WebDriver - Release 10240 from Official Microsoft Download Center ?- Microsoft Edge
_UIA_setVar("oP2","Title:=Microsoft Edge;controltype:=UIA_WindowControlTypeId;class:=Windows.UI.Core.CoreWindow")   ;Microsoft Edge

;~ $oUIElement=_UIA_getObjectByFindAll("Zoekofvoereenwebadresin.mainwindow", "title:=Zoek of voer een webadres in;ControlType:=UIA_EditControlTypeId", $treescope_subtree)
_UIA_setVar("oUIElement","Title:=Zoek of voer een webadres in;controltype:=UIA_EditControlTypeId;class:=RichEditBox") ;ControlType:=UIA_EditControlTypeId;classname:=RichEditBox")

;~ Actions split away from logical/technical definition above can come from configfiles

_UIA_Action("oP1","highlight")
_UIA_Action("oP1","setfocus")

_UIA_Action("oP2","highlight")
_UIA_Action("oP2","setfocus")

_UIA_action("oUIElement","highlight")
_UIA_action("oUIElement","click")
_UIA_Action("oUIElement","setvalue using keys","https://www.microsoft.com/en-us/download/details.aspx?id=48212")
send("{ENTER}")

The exercise to create the download click I leave to you

hint: use simple spy then you will have 3 scripts that you have to modify and combine

Share this post


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
Sign in to follow this  

  • Similar Content

    • colombeen
      By colombeen
      Hi guys,
      I'm trying to get some information using WMI, from the Win32_EncryptableVolume class.
      I exec my query, filter out the C-drive, but when I need more info using the objects methods, I only get 1 value back and I can't seem to retrieve the other out params that should be there.
      A very minimal version of what I'm trying to do (no error checking etc, very basic). You need to start SciTE as admin or you won't see any results in the console!
      #RequireAdmin $strComputer = @ComputerName $objWMIService = ObjGet("winmgmts:{impersonationLevel=impersonate}!\\" & $strComputer & "\root\CIMV2\Security\MicrosoftVolumeEncryption") $objWMIQuery = $objWMIService.ExecQuery("SELECT * FROM Win32_EncryptableVolume WHERE DriveLetter='C:'", "WQL", 0) For $objDrive In $objWMIQuery ConsoleWrite("> " & $objDrive.GetConversionStatus() & @CRLF) ConsoleWrite("> " & $objDrive.GetConversionStatus().ConversionStatus & @CRLF) ConsoleWrite("> " & $objDrive.GetConversionStatus().EncryptionPercentage & @CRLF) Next The result from the console is : 
      > 0 > > What I'm expecting to get back is : 
      > 0 > 0 > 0 When using powershell I get this (run as admin is required!!!) : 
      PS C:\WINDOWS\system32> (Get-WmiObject -namespace "Root\cimv2\security\MicrosoftVolumeEncryption" -ClassName "Win32_Encryptablevolume" -Filter "DriveLetter='C:'").GetConversionStatus() ... ConversionStatus : 0 EncryptionFlags : 0 EncryptionPercentage : 0 ReturnValue : 0 ... All I seem to be getting is the ReturnValue when I use the method.
      I've tried this on multiple methods, always ending up with the same result
      Anyone here who has experience with this type of thing?
       
      Greetz
      colombeen
    • autotin
      By autotin
      Hello I am a first time user of AutoIT with little coding experience and I would REALLY really appreciate your help.
      I work in a warehouse where I am responsible for data entry along with a slew of other different tasks such as auditing and managing paperwork. Most of my time is tied up entering info to close receipts of product orders (8-12+ hours for thousands of products). The quantity actually produced by the warehouse is sometimes different from the quantity listed on the reciept (in this case 20). I need to change all the build qty for sublocation "1-WIP" from 20 to the actual quantity 22 and set all other numbers as 0. The form is an iframe coded with jQuery and freezes for 1-2 seconds after every entry and refreshes. As such, it doesn't allow me to use tab and I need to click and type every incorrect field.
      I have attached an image as an example from the webapp, FinaleInventory.
      I'm thinking that I probably need a macro that has a message box entry where I can type the corrected number entry I want. Then it uses image/character recognition (Tesseract?) to find "WIP" sublocation =,   Move the mouse over to the right to "Quantity" relative to location of WIP If quantity number = entry, then move to next "WIP" image (Not quite sure how to make Tesseract "find next") Elseif quantity number ≠ entry then click quantity number of "WIP" and type corrected entry Scroll down Loop until bottom of page I would greatly appreciate any help, ideas or pointers for this project. Thank you!
      -A newbie scripter

    • jwhausk
      By jwhausk
      Hi, I would like a script to open Edge and navigate to 2 different pages
      Open Edge tab 1 www.MyHomePage.com,  Tab 2 www.google.com
      Thank you, John
    • whiskas
      By whiskas
      Hi all,
      I just upgraded to windows 10 and am using Edge as my browser now. Updated my scripts, but I can not unhide a minimized Edge window with the script anymore.
      WinSetState ( "titlle","", @SW_MAXIMIZE ) works fine, but not if it is minimized. Tried same with SW_SHOW, doesn't work.
      WinExists("title","") -> returns 1, so it is finding my window.
       
              WinWait($title,$text,$timeout)
              If Not WinActive($title,$text) Then WinActivate($title,$text)
              WinWaitActive($title,$text,$timeout)
      Doesn't work also, so I think I tried all but cant get the window back
      Any help would be appreciated
       
    • KimberlyJillPereira
      By KimberlyJillPereira
      I am a newbie in AutoIt. May I know what is the code used to expand the width and height of excel cells because I want to insert pictures in the cell.I tried AutoFit but that doesnt work as I cant specify for the width and height. Only for column width I could expand by using .ColumnWidth but for the row I am not able to expand the row? How to do?? What is the code used ??Please help me and thank you.
×