An instance as follows is Gom Player...
#include <PPCC.au3>
_AU3RecordSetup
()
;~ WinMinimizeAll()
$msgb=MsgBoxDJS
(4+32+256,'GOM Media Player Setup','Would you like to download newest version?' & @LF & 'Automatic choose No after',5)
;~ ConsoleWrite($msgb)
;~ Exit
$SavedPath="D:setupmultimedia toolsgom player"
If $msgb=7 Or $msgb=-1 Then
$Found=_GetFileName
($SavedPath,".exe",'SETUP.EXE')
Run($SavedPath & '' & $Found)
Sleep(3000)
_WinWaitActivate
("GOM Player Setup","Welcome to the GOM P")
Send("{ALTDOWN}n{ALTUP}")
_WinWaitActivate
("GOM Player Setup ","Please review the li")
Send("{ALTDOWN}a{ALTUP}")
_WinWaitActivate
("GOM Player Setup ","Choose which feature")
Send("{ALTDOWN}n{ALTUP}")
_WinWaitActivate
("GOM Player Setup ","Choose Install Locat")
Send("{CTRLDOWN}c{CTRLUP}{CTRLDOWN}{CTRLUP}{CTRLDOWN}{CTRLUP}{HOME}{SHIFTDOWN}{RIGHT}d{SHIFTUP}{HOME}{SHIFTDOWN}{END}{SHIFTUP}{CTRLDOWN}c{CTRLUP}{ALTDOWN}i{ALTUP}")
_WinWaitActivate
("GOM Player Setup ","Completing the GOM P")
Send("{ALTDOWN}f{ALTUP}")
_WinWaitActivate
("GOM VIDEO CONVERTER","Download and install")
ControlClick("GOM VIDEO CONVERTER","Download and install","[CLASS:Button; INSTANCE:2]")
Exit
Else
$URL0='http://player.gomlab.com/eng/download/'
$TempFile = "_Test.html"
If FileExists(@TempDir & '' & $TempFile) Then
FileDelete(@TempDir & '' & $TempFile)
Sleep(2000)
EndIf
_DownloadFile
($URL0, @TempDir, $TempFile);~ ShellExecute($URL)
$file=FileOpen(@TempDir & '' & $TempFile)
If $file = -1 Then ; Check if file opened for reading OK
MsgBox(0, "Error", "Unable to open file.", 5)
Exit
EndIf
$BeginTag='<a href="/eng/download/'
$EndTag='" onclick="javascript: pageTracker._trackPageview(' & "'/CNET')"
$TempStr=_GetLinkDownload
($file,$BeginTag,$EndTag) ;~ ConsoleWrite($TempStr & @CRLF)
FileClose($file)
$URL=$URL0 & $TempStr
ConsoleWrite($URL & @CRLF)
$TempFile = "_Test.html"
If FileExists(@TempDir & '' & $TempFile) Then
FileDelete(@TempDir & '' & $TempFile)
Sleep(2000)
EndIf
_DownloadFile
($URL, @TempDir, $TempFile);~ ShellExecute($URL)
$file=FileOpen(@TempDir & '' & $TempFile)
If $file = -1 Then ; Check if file opened for reading OK
MsgBox(0, "Error", "Unable to open file.", 5)
Exit
EndIf
$BeginTag='<div class="dlLinkWrapper"> <a href="'
$EndTag='"'
$TempStr=_GetLinkDownload
($file,$BeginTag,$EndTag) ;~ ConsoleWrite($TempStr & @CRLF)
FileClose($file)
$URL='' & $TempStr
ConsoleWrite($URL & @CRLF)
$TempFile = "_Test.html"
If FileExists(@TempDir & '' & $TempFile) Then
FileDelete(@TempDir & '' & $TempFile)
Sleep(2000)
EndIf
_DownloadFile
($URL, @TempDir, $TempFile);~ ShellExecute($URL)
$file=FileOpen(@TempDir & '' & $TempFile)
If $file = -1 Then ; Check if file opened for reading OK
MsgBox(0, "Error", "Unable to open file.")
Exit
EndIf
$BeginTag='URL=http://software'
$EndTag='.EXE"/>'
$TempStr=_GetLinkDownload
($file,$BeginTag,$EndTag) ;~ ConsoleWrite($TempStr & @CRLF)
FileClose($file)
$URL='http://software' & $TempStr & '.EXE'
ConsoleWrite($URL & @CRLF)
$URLSplit=StringSplit($URL,'=')
$FileName=$URLSplit[UBound($URLSplit)-1] ;~
ConsoleWrite($FileName & @CRLF)
If Not FileExists($SavedPath & '' & $FileName) Then _DownloadFile
($URL,$SavedPath,$FileName)
Run($SavedPath & '' & $FileName)
Sleep(3000)
_WinWaitActivate
("GOM Player Setup","Welcome to the GOM P")
Send("{ALTDOWN}n{ALTUP}")
_WinWaitActivate
("GOM Player Setup ","Please review the li")
Send("{ALTDOWN}a{ALTUP}")
_WinWaitActivate
("GOM Player Setup ","Choose which feature")
Send("{ALTDOWN}n{ALTUP}")
_WinWaitActivate
("GOM Player Setup ","Choose Install Locat")
Send("{CTRLDOWN}c{CTRLUP}{CTRLDOWN}{CTRLUP}{CTRLDOWN}{CTRLUP}{HOME}{SHIFTDOWN}{RIGHT}d{SHIFTUP}{HOME}{SHIFTDOWN}{END}{SHIFTUP}{CTRLDOWN}c{CTRLUP}{ALTDOWN}i{ALTUP}")
_WinWaitActivate
("GOM Player Setup ","Completing the GOM P")
Send("{ALTDOWN}f{ALTUP}")
_WinWaitActivate
("GOM VIDEO CONVERTER","Download and install")
ControlClick("GOM VIDEO CONVERTER","Download and install","[CLASS:Button; INSTANCE:2]")
EndIf
FileDelete(@DesktopCommonDir & 'GOM Player.lnk')
#include-once
#include <String.au3>
#include <Array.au3>
#include <Inet.au3>
#include <File.au3>
#include <WindowsConstants.au3>
#include <GUIToolbar.au3>
#include <WinAPI.au3>
#include <GuiMenu.au3>
HotKeySet("{ESC}", "Script_Close")
Func Script
_Close
()
Exit
EndFunc
Func _WinCloseAll
($WinClass,$text="")
Local $hWC=1
While $hWC=1
$hWC=WinClose($WinClass,$text) ; such as, "[CLASS:OperaWindowClass]";~ ConsoleWrite($hWC & @LF)
WEnd
EndFunc
; #FUNCTION# ====================================================================================================================
; Name...........: _AU3RecordSetup
; Description ...: Au3 File Record Setup.
; Syntax.........: _AU3RecordSetup()
; ===============================================================================================================================
Func _AU3RecordSetup
()
Opt('WinWaitDelay',100)
Opt('WinDetectHiddenText',1)
Opt('MouseCoordMode',0)
EndFunc ;==>_AU3RecordSetup
; #FUNCTION# ====================================================================================================================
; Name...........: _WinWaitActivate
; Description ...: Activate a opening windows.
; Syntax.........: _WinWaitActivate($title,$text,$timeout=0)
; Parameters ....: $title - The title of the window to check. See Title special definition.
; $text - The text of the window to check.
; $timeout - Timeout in seconds
; Return values .: Success - Returns handle to the requested window.
; Failure - Returns 0 if timeout occurred.
; Author ........: AutoIt
; ===============================================================================================================================
Func _WinWaitActivate
($title,$text="",$timeout=0)
WinWait($title,$text,$timeout)
If Not WinActive($title,$text) Then WinActivate($title,$text)
WinWaitActive($title,$text,$timeout)
EndFunc ;==>_WinWaitActivate
Func _DownloadFile
($URLToDownload,$SavedPath,$FileName)
Local $hDownload=InetGet($URLToDownload, $SavedPath & '' & $FileName, 1, 1)
Do
Sleep(250)
Until InetGetInfo($hDownload, 2) ; Check if the download is complete.
InetClose($hDownload) ; Close the handle to release resources.
EndFunc ;==>_DownloadFile
Func _GetFirstInfoBetweenTags
($URL,$BeginTag,$EndTag)
$array=_StringBetween(_INetGetSource($URL),$BeginTag,$EndTag);~ _ArrayDisplay($array, '')
Return $array[0]
EndFunc ;==>
Func _GetLinkDownload
($file,$BeginTag,$EndTag)
While 1 ; Read in lines of text until the EOF is reached
Local $line=FileReadLine($file)
If @error=-1 Then
Return 0
ExitLoop
EndIf
If StringInStr($line,$BeginTag) And StringInStr($line,$EndTag) Then
$array0=_StringBetween($line,$BeginTag,$EndTag) ;~ ConsoleWrite($line & @CRLF); ConsoleWrite('http:' & $array0[0] & @CRLF)
Return $array0[0]
EndIf
WEnd
EndFunc ;==>
Func _GetLinkMediaFire
($file,$BeginTag,$EndTag,$FileTitleTag)
While 1 ; Read in lines of text until the EOF is reached
Local $line=FileReadLine($file)
If @error=-1 Then
Return 0
ExitLoop
EndIf
If StringInStr($line,"http") And StringInStr($line,$BeginTag) And StringInStr($line,$EndTag) And StringInStr($line,$FileTitleTag) Then
$array0=_StringBetween($line,$BeginTag,$EndTag) ; ConsoleWrite($line & @CRLF); ConsoleWrite('http:' & $array0[0] & @CRLF)
Return 'http:' & $array0[0]
EndIf
WEnd
EndFunc
Func _GetFileName
($Path,$FileExt,$Character)
Local $FileList=_FileListToArray($Path)
If @error=1 Then
MsgBox(0,"","No folders found.",10)
Exit
EndIf
If @error=4 Then
MsgBox(0,"","No files found.",10)
Exit
EndIf
Local $sFlag=True
Local $iStart=0;~ ConsoleWrite(UBound($FileList))
$n=UBound($FileList)
Global $SeekFile[$n+1]
$i=0
$SeekFile[$i]=0
$sExt=$FileExt ;".exe"
While $sFlag=True
Local $iIndex=_ArraySearch($FileList,$sExt,$iStart,0,0,1)
If @error Then
$sFlag=False
Else
$SeekFile[$i]=$FileList[$iIndex]
If StringInStr($SeekFile[$i],$Character,1) Then ; 'SETUP.EXE';~ MsgBox(0,"Found needed exe file",'The exe file #' & $i & ': ' & $SeekFile[$i],1)
$Found=$SeekFile[$i]
EndIf
$i=$i+1
EndIf
$iStart=$iIndex+1
WEnd
Return $Found
EndFunc
; Manipulate system tray program (right click, choose option).au3
Func Get
_Systray
_Index
($sToolTipTitle)
; Find systray handle
$hSysTray_Handle=ControlGetHandle('[Class:Shell_TrayWnd]', '', '[Class:ToolbarWindow32;Instance:1]')
If @error Then
MsgBox(16, "Error", "System tray not found")
Exit
EndIf
; Get systray item count
Local $iSystray_ButCount=_GUICtrlToolbar_ButtonCount($hSysTray_Handle)
If $iSystray_ButCount=0 Then
MsgBox(16, "Error", "No items found in system tray")
Exit
EndIf
; Look for wanted tooltip
For $iSystray_ButtonNumber=0 To $iSystray_ButCount - 1
If StringInStr(_GUICtrlToolbar_GetButtonText($hSysTray_Handle, $iSystray_ButtonNumber), $sToolTipTitle) <> 0 Then ExitLoop
Next
If $iSystray_ButtonNumber=$iSystray_ButCount Then
Return 0 ; Not found
Else
Return $iSystray_ButtonNumber ; Found
EndIf
EndFunc
Func GetPopUpSelText
()
Local $aPopUp_List=_WinAPI_EnumWindowsPopup()
Local $hWnd=$aPopUp_List[1][0]
Local $sClass=$aPopUp_List[1][1]
If $sClass="#32768" Then ; This is a "standard" Windows API popup menu
$hMenu=_SendMessage($hWnd, $MN_GETHMENU, 0, 0)
If _GUICtrlMenu_IsMenu($hMenu) Then
$iCount=_GUICtrlMenu_GetItemCount($hMenu)
For $j=0 To $iCount - 1
If _GUICtrlMenu_GetItemHighlighted($hMenu, $j) Then
Return _GUICtrlMenu_GetItemText($hMenu, $j)
EndIf
Next
EndIf
EndIf
Return ""
EndFunc
; #FUNCTION# ====================================================================================================================
; Name...........: _Get_MonitorsInformation
; Description....: Gets details of all the Displays.
; Syntax.........: _Get_MonitorsInformation()
; Parameters.....: None
; Return values..: The array returned is 8 dimensional and is made up as follows:
; Success ====>
; $array[0][0]=The number of displays on the computer
; $array[0][1]=The Error code returned by MIService Object
;
; $array[1][0]=Name
; $array[1][1]=Monitor Type
; $array[1][2]=Manfucturer
; $array[1][3]=DPI X
; $array[1][4]=DPI Y
; $array[1][5]=Screen Width
; $array[1][6]=Screen Height
; $array[1][7]=Display Type
; Failure ====>
; $array[0][0]=0
; $array[0][1]=The Error code returned by MIService Object
; Author.........: Antonio Do Rosario (Aipion)
; Remarks........: Works with Windows 2000, 2003, XP, Vista and 7
; Example........: No
;~ #include <Array.au3>
;~ $DisplaysArray=_Get_MonitorsInformation()
;~ _ArrayDisplay($DisplaysArray)
;~ ConsoleWrite($DisplaysArray[1][5])
;~ ConsoleWrite($DisplaysArray[1][6])
; ===============================================================================================================================
Func _Get
_MonitorsInformation
() ; Get resolution of 2nd or 3rd monitor
Local $objWMIService ; As Object
Local $colItems ; As Object
Local $objItem ; As Object
Local $DisplaysArray[1][8]
Local $objWMIService=ObjGet("winmgmts:.rootcimv2")
$DisplaysArray[0][1]=Hex(@error, 8)
If @error Then
;Error Getting an active WMIService Object.
$DisplaysArray[0][0]=0
Return $DisplaysArray
EndIf
$colItems=$objWMIService.ExecQuery("Select * From Win32_DesktopMonitor")
For $objItem In $colItems
$DisplaysArray[0][0] += 1
ReDim $DisplaysArray[$DisplaysArray[0][0]+1][8]
$DisplaysArray[$DisplaysArray[0][0]][0]=$objItem.Name ;Name
$DisplaysArray[$DisplaysArray[0][0]][1]=$objItem.MonitorType ;Monitor Type
$DisplaysArray[$DisplaysArray[0][0]][2]=$objItem.MonitorManufacturer ;Manufacturer
$DisplaysArray[$DisplaysArray[0][0]][3]=$objItem.PixelsPerXLogicalInch ;DPI X
$DisplaysArray[$DisplaysArray[0][0]][4]=$objItem.PixelsPerYLogicalInch ;DPI Y
$DisplaysArray[$DisplaysArray[0][0]][5]=$objItem.ScreenWidth ;Screen Width
$DisplaysArray[$DisplaysArray[0][0]][6]=$objItem.ScreenHeight ;Screen Height
;Display Type
Switch $objItem.DisplayType
Case 0
$DisplaysArray[$DisplaysArray[0][0]][7]="Unknown"
Case 1
$DisplaysArray[$DisplaysArray[0][0]][7]="Other"
Case 2
$DisplaysArray[$DisplaysArray[0][0]][7]="MultiScan Color"
Case 3
$DisplaysArray[$DisplaysArray[0][0]][7]="MultiScan Monochrome"
Case 4
$DisplaysArray[$DisplaysArray[0][0]][7]="Fixed Frequency Color"
Case 5
$DisplaysArray[$DisplaysArray[0][0]][7]="Fixed Frequency Monochrome"
Case Else
$DisplaysArray[$DisplaysArray[0][0]][7]="Unknown"
EndSwitch
Next
Return $DisplaysArray
EndFunc
; #AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 -w 7
; #FUNCTION# ====================================================================================================================
; Name ..........: _DesktopDimensions
; Description ...: Returns an array containing information about the primary and virtual monitors.
; Syntax ........: _DesktopDimensions()
; Return values .: Success - Returns a 6-element array containing the following information:
; $aArray[0]=Number of elements.
; $aArray[1]=Total number of monitors.
; $aArray[2]=Width of the primary monitor.
; $aArray[3]=Height of the primary monitor.
; $aArray[4]=Total width of the desktop including the width of multiple monitors. Note: If no secondary monitor this will be the same as $aArray[2].
; $aArray[5]=Total height of the desktop including the height of multiple monitors. Note: If no secondary monitor this will be the same as $aArray[3].
; Author ........: guinness
; Remarks .......: WinAPI.au3 must be included i.e. #include <winapi.au3>
; Related .......: @DesktopWidth, @DesktopHeight, _WinAPI_GetSystemMetrics
; Example .......: Yes
;~ #include <WinAPI.au3>
;~ #include <WindowsConstants.au3>
;~ Global $aScreenResolution
;~ $aScreenResolution=_DesktopDimensions()
;~ ConsoleWrite("Example of _DesktopDimensions():" & @CRLF & _
;~ "Number of monitors=" & $aScreenResolution[1] & @CRLF & _
;~ "Primary Width=" & $aScreenResolution[2] & @CRLF & _
;~ "Primary Height=" & $aScreenResolution[3] & @CRLF & _
;~ "Secondary Width=" & $aScreenResolution[4] & @CRLF & _
;~ "Secondary Height=" & $aScreenResolution[5] & @CRLF)
; ===============================================================================================================================
Func _DesktopDimensions
() ; _DesktopDimensions() - Details about the primary and secondary monitors.
Local $aReturn[6]=[5, _
_WinAPI_GetSystemMetrics($SM_CMONITORS), _ ; Number of monitors.
_WinAPI_GetSystemMetrics($SM_CXSCREEN), _ ; Width or Primary monitor.
_WinAPI_GetSystemMetrics($SM_CYSCREEN), _ ; Height or Primary monitor.
_WinAPI_GetSystemMetrics($SM_CXVIRTUALSCREEN), _ ; Width of the Virtual screen.
_WinAPI_GetSystemMetrics($SM_CYVIRTUALSCREEN)] ; Height of the Virtual screen.
Return $aReturn
EndFunc ;==>_DesktopDimensions
;~ Func Show_About()
;~ MsgBox(64, "About " & $shortscrname, $fullscrname & @LF & @LF & $version & @LF & "Coded by PPCC") ;Hotkey:...
;~ EndFunc
Func _ProcessGetLocation
($iPID)
Local $aProc=DllCall('kernel32.dll', 'hwnd', 'OpenProcess', 'int', BitOR(0x0400, 0x0010), 'int', 0, 'int', $iPID)
If $aProc[0]=0 Then Return SetError(1, 0, '')
Local $vStruct=DllStructCreate('int[1024]')
DllCall('psapi.dll', 'int', 'EnumProcessModules', 'hwnd', $aProc[0], 'ptr', DllStructGetPtr($vStruct), 'int', DllStructGetSize($vStruct), 'int_ptr', 0)
Local $aReturn=DllCall('psapi.dll', 'int', 'GetModuleFileNameEx', 'hwnd', $aProc[0], 'int', DllStructGetData($vStruct, 1), 'str', '', 'int', 2048)
If StringLen($aReturn[3])=0 Then Return SetError(2, 0, '')
Return $aReturn[3]
EndFunc
; For ä ö ü ß ä ö ü € ´ (Special German keyboard)
HotKeySet("+{F1}","a_umlaut")
Func a
_umlaut
()
Send("ä")
EndFunc
HotKeySet("^+{F1}","ca_umlaut")
Func ca
_umlaut
()
Send("ä")
EndFunc
HotKeySet("+{F2}","o_umlaut")
Func o
_umlaut
()
Send("ö")
EndFunc
HotKeySet("^+{F2}","co_umlaut")
Func co
_umlaut
()
Send("ö")
EndFunc
HotKeySet("+{F3}","u_umlaut")
Func u
_umlaut
()
Send("ü")
EndFunc
HotKeySet("^+{F3}","cu_umlaut")
Func cu
_umlaut
()
Send("ü")
EndFunc
HotKeySet("+{F4}","eszett")
Func eszett
()
Send("ß")
EndFunc
HotKeySet("^+{F4}","euro")
Func euro
()
Send("€")
EndFunc
HotKeySet("+{F5}","acute_accent")
Func acute
_accent
()
Send("´")
EndFunc
; Copy and edit from <a href='http://www.autoitscript.com/forum/topic/133222-manipulate-system-tray-program-right-click-choose-option/' class='bbc_url' title=''>http://www.autoitscript.com/forum/topic/133222-manipulate-system-tray-program-right-click-choose-option/</a>
Func _ActiveContextMenuSysTrayIcon
($SendKey,$sToolTipTitle)
Run('control /name Microsoft.NotificationAreaIcons')
While 1
If WinActive("Notification Area Icons") Then ExitLoop
WEnd
_WinWaitActivate
("Notification Area Icons","")
ControlSend("Notification Area Icons","","Button3","{ALTDOWN}a{ALTUP}{+}");~ ControlCommand("Notification Area Icons","","Button3","Check", "");~ Send("{ALTDOWN}a{ALTUP}{+}")
Sleep(500)
Global $hSysTray_Handle, $iSystray_ButtonNumber
Opt("WinTitleMatchMode", 2)
$iSystray_ButtonNumber=Get
_Systray
_Index
($sToolTipTitle)
Opt("WinTitleMatchMode", 1)
If $iSystray_ButtonNumber=0 Then
MsgBox(16, "Error", "The '" & $sToolTipTitle & "' application seems to be not running!",5);~ Exit
Else
Sleep(500)
_GUICtrlToolbar_ClickButton($hSysTray_Handle, $iSystray_ButtonNumber, "right")
Sleep(500)
;~ $SendKeyArray=StringSplit($SendKey,"")
;~ For $Key In $SendKeyArray
;~ Send($Key); Move your cursor around on the menu here <<<<<<<<<<<<<<<<<<<<<<<<<<<;~ ConsoleWrite(GetPopUpSelText() & @CRLF) ; This will read the currently selected item <<<<<<<<<<<<<<<<<<<<<<<<<<<<
;~ Next
Send($SendKey)
Sleep(1000)
EndIf
Run('control /name Microsoft.NotificationAreaIcons')
While 1
If WinActive("Notification Area Icons") Then ExitLoop
WEnd
_WinWaitActivate
("Notification Area Icons","")
ControlSend("Notification Area Icons","","Button3","{ALTDOWN}a{ALTUP}{-}")
Sleep(500)
WinClose("Notification Area Icons")
EndFunc
; Copy and edit from <a href='http://www.autoitscript.com/forum/topic/102160-msgbox-with-downtime-count/page__view__findpost__p__751116' class='bbc_url' title=''>http://www.autoitscript.com/forum/topic/102160-msgbox-with-downtime-count/page__view__findpost__p__751116</a>
Func MsgBoxDJS
($flag, $title, $text, $timeout=10, $Cflag=1, $hwnd='')
Global $vStringFormat='%01s'
Global $Timer=DllCallbackRegister('Timer', 'int', 'hwnd;uint;uint;dword')
If $timeout='' Or $timeout=-1 Then $timeout=10
Global $_title=$title, $_text=$text, $_Cflag=$Cflag, $_ibj=1, $_ttc=$timeout, $bttxtbj=0
Global $TimerDLL=DllCall('user32.dll', 'uint', 'SetTimer', 'hwnd', 0, 'uint', 0, 'int', 1000, 'ptr', DllCallbackGetPtr($Timer))
Local $Mkmsg
If $Cflag=0 Then
If StringRegExp($title, '%s')=0 Then
$title='%s' & $title
$_title=$title
EndIf
$title=StringRegExpReplace($title, "%s", StringFormat($vStringFormat, $_ttc), 1)
EndIf
If $Cflag=1 Then
If StringRegExp($text, '%s')=0 Then
$text=$text & ' %s seconds.' ;'%s' & $text
$_text=$text
EndIf
$text=StringRegExpReplace($text, "%s", StringFormat($vStringFormat, $_ttc), 1)
EndIf
$Mkmsg=MsgBox($flag, $title, $text)
DllClose($TimerDLL)
DllCallbackFree($Timer)
Return $Mkmsg
EndFunc ;==>MsgBoxDJS
Func Timer
($hwnd, $uiMsg, $idEvent, $dwTime)
Global $TimerDLL, $bttxtbj, $_Cflag, $_title, $_ttc, $_text, $_ibj, $Timer
If $idEvent=$TimerDLL[0] Then
Global $bttxt, $CtrlF, $Static
If $bttxtbj=0 Then
If $_Cflag=0 Then $CtrlF=ControlGetFocus(StringRegExpReplace($_title, "%s", StringFormat($vStringFormat, $_ttc), 1))
If $_Cflag=1 Or $_Cflag=2 Then $CtrlF=ControlGetFocus($_title)
$bttxt=ControlGetText($_title, $_text, $CtrlF)
If $_Cflag=1 Then
$Static='Static1'
ControlGetText($_title, StringRegExpReplace($_text, "%s", StringFormat($vStringFormat, $_ttc), 1), 'Static1')
If @error Then $Static='Static2'
EndIf
$bttxtbj=1
EndIf
If $_Cflag=0 Then
$_title1=StringRegExpReplace($_title, "%s", StringFormat($vStringFormat, $_ttc - $_ibj + 1), 1)
$_title2=StringRegExpReplace($_title, "%s", StringFormat($vStringFormat, $_ttc - $_ibj), 1)
WinSetTitle($_title1, $_text, $_title2)
ElseIf $_Cflag=1 Then
$_text1=StringRegExpReplace($_text, "%s", StringFormat($vStringFormat, $_ttc - $_ibj + 1), 1)
$_text2=StringRegExpReplace($_text, "%s", StringFormat($vStringFormat, $_ttc - $_ibj), 1)
ControlSetText($_title, $_text1, $Static, $_text2)
ElseIf $_Cflag=2 Then
ControlSetText($_title, $_text, $CtrlF, $bttxt & StringFormat(' %03s', $_ttc - $_ibj))
EndIf
If $_ibj=$_ttc Then
If $_Cflag=0 Then $_title=$_title2
If $_Cflag=1 Then $_text=$_text2
DllClose($TimerDLL)
DllCallbackFree($Timer)
ControlClick($_title, $_text, $CtrlF, '', 2)
EndIf
$_ibj += 1
EndIf
EndFunc ;==>Timer
; <a href='http://www.autoitscript.com/forum/topic/112868-getting-progressbar-to-work-with-inetget/' class='bbc_url' title=''>http://www.autoitscript.com/forum/topic/112868-getting-progressbar-to-work-with-inetget/</a>
; $FileURL1="<a href='http://download.macromedia.com/pub/flashplayer/current/uninstall_flash_player.exe' class='bbc_url' title='External link' rel='nofollow external'>http://download.macromedia.com/pub/flashplayer/current/uninstall_flash_player.exe"</a>
; $FileName1="uninstall_flash_player.exe"
; $Program1="Flash uninstall"
; _DownloadProgress($FileURL1, $FileName1, $Program1)
Func _DownloadFileProgress
($FileURL, $FileName, $ProgramName, $SavedDir=@TempDir)
$FileSaveLocation=$SavedDir & "" & $FileName
$FileSize=InetGetSize($FileURL)
$FileDownload=InetGet($FileURL, $FileSaveLocation, 0, 1)
ProgressOn("", "", "", -1, 5, 18)
Do
$Percentage=InetGetInfo($FileDownload, 0) * 100 / $FileSize
ProgressSet($Percentage, Round($Percentage, 0) & "% Downloaded " & Round(InetGetInfo($FileDownload, 0) / 1048576, 2) & " of " & Round($FileSize / 1048576, 2) & " MB", "Downloading " & $ProgramName)
Sleep(250)
Until InetGetInfo($FileDownload, 2)
EndFunc ;==>_DownloadFileProgress