Jump to content

Recommended Posts

Posted (edited)

I have a need to download a report from salesforce in CSV format, on a every hour basis. I have used code found here to automate the login (minus the 2 part auth) and trigger the download.

All of that works, but I would really like to hide the download window. I want to have everything happen in the background with no user intervention and nothing seen on the screen? Can this be done? Here is the code I have thus far. Also even though I think its set to open the second link in the first links parent window, it still want to open a second window??

#include <IE.au3>

Local $oUser, $oPass, $oSubmit
Local $sUser = "hiddenuser"
Local $sPass = "hiddenpass"
Local $url1 = "https://my.salesforce.com/index.jsp"
Local $url2 = "https://my.salesforce.com/00O3c000007JWJ8?csv=1"
Local $oIE = _IECreate($url1, 1, 0)

_IELoadWait($oIE)

$oInputs = _IETagNameGetCollection($oIE, "input")
for $oInput in $oInputs
    if $oInput.type = "email" And $oInput.name = "username" And $oInput.id = "username" Then $oUser = $oInput
    if $oInput.type = "password" And $oInput.name = "pw" And $oInput.id = "password" Then $oPass = $oInput
    if $oInput.type = "submit" And $oInput.value = "Log In" Then $oSubmit = $oInput
    if isObj($oUser) And isObj($oPass) And isObj($oSubmit) then exitloop
Next

$oUser.value = $sUser
$oPass.value = $sPass
_IEAction($oSubmit, "click")

_IELoadWait($oIE)

Local $oIE = _IECreate($url2, 1, 0, 0)

Sleep(1500)

Send("{ENTER}")

RunWait('taskkill /F /IM "iexplore.exe"')

 

Edited by zone97

 

Spoiler

WinSizer 2.1 (01/04/2017) - Download - [ Windows Layout Manager ]
Folder+Program (12/23/2016) - Download - [ USB Shortcut Creator ]

 

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
×
×
  • Create New...