Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 12/18/2019 in all areas

  1. trancexx

    WinHTTP functions

    The other day mikeytown2 posted one post in HTTP UDF's thread that got me thinking if there is better (different) method to send requests through the HTTP protocol to HTTP servers. There is Winhttp.dll that ships with windows and that is its main purpose. I couldn't find any examples of using this dll in AutoIt, so I came up with this. Microsoft about Windows HTTP Services: Microsoft Windows HTTP Services (WinHTTP) provides developers with an HTTP client application programming interface (API) to send requests through the HTTP protocol to other HTTP servers... .. blah, blah, and so on... This is an example of getting page header: #include "WinHttp.au3" Opt("MustDeclareVars", 1) ; Open needed handles Local $hOpen = _WinHttpOpen() Local $hConnect = _WinHttpConnect($hOpen, "msdn.microsoft.com") ; Specify the reguest: Local $hRequest = _WinHttpOpenRequest($hConnect, Default, "en-us/library/aa384101(VS.85).aspx") ; Send request _WinHttpSendRequest($hRequest) ; Wait for the response _WinHttpReceiveResponse($hRequest) Local $sHeader = _WinHttpQueryHeaders($hRequest) ; ...get full header ; Clean _WinHttpCloseHandle($hRequest) _WinHttpCloseHandle($hConnect) _WinHttpCloseHandle($hOpen) ; Display retrieved header MsgBox(0, "Header", $sHeader)Everything you need to be able to use this UDF can be found at WinHttp site. Remember, basic understanding of the HTTP protocol is important to use this interface. ProgAndy, trancexx WinHttp.au3 is completely free and no one has right to charge you for it. That's very important. If you feel WinHttp.au3 was helpful to you and you wish to support my further work you can donate to my personal account via PayPal address: trancexx at yahoo dot com I will appreciate that very much. Thank you in advance! :kiss:
    1 point
  2. Hi @KaFu ! I'm probably already tired and missing something . PID=" & $aList[$i][0] ==> according to ProcessList the PID has the index [$i][[1]. Name=" & $aList[$i][1] ==> according to ProcessList the Name has the index [$i][[0]. The .mp3 file is executed by the application associated with the .mp3 extension (in my case vlc.exe). This StringInStr will never come TRUE, as far as i can say. #include <Array.au3> #include <WinAPIProc.au3> $sFilename = '"' & @ScriptDir & '\Music 01.mp3"' $iPID = Run(@ComSpec & ' /c start "Titel" ' & $sFilename,"",@SW_HIDE) ConsoleWrite("< ------------------------------------------------------------------------------" & @CRLF) ConsoleWrite("+ Filename : <" & $sFilename & ">" & @CRLF) ConsoleWrite("+ PID Run(...) : <" & $iPID & ">" & @CRLF) ConsoleWrite("< ------------------------------------------------------------------------------" & @CRLF) Sleep(2000) ; wait for the default program to launch $aList = ProcessList() For $i = 1 To $aList[0][0] If $aList[$i][0] = "vlc.exe" Then ConsoleWrite("> PID = <" & $aList[$i][1] & ">" & _ " Name = <" & $aList[$i][0] & ">" & _ " CommandLine = <" & _WinAPI_GetProcessCommandLine($aList[$i][1]) & ">" & @CRLF) EndIf Next ConsoleWrite("< ------------------------------------------------------------------------------" & @CRLF) Would you be so kind to explain, what exactly you are trying to achieve? TIA 🙂
    1 point
  3. glad I could help, make sure skipping in Column C is alright tho...
    1 point
  4. thank the whole forum and thank you very much NINE for your precious help
    1 point
  5. Do not put your start file inside double quotes. It is interpreted by start as a title...
    1 point
  6. Hi seadoggie01, Apologies for the late reply, I just got back to work. Thank you so much for the tips and much appreciated. Happy holidays !!! BR UM
    1 point
  7. MacScript, You are overcomplicating things - using GUICtrlSetData with a leading "|" will replace the data automatically: #include <GUIConstantsEx.au3> #include <MsgBoxConstants.au3> $sData_Dual = "|Setup|Mode-Dual|Copy|Filter" ; Note leading "|" $sData_Single = "|Setup|Mode-Single|Copy|Filter" $hGUI = GUICreate("Test", 500, 500) $cCombo = GUICtrlCreateCombo("", 10, 10, 200, 20) GUICtrlSetData($cCombo, $sData_Dual) $fDual = True ; Set a flag GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $cCombo Switch GUICtrlRead($cCombo) Case "Setup" MsgBox($MB_SYSTEMMODAL, "Selected", "Setup") Case "Copy" MsgBox($MB_SYSTEMMODAL, "Selected", "Copy") Case "Filter" MsgBox($MB_SYSTEMMODAL, "Selected", "Filter") Case Else $fDual = Not $fDual ; Toggle the flag If $fDual Then GUICtrlSetData($cCombo, $sData_Dual) Else GUICtrlSetData($cCombo, $sData_Single) EndIf EndSwitch EndSwitch WEnd M23
    1 point
×
×
  • Create New...