Jump to content

iCode

Active Members
  • Posts

    194
  • Joined

  • Last visited

Everything posted by iCode

  1. _ClipBoard_GetDataEx returns '0' for some formats and i don't know why the formats in this instance are 49577 and 49756, which are in clipboard memory (if that's the right term) after copying an image in Firefox the dll call for _ClipBoard_GetDataEx is: DllCall("user32.dll", "handle", "GetClipboardData", "uint", $iFormat) according to MSDN, i'm not seeing anything wrong with the dll call, so i guess my question is; how can _ClipBoard_GetDataEx fail (return 0) if the format is valid (and how could the format be in clipboard mem if it wasn't valid)? is this something specific to binary formats perhaps?
  2. that's what i'm going to use i think i was trying to do basically the same thing without having to free the memory if the data wasn't put back, hence storing it in an array sorry for the bother
  3. i do appreciate the help now i'll add what i should have said in the beginning; after backing up the clipboard, i then need to restore it from the array i added an element to your array to store the format, but _ClipBoard_SetDataEx fails in the 2nd function because, i assume, the array is holding only binary and i'm feeding _ClipBoard_SetDataEx binary data instead of a handle and an incorrect format type for that data here's what i have... #include <ClipBoard.au3> #include <Array.au3> Global $avClip ConsoleWrite("----- GET -----" & @LF) _Clipboard_GetAll() ConsoleWrite("_Clipboard_GetAll error = " & @error & @LF) If @error Then Exit _ArrayDisplay($avClip) ConsoleWrite("----- PUT -----" & @LF) _ClipBoard_PutAll($avClip) ConsoleWrite("_ClipBoard_PutAll error = " & @error & @LF) Func _Clipboard_GetAll() Local $iErr = 0, $iFormat = 0, $hMem = 0, $pMemBlk = 0, $iSize = 0, $tData, $bData If _ClipBoard_Open(0) = False Then Return SetError(1, 0, 0) Dim $avClip[1][2] While 1 $iFormat = _ClipBoard_EnumFormats($iFormat) If $iFormat = 0 Then ExitLoop $hMem = _ClipBoard_GetDataEx($iFormat) If $hMem = 0 Then ConsoleWrite("$hMem=0" & @LF) ContinueLoop EndIf $pMemBlk = _MemGlobalLock($hMem) If $pMemBlk = 0 Then $iErr = 2 ExitLoop EndIf ; Get the actual memory size of the ClipBoard memory object (in bytes) $iSize = _MemGlobalSize($hMem) If $iSize = 0 Then _MemGlobalUnlock($hMem) $iErr = 3 ExitLoop EndIf ; Binary data return for all formats $tData = DllStructCreate("byte[" & $iSize & "]", $pMemBlk) ; Grab the data from the Structure so the Memory can be unlocked $bData = DllStructGetData($tData, 1) ; Unlock the memory _MemGlobalUnlock($hMem) ReDim $avClip[UBound($avClip) + 1][2] $avClip[0][0] += 1 $avClip[UBound($avClip) - 1][0] = $bData $avClip[UBound($avClip) - 1][1] = $iFormat WEnd _ClipBoard_Close() If $iErr Then Return SetError($iErr, 0, 0) Return 1 EndFunc ;==>Example Func _ClipBoard_PutAll(ByRef $avClip) Local $iErr = 0 If Not IsArray($avClip) Or UBound($avClip, 0) <> 2 Or $avClip[0][0] < 1 Then Return SetError(1, 0, 0) If Not _ClipBoard_Open(0) Then Return SetError(2, 0, 0) If Not _ClipBoard_Empty() Then _ClipBoard_Close() Return SetError(3, 0, 0) EndIf If Not _ClipBoard_Close() Then Return SetError(4, 0, 0) If Not _ClipBoard_Open(0) Then Return SetError(5, 0, 0) For $i = 1 To $avClip[0][0] If _ClipBoard_SetDataEx($avClip[$i][0], $avClip[$i][1]) = 0 Then ; <<< here's where it explodes $iErr = 6 ExitLoop EndIf Next _ClipBoard_Close() If $iErr Then Return SetError($iErr, 0, 0) Return 1 EndFunc
  4. $hMemory = _ClipBoard_GetDataEx($CF_TEXT) If $hMemory = 0 Then _WinAPI_ShowError("_ClipBoard_GetDataEx failed") $tData = DllStructCreate("char Text[8192]", $hMemory) MemoWrite(DllStructGetData($tData, "Text")) i have - the problem is that i'm wanting to run _ClipBoard_GetDataEx in a loop and i have no idea what the formats may be - i'm not trying to retrieve a known format, but rather everything on the clipboard, so i don't know how to write "DllStructCreate("char Text[8192]", $hMemory)" when i don't know the format i want to do basically the same thing as _ClipBoard_GetAll in the examples forum, but i would like to eliminate the memory/mem copy stuff and just store the actual clipboard data, in all formats, in an array so basically my question is how to get the data from the handle that _ClipBoard_GetDataEx returns?
  5. made a post about this yesterday but got no replies and i think i didn't ask my question very well... i'm using _ClipBoard_GetDataEx in a loop to grab all available formats in the clipboard and i want to store the data in an array i think i need to use DllStructCreate and DllStructGetData to get the data from the handle returned by _ClipBoard_GetDataEx, and therein lies my problem; i don't know what the hell i'm doing when it comes to dll stuff here's the [non-working] code i have... Global $avClip _ClipBoard_Open(0) Do $iFormat = _ClipBoard_EnumFormats($iFormat) If $iFormat = 0 Then ContinueLoop $hMem = _ClipBoard_GetDataEx($iFormat) If $hMem = 0 Then ContinueLoop $tStruct = DllStructCreate("PTR", $hMem) ; <<< obviously very wrong, but it's the best i could come up with $vData = DllStructGetData($tStruct, 1) ; <<< probably very wrong also ReDim $avClip[UBound($avClip) + 1][2] $avClip[0][0] += 1 $avClip[UBound($avClip) - 1][0] = $vData $avClip[UBound($avClip) - 1][1] = $iFormat Until $iFormat = 0 _ClipBoard_Close()
  6. i want to use _ClipBoard_GetDataEx in a loop to retrieve all data from the clipboard and copy it into an array, similar to ?do=embed' frameborder='0' data-embedContent>>_ClipBoard_GetAll by wraithdu, but without the extra memory stuff Basically all i did was to comment out the memory parts of ?do=embed' frameborder='0' data-embedContent>>_ClipBoard_GetAll, but it doesn't work because the data that gets restored is not the data that was copied into the array Looking at _ClipBoard_GetDataEx in the help file, i think i am missing the dll stuff... $tData = DllStructCreate("char Text[8192]", $hMemory) DllStructGetData($tData, "Text") The problem is that i don't know how to write the dll functions when the clipboard format (char Text[8192]) could be anything Here's what i have so far... #include <Clipboard.au3> #include <Array.au3> Global $avClip, $iErr = 0 ConsoleWrite("-------- GET --------" & @LF) _Clipboard_GetAll($avClip) If @error Then ConsoleWrite("_Clipboard_GetAll error = " & @error & @LF) Exit EndIf _ArrayDisplay($avClip) ;Exit Sleep(100) ConsoleWrite("-------- PUT --------" & @LF) _ClipBoard_PutAll($avClip) If @error Then ConsoleWrite("_ClipBoard_PutAll error = " & @error & @LF) ; http://www.autoitscript.com/forum/topic/81267-clipboard-getall-clipboard-putall-clipboard-wait/ Func _Clipboard_GetAll(ByRef $avClip) Local $iFormat = 0, $hMem, $hMem_new, $pSource, $pDest, $iSize, $iErr = 0, $iErr2 = 0 Dim $avClip[1][2] If Not _ClipBoard_Open(0) Then Return SetError(-1, 0, 0) Do $iFormat = _ClipBoard_EnumFormats($iFormat) If $iFormat <> 0 Then $hMem = _ClipBoard_GetDataEx($iFormat) If $hMem = 0 Then $iErr += 1 ContinueLoop EndIf ReDim $avClip[UBound($avClip) + 1][2] $avClip[0][0] += 1 $avClip[UBound($avClip) - 1][0] = $hMem $avClip[UBound($avClip) - 1][1] = $iFormat EndIf Until $iFormat = 0 _ClipBoard_Close() Local $ErrRet = 0 If $iErr Then $ErrRet -= 2 If $ErrRet Then Return SetError($ErrRet, $iErr, 0) Else Return 1 EndIf EndFunc Func _ClipBoard_PutAll(ByRef $avClip) Local $iErr = 0 If Not IsArray($avClip) Or UBound($avClip, 0) <> 2 Or $avClip[0][0] <= 0 Then Return SetError(-1, 0, 0) If Not _ClipBoard_Open(0) Then Return SetError(-2, 0, 0) If Not _ClipBoard_Empty() Then _ClipBoard_Close() Return SetError(-3, 0, 0) EndIf ; seems to work without closing / reopening the clipboard, but MSDN implies we should do this ; since a call to EmptyClipboard after opening with a NULL handle sets the owner to NULL, ; and SetClipboardData is supposed to fail, so we close and reopen it to be safe _ClipBoard_Close() If Not _ClipBoard_Open(0) Then Return SetError(-3, 0, 0) For $i = 1 To $avClip[0][0] If _ClipBoard_SetDataEx($avClip[$i][0], $avClip[$i][1]) = 0 Then $iErr += 1 Next _ClipBoard_Close() If $iErr Then Return SetError(-4, $iErr, 0) Else Return 1 EndIf EndFunc
  7. thanks @Melba23 FYI, here's the note i made in a code snippet regarding the sleep dll call.. ; however, do NOT make the DllCall() if the sleep is going to be repeated in a tight loop, else funny things happen outside of script, such as Ctrl+L-click gets whacky when selecting multiple objects in Explorer
  8. @Melba23 - try both 32 and 64 bit, release and beta - i would guess you'll probably experience very different results as i and @jchd did @D4RKON3 - i agree, but just a note to others who stumble upon this that the dll call, in a tight loop with small values, will hog the CPU... ; CPU hog with small values... While 1 DllCall("kernel32.dll", "none", "Sleep", "DWORD", 1) Wend anyway, no big deal, but i think the help file should be updated to reflect the inaccuracy of Sleep at smaller values (so far it looks like values < 17 are problematic)
  9. win 7 i suspected that smaller values may be inherently inaccurate according to other discussions on the subject i hadn't thought to test x86 vs x64, but yes, that also causes different behavior... x64: both production and beta = ~9-13 ms (Sleep(1)) x86: production = ~15 ms, beta = ~2 ms (Sleep(1)) that's uncompiled if this is something that isn't going to (or can't) be fixed, i think the help file should probably be updated
  10. somewhere since the last release version the Sleep function has become less accurate on my PC, this... $t = TimerInit() Sleep(10) $n = TimerDiff($t) ConsoleWrite($n & @LF) ...sleeps for ~14.5 ms for 3.3.10.2 and ~2 ms for 3.3.11.4 higher values (around 17+) are far more accurate, but anything less than 17 sleeps for about the same time, roughly 1-3 ms it is nice that the sleep function will now sleep for less than 10 ms though
  11. Scite for AutoIt 3.4.1 win 7 x64 1) Saving the Scite options from the UI acts a bit strange; when clicking 'save and apply', then exiting, user is again prompted to save 2) Scite config UI > General 2 tab > Current Word Highlight group ... For 'Whole word', Match style' and 'Match case', selecting or de-selecting these checkboxes causes something to run in an endless loop (seen by constant flickering in the status control) and settings are not saved 3) I have also had settings revert to their defaults once upon restarting the editor (after the initial install i think). FYI: When i installed the Scite for AutoIt package, i tried to do a clean install; uninstall previous version and delete all left over settings/properties files in %appdata%. The settings are now in 'LocalAutoIt v3SciTE' as they should be. 4) For both this version and the last release (and possibly earlier), highlighting all other instances of a selected string works, but sometimes the other instances lose the highlighting when the document is scrolled 5) For both this version and the last release (and possibly earlier), using Ctrl+F2 to clear a bookmark does not always work
  12. EDIT: never mind
  13. FYI... >Running Au3Stripper (1.2.0.0) from:C:\Program Files (x86)\AutoIt3\SciTE\Au3Stripper cmdline: /Beta - ### C:\Program Files (x86)\AutoIt3\SciTE\Au3Stripper\Au3Stripper.dat missing... Please get it from the website to make sure the Obfuscation will work correctly. Apparently Au3Stripper.dat is not included in the installer and i couldn't find it anywhere at the autoit domain Also a broken Start menu link: AutoIt v3 > SciTE > Switch-Definitions.lnk UpdateDefs.exe is also not included in the installer
  14. EDIT: cancel this request, at least for now There is allot more to be done than what i posted below @Melba - small feature request to set the bkcolor of LV items since it's not so easy to figure out how to do it after they are created (can be done with _GUICtrlListView_GetItemParam() if anyone is interested)... Func _GUIListViewEx_Insert($vData, $iBkColor = 0xFFFFFF) ... ; Rewrite ListView _GUIListViewEx_ReWriteLV($hGLVEx_SrcHandle, $cGLVEx_SrcID, $aGLVEx_SrcArray, $iArray_Index, $iBkColor = 0xFFFFFF) Func _GUIListViewEx_ReWriteLV($hLVHandle, $cLV_CID, ByRef $aLV_Array, $iLV_Index, $iBkColor = 0xFFFFFF) ... ; Create item GUICtrlCreateListViewItem(StringTrimRight($sLine, 1), $cLV_CID) GUICtrlSetBkColor(-1, $iBkColor)
  15. HI Melba23 Quite an impressive UDF I'm in the process of modifying it to suit my needs and i noticed you are using _GUICtrlListView_EndUpdate in _GUIListViewEx_ReWriteLV, but _GUICtrlListView_BeginUpdate is absent I noticed the flicker is reduced/eliminated with that added also, little typo -- find: WM_LBUTTONUPhandlers replace: WM_LBUTTONUP handlers
  16. 1) I was only interested in resizing if the max/restore control was pressed (and of course if the resize was done by dragging the window frame) 2) Oh, i see! I was looking at the wrong doc Thanks!
  17. Hello KaFu Am i correct in assessing that there is essentially no difference between using your AdLibRegister and my Case method? If so, personally i prefer using the extra Case. Windows Messages are not a strong point for me, so if i may ask, where does the '0xFFF0' come from in: Switch BitAND($wParam, 0xFFF0)? Edit: i shortened the code and updated the first post
  18. This works, but i would like to see if anyone can do the same using only the Window Message instead of having the extra Case #include <GUIConstantsEx.au3> #include <TabConstants.au3> #include <WindowsConstants.au3> Global $Form1 = GUICreate("Form1", 214, 121, 645, 124, BitOR($GUI_SS_DEFAULT_GUI, $WS_MAXIMIZEBOX, $WS_SIZEBOX, $WS_THICKFRAME, $WS_TABSTOP)) Global $Tab1 = GUICtrlCreateTab(0, 0, 213, 120, $TCS_FIXEDWIDTH) ; $TCS_FIXEDWIDTH required! GUICtrlSetResizing(-1, $GUI_DOCKLEFT+$GUI_DOCKRIGHT+$GUI_DOCKTOP+$GUI_DOCKBOTTOM) GUICtrlCreateTabItem("TabSheet1") GUICtrlCreateTabItem("TabSheet2") GUICtrlCreateTabItem("") Global $aCtrlPosTab, $aWinPos = WinGetPos($Form1) ; used only to set min/max gui size (optional) _Tab_SetWidth() ; set initial tab width GUISetState(@SW_SHOW) GUIRegisterMsg($WM_GETMINMAXINFO, "_WINMSG") ;GUIRegisterMsg($WM_WINDOWPOSCHANGING, "_WINMSG") ;GUIRegisterMsg($WM_SYSCOMMAND, "_WINMSG") ;GUIRegisterMsg($WM_SIZE, "_WINMSG") ;GUIRegisterMsg($WM_ENTERSIZEMOVE, "_WINMSG") ;GUIRegisterMsg($WM_EXITSIZEMOVE, "_WINMSG") While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $GUI_EVENT_MAXIMIZE, $GUI_EVENT_RESTORE $aCtrlPosTab = ControlGetPos($Form1, "", $Tab1) ; we need the tab control width to set the tab size If Not @error Then GUICtrlSendMsg($Tab1, $TCM_SETITEMSIZE, 0, Int($aCtrlPosTab[2] / 2) - 2) ; size tabs - need to deduct 1-2px, else sometimes the previous/next tab control will show EndSwitch WEnd Func _Tab_SetWidth() ; sets the initial tab width to fit the tab control Local $aRet = ControlGetPos($Form1, "", $Tab1) ; used to set tab width If Not @error Then GUICtrlSendMsg($Tab1, $TCM_SETITEMSIZE, 0, Int($aRet[2] / 2) - 1) ; size tabs - need to deduct 1-2px, else sometimes the previous/next tab control will show EndFunc Func _WINMSG($hWnd, $MsgID, $wParam, $lParam) If Not IsHWnd($hWnd) Then Return $GUI_RUNDEFMSG Local $minmaxinfo = DllStructCreate("int;int;int;int;int;int;int;int;int;int", $lParam) DllStructSetData($minmaxinfo, 7, $aWinPos[2]) ; min width DllStructSetData($minmaxinfo, 8, $aWinPos[3]) ; min height $aCtrlPosTab = ControlGetPos($Form1, "", $Tab1) ; we need the tab control width to set the tab size If Not @error Then GUICtrlSendMsg($Tab1, $TCM_SETITEMSIZE, 0, Int($aCtrlPosTab[2] / 2) - 2) ; size tabs - need to deduct 1-2px, else sometimes the previous/next tab control will show Return $GUI_RUNDEFMSG EndFunc
  19. Never tested that Looks like i might need some help; WM_SIZE should work, but this is not working for me... #include <GUIConstantsEx.au3> #include <TabConstants.au3> #include <WindowsConstants.au3> Global $Form1 = GUICreate("Form1", 214, 121, 645, 124, BitOR($GUI_SS_DEFAULT_GUI, $WS_MAXIMIZEBOX, $WS_SIZEBOX, $WS_THICKFRAME, $WS_TABSTOP)) Global $Tab1 = GUICtrlCreateTab(0, 0, 213, 120, $TCS_FIXEDWIDTH) ; $TCS_FIXEDWIDTH required! GUICtrlSetResizing(-1, $GUI_DOCKLEFT+$GUI_DOCKRIGHT+$GUI_DOCKTOP+$GUI_DOCKBOTTOM) GUICtrlCreateTabItem("TabSheet1") GUICtrlCreateTabItem("TabSheet2") GUICtrlCreateTabItem("") Global $aWinPos = WinGetPos($Form1) ; used only to set min/max gui size (optional) _Tab_SetWidth() ; set initial tab width GUISetState(@SW_SHOW) ;GUIRegisterMsg($WM_GETMINMAXINFO, "_WINMSG") ;GUIRegisterMsg($WM_WINDOWPOSCHANGING, "_WINMSG") ;GUIRegisterMsg($WM_SYSCOMMAND, "_WINMSG") GUIRegisterMsg($WM_SIZE, "_WINMSG") While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Func _Tab_SetWidth() ; sets the initial tab width to fit the tab control Local $aRet = ControlGetPos($Form1, "", $Tab1) ; used to set tab width If Not @error Then GUICtrlSendMsg($Tab1, $TCM_SETITEMSIZE, 0, Int($aRet[2] / 2) - 1) ; size tabs - need to deduct 1-2px, else sometimes the previous/next tab control will show EndFunc Func _WINMSG($hWnd, $MsgID, $wParam) If Not IsHWnd($hWnd) Then Return $GUI_RUNDEFMSG ;Switch $wParam ;Case 2 ConsoleWrite("ok" & @LF) Local $aCtrlPosTab = ControlGetPos($Form1, "", $Tab1) ; we need the tab control width to set the tab size If Not @error Then GUICtrlSendMsg($Tab1, $TCM_SETITEMSIZE, 0, Int($aCtrlPosTab[2] / 2) - 2) ; size tabs - need to deduct 1-2px, else sometimes the previous/next tab control will show ;EndSwitch Return $GUI_RUNDEFMSG EndFunc reference: http://msdn.microsoft.com/en-us/library/windows/desktop/ms632646(v=vs.85).aspx
  20. A few quick searched yielded no results, so... This sets the width of the tabs for a tab control according to the gui width. Additionally, it can control min/max gui size. One benefit of this is, if you have a custom background color for your gui, you no longer have to do something 'sneaky' like adding a colored label to cover that unsightly gray area of the tab control. This was updated to address the bug that @funkey found #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_UseUpx=n #AutoIt3Wrapper_UseX64=n #AutoIt3Wrapper_AU3Check_Parameters=-d -w 3 -w 4 -w 5 #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** #include <GUIConstantsEx.au3> #include <TabConstants.au3> #include <WindowsConstants.au3> Global $Form1 = GUICreate("Form1", 214, 121, 645, 124, BitOR($GUI_SS_DEFAULT_GUI, $WS_MAXIMIZEBOX, $WS_SIZEBOX, $WS_THICKFRAME, $WS_TABSTOP)) Global $Tab1 = GUICtrlCreateTab(0, 0, 213, 120, $TCS_FIXEDWIDTH) ; $TCS_FIXEDWIDTH required! GUICtrlSetResizing(-1, $GUI_DOCKLEFT+$GUI_DOCKRIGHT+$GUI_DOCKTOP+$GUI_DOCKBOTTOM) GUICtrlCreateTabItem("TabSheet1") GUICtrlCreateTabItem("TabSheet2") GUICtrlCreateTabItem("") Global $aTabCtrlPos, $aWinPos = WinGetPos($Form1) ; set initial tab width _Tab_SetWidth(1) ; the parameter = the number of additional pixels to subtract from the tab width to avoid having the previous/next tab control show GUISetState(@SW_SHOW) GUIRegisterMsg($WM_GETMINMAXINFO, "WM_GETMINMAXINFO") ;GUIRegisterMsg($WM_SIZE, "WM_SIZE") ; without the minimum gui size constraints (comment out above line) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $GUI_EVENT_MAXIMIZE, $GUI_EVENT_RESTORE _Tab_SetWidth(2) EndSwitch WEnd Func _Tab_SetWidth($i) ; sets the tab width Local $aRet = ControlGetPos($Form1, "", $Tab1) ; used to set tab width ; size tabs - need to subtract a small number of pixels, else sometimes the previous/next tab control will show - the more tabs, the more we need to subtract ; the "2" in "/ 2" = the number of tabs in the tab control If Not @error Then GUICtrlSendMsg($Tab1, $TCM_SETITEMSIZE, 0, Int($aRet[2] / 2) - $i) EndFunc Func WM_GETMINMAXINFO($hWnd, $MsgID, $wParam, $lParam) #forceref $MsgID, $wParam If Not IsHWnd($hWnd) Then Return $GUI_RUNDEFMSG Local $minmaxinfo = DllStructCreate("int;int;int;int;int;int;int;int;int;int", $lParam) DllStructSetData($minmaxinfo, 7, $aWinPos[2]) ; enforce a minimum width for the gui (min width will be the initial width of the gui) DllStructSetData($minmaxinfo, 8, $aWinPos[3]) ; enforce a minimum height for the gui (min height will be the initial height of the gui) _Tab_SetWidth(2) Return $GUI_RUNDEFMSG EndFunc ; without the minimum gui size constraints (comment out WM_GETMINMAXINFO function)... #cs Func WM_SIZE($hWnd, $MsgID, $wParam, $lParam) #forceref $MsgID, $wParam, $lParam If Not IsHWnd($hWnd) Then Return $GUI_RUNDEFMSG _Tab_SetWidth(2) Return $GUI_RUNDEFMSG EndFunc #ce
  21. @BuckMaster - you may want to look for another place to host your files - i am unable to d/l your package at ge.tt - says the album is empty also this site has a very poor reputation and has been used to host allot of malware in the past
  22. thanks LarsJ - works fine!
  23. Anybody else having a problem where this example script fails to exit (and hogs the CPU)? It works fine other than that, but i'm not good at all in troubleshooting dll issues, which i suspect is the cause. Using DllOpen/DllClose and using the handle in the functions doesn't solve the problem, nor does compiling it, and there is no Scite error code on exit when the process is killed.
  24. I just tried it and it makes no difference
  25. I'm getting inconsistent results with InetRead/_INetGetSource and wondering why The problem seems to be specific to certain websites, in this instance rt.com Here's the sample code... #include <Inet.au3> $url = "http://rt.com/news/ukraine-right-sector-militants-210/" $str = InetRead($url, 3) ;$str = _INetGetSource($url, True) ConsoleWrite("@error=" & @error & @LF) ConsoleWrite(BinaryToString($str, 4) & @LF) ;ConsoleWrite($str & @LF) Without changing anything at all, sometimes InetRead() will return a string, and sometimes it doesn't @error is always 0 either way When it doesn't return the expected string, it returns "US?BS", which is actually some sort of encoded character(s) i believe I've tried using BinaryToString() with 1, 2, 3 and 4 and though i've never gotten a string with 2 and 3, i have with 1 and 4, but again, the results are not consistent - sometimes it will return the expected string several times in a row, and then it won't for several times in a row I think it would be better in my case to not depend on IE since i need reliable results, so if anyone has any suggestions for downloading a file via http/https, i'd appreciate it. I am aware of wget for windows, but if there is a self-contained executable without the dependencies, i would prefer that
×
×
  • Create New...