Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 12/19/2022 in all areas

  1. Curl is the more reliable way BTW you can populate a progressbar while downloading using curl, example below #include <AutoItConstants.au3> $source = "https://www.autoitscript.com/autoit3/files/archive/autoit/autoit-v3.3.14.5.zip" $file = StringRegExpReplace($source, '.*/([^/]+)$', "$1") $cmd = 'curl -L -k ' & $source & ' -o "' & @scriptdir & '\' & $file & '"' Local $iPID = Run($cmd, "", @SW_HIDE, $STDOUT_CHILD+$STDERR_CHILD) ProgressOn($file, "") While 1 $tmp = StderrRead($iPID) If @error Then Exitloop If $tmp <> "" and StringRegExp($tmp, '(?i)[kmg]') Then $pc = StringRegExp($tmp, '(\d+)', 1) If not @error Then ProgressSet($pc[0], $pc[0] & " %") EndIf Wend ProgressOff() Msgbox(0,"", $file & " : done")
    2 points
  2. Did you check the help file? Function Run (autoitscript.com) Run(@ComSpec & " /c " & 'start /min  http://../html/myhtml.html ', @ScriptDir, @SW_HIDE) ; don't forget " " before "/c" ; 2018.08.01 Opening the exe with no purpose, means it closes after it has run (no error) For RUN the param /c forces it open In this example the command line forces windows to use the default program associated with the target, eg chrome opens the local HTML page @SW_HIDE runs the command in a hidden window, but the browser opens The start /min param keeps the browser minimized
    2 points
  3. @jpm I got 2 scripts that could be interesting for the help file (at least the 1st script) : 1) _WinAPI_GetWindowInfo The example found in AutoIt help file could show more functionalities of the interesting function GetWindowInfo (especially $tagWINDOWINFO structure isn't found in the help file), for example : #include <WinAPISysWin.au3> Example() Func Example() ; Open Notepad Run("notepad.exe") WinWaitActive("[CLASS:Notepad]") Local $hWnd = WinGetHandle("[CLASS:Notepad]") If $hWnd = 0 Then Exit MsgBox(0, "NotePad", "Handle = 0") ; Move NotePad window to 10, 10 and resize it to 500, 400 WinMove($hWnd, "", 10, 10, 500, 400) ConsoleWrite("Window Title : " & WinGetTitle($hWnd) & @crlf) ; Get infos concerning NotePad Window Local $tWINDOWINFO = _WinAPI_GetWindowInfo($hWnd) ConsoleWrite("Window coords : Left & Top & Right & Bottom : " & _ $tWINDOWINFO.rWindow(1) & " / " & $tWINDOWINFO.rWindow(2) & " / " & _ $tWINDOWINFO.rWindow(3) & " / " & $tWINDOWINFO.rWindow(4) & @crlf) ConsoleWrite("Client coords : Left & Top & Right & Bottom : " & _ $tWINDOWINFO.rClient(1) & " / " & $tWINDOWINFO.rClient(2) & " / " & _ $tWINDOWINFO.rClient(3) & " / " & $tWINDOWINFO.rClient(4) & @crlf) ConsoleWrite("Border : Width & Height : " & _ $tWINDOWINFO.cxWindowBorders & " / " & $tWINDOWINFO.cyWindowBorders & @crlf) ConsoleWrite("Active ? " & ($tWINDOWINFO.WindowStatus = 1 ? "Yes" : "No") & @crlf) ConsoleWrite("Style : " & "0x" & Hex($tWINDOWINFO.Style, 8) & @crlf) ConsoleWrite("Extended Style : " & "0x" & Hex($tWINDOWINFO.ExStyle, 8) & @crlf) ConsoleWrite("Class Atom : " & $tWINDOWINFO.atomWindowType & @crlf) ConsoleWrite("Window creator version : " & "0x" & Hex($tWINDOWINFO.CreatorVersion, 4) & @crlf & @crlf) Local $tWinRECT = _WinAPI_GetWindowRect($hWnd) ConsoleWrite("Reminder : _WinAPI_GetWindowRect : Left & Top & Right & Bottom : " & _ $tWinRECT.left & " / " & $tWinRECT.top & " / " & _ $tWinRECT.right & " / " & $tWinRECT.bottom & @crlf) Local $tCliRECT = _WinAPI_GetClientRect($hWnd) ConsoleWrite("Reminder : _WinAPI_GetClientRect : Left & Top & Right & Bottom : " & _ $tCliRECT.left & " / " & $tCliRECT.top & " / " & _ $tCliRECT.right & " / " & $tCliRECT.bottom & @crlf) MsgBox(0,"Message","End script when you wish") ; Close Notepad window WinClose($hWnd) EndFunc ;==>Example 2) _WinAPI_GetTitleBarInfo If I'm not mistaken, this function doesn't exist in AutoIt. As I needed the GetTitleBarInfo function (which requires the TITLEBARINFO structure) then I scripted what follows : #include <WinAPISysWin.au3> Example() Func Example() Sleep(3000) ; give time for user to change the active window Local $hWnd = WinGetHandle("[ACTIVE]") Local $sTitle = WinGetTitle($hWnd) Local $sClassName = _WinAPI_GetClassName($hWnd) ConsoleWrite("Window Active Handle : " & $hWnd & @crlf) ConsoleWrite("Window Title : " & $sTitle & @crlf) ConsoleWrite("Class Name : " & $sClassName & @crlf) Local $tTITLEBARINFO = _WinAPI_GetTitleBarInfo($hWnd) ConsoleWrite("TitleBar Coords : Left & Top & Right & Bottom : " & _ $tTITLEBARINFO.TitleBar(1) & " / " & $tTITLEBARINFO.TitleBar(2) & " / " & _ $tTITLEBARINFO.TitleBar(3) & " / " & $tTITLEBARINFO.TitleBar(4) & @crlf) For $i = 1 To 6 ConsoleWrite("Element " & $i & " : 0x" & Hex($tTITLEBARINFO.State(($i)), 8) & @crlf) Next EndFunc ;==>Example ;================================== Func _WinAPI_GetTitleBarInfo($hWnd) Local Const $CCHILDREN_TITLEBAR = 5 Local Const $tagTITLEBARINFO = 'dword Size;long TitleBar[4];dword State[' & ($CCHILDREN_TITLEBAR + 1 ) & ']' Local $tTITLEBARINFO = DllStructCreate($tagTITLEBARINFO) DllStructSetData($tTITLEBARINFO, 'Size', DllStructGetSize($tTITLEBARINFO)) Local $aCall = DllCall('user32.dll', 'bool', 'GetTitleBarInfo', 'hwnd', $hWnd, 'struct*', $tTITLEBARINFO) If @error Or Not $aCall[0] Then Return SetError(@error + 10, @extended, 0) Return $tTITLEBARINFO EndFunc ;==>_WinAPI_GetTitleBarInfo Let's hope both scripts are correct. Thanks for reading
    1 point
  4. Welcome to the AutoIt forum. Unfortunately you appear to have missed the Forum rules on your way in. Please read them now - particularly the bit about not discussing game automation - and then you will understand why you will get no help and this thread will now be locked. See you soon with a legitimate question I hope. The Moderation team
    1 point
  5. https://random-word-api.herokuapp.com/word?number=10 API-Documentation: http://random-word-api.herokuapp.com/home
    1 point
×
×
  • Create New...