#cs ----------------------------------------------------------------------------
AutoIt Version: 3.3.14.1
Author: Marco Ahrens
Script Function:
Automated reporting of Country Demand tableau exports.
#ce ----------------------------------------------------------------------------
#cs ----------------------------------------------------------------------------
Include
#ce ----------------------------------------------------------------------------
#include <AutoItConstants.au3>
#include <Date.au3>
#include <MsgBoxConstants.au3>
#include <DateCalc.au3>
#include <file.au3>
#include <FF.au3>
#include <FF_AutoLogin.au3>
#cs ----------------------------------------------------------------------------
Variables
Here are some Variables needed for the script defined.
#ce ----------------------------------------------------------------------------
$i = 1
$sFilePath = "C:\Users\*\Desktop\Reports\Downs\Debugging\Step"
$sUserName = "****"
$sPassWord = "*****"
$sURL = "generic-website.domain"
#cs ----------------------------------------------------------------------------
Script
Here the automated download of the report will happen.
#ce ----------------------------------------------------------------------------
;~ _FileCreate($sFilePath & $i)
;~ $i = $i+1
Opt('MustDeclareVars', 1) ;Declares, that Variables HAS to be declared, before they are used
_FFStart() ;Starts FireFox
While 1 ;Starts a infinite loop, for self scheduleing purposes
If _NowTime(5) == "09:21:30" Then ;Checks if the system time has reached a specified time. This is the scheduling check.
If _FFIsConnected() Then ;Checks if FireFox has started
_FFOpenURL($sURL) ;Opens the specified URL in FireFox
Sleep(5000) ;Waits a specified time (in ms) untill processing to the next step
$sTitle = WinGetTitle("Tableau Server - Mozilla Firefox") ;Gets the title of the specified window
$sUN = WinGetText($sTitle, "Username") ;Searches for a specified text inside the window of $sTitle
$sPW = WinGetText($sTitle, "Password") ;Searches for a specified text inside the window of $sTitle
ControlSend($sTitle, "", $sUN, "{ASC 065}") ;Writes an ascii coded letter into the window of $sTitle, into the $sUN area
Sleep(1000) ;Waits a specified time (in ms) untill processing to the next step
ControlSend($sTitle, "", "", "{TAB}") ;Sends an TAB command into the window of $sTitle
Sleep(1000) ;Waits a specified time (in ms) untill processing to the next step
ControlSend($sTitle, "", $sPW, $sPassWord) ;Writes the value of $sPassWord into $sPW inside of the window of $sTitle
Sleep(1000) ;Waits a specified time (in ms) untill processing to the next step
ControlSend($sTitle, "", "", "{ENTER}") ;Sends an ENTER command into the wondow of $sTitle
MsgBox(0, "Erfolg", _NowTime(4) & ": Es funktioniert!") ;Creates a MsgBox that outputs a text and the time, when the box was created. This was basically thought as debugging and has no function to the process of this script
;~ MouseMove(920, 1061)
;~ Sleep(200)
;~ _FileCreate($sFilePath & $i)
;~ $i = $i+1
;~ MouseClick($MOUSE_CLICK_LEFT)
;~ Sleep(200)
;~ _FileCreate($sFilePath & $i)
;~ $i = $i+1
;~ MouseMove(937, 1011)
;~ Sleep(200)
;~ _FileCreate($sFilePath & $i)
;~ $i = $i+1
;~ MouseClick($MOUSE_CLICK_LEFT)
;~ Sleep(300000)
;~ _FileCreate($sFilePath & $i)
;~ $i = $i+1
;~ MouseMove(908, 607)
;~ Sleep(200)
;~ _FileCreate($sFilePath & $i)
;~ $i = $i+1
;~ MouseClick($MOUSE_CLICK_LEFT)
;~ Sleep(5000)
;~ _FileCreate($sFilePath & $i)
;~ Send("{F11}")
_FFQuit() ;Quits FireFox
Else ;From here on it's defined what happens if FireFox has not started
MsgBox(0, "Error", _NowTime(4) & ": Es gab ein Problem mit dem Öffnen von FireFox") ; Creates a MsgBox in case that FireFox couldn't be started. Contains the system time and hardcoded errormessage.
EndIf ;Here ends the FireFox based script part
EndIf ;Here ends the check of system time
WEnd ;Here ends the infinite loop
Alles anzeigen