drego

NetSession UDF ~ Per-Process Embedded Browser Settings (Proxy/Agent/Etc.)

39 posts in this topic

#1 ·  Posted (edited)

NetSession UDF 0.9d

(Set embedded browser Internet options on a per-process basis)

 

Welcome to NetSession UDF! With this UDF we provide you with previously unexposed Internet options for your autoit processes which will apply to embedded browser controls created with _IECreateEmbedded. For instance, you can now set a proxy and user-agent for all for your Autoit application's embedded browsers without using the registry settings. This means that you can now have multiple proxy settings for multiple programs/processses, giving each process it's own proxy/agent/other settings for your embedded browser controls and change them within each application as many times as you like. In other words, dynamic per-program (Not shared) Internet settings for any application containing an embedded browser control. There's also a function to clear all of your browser's cookies as well as all flash cookies.

Versions:

  1. Version 0.9 includes the ability to set an HTTP/SOCKS4/SOCKS5 proxy and browser agent for individual AutoIt processes that can all be running at the same time with different settings. This is easy to use. This UDF started out as code that I worked on years ago and now we're bringing it back to life as a UDF with new features planned.
  2. Version 0.9b now has the new _ClearCookies function which will remove all IE and Flash cookies.
  3. Version 0.9c has added the "#include-once" directive as a UDF should and an optimization to the _ClearCookies function thanks to jdelaney. _ClearCookies has also been changed to return TRUE or FALSE rather than strings, not pause script execution when deleting IE cookies, and the hidden window flag added for Its shell command.
  4. Version 0.9d has the added function _UseTOR. This release comes just minutes after the last release because it slipped my mind that it was on the Planned Features list and is easy to add. This new function simply envokes _SetProxy with the proper parameters for TOR with the option to change the port if your install of TOR isn't using the default port number; otherwise, no parameter is necessary. This will likely be the last release until we have more updates to the DLL/Windows API calls.

 

At the moment this UDF makes use of urlmon.dll to apply settings to your application executables. Our goal is to expose all functionality of this DLL as well as possibly expand into more functionality using other Windows API elements.

Important: If you wish to change the settings of an IE control more than once during the life if your program you might have to refresh the IE control or GUI of your app before applying the next change. This was the case years ago. I'll do some testing on this and publish an update to the UDF or add an example of a refresh to the Example Usage.

Example usage & notes:

#include <NetSession-0.9d.au3>

; Let's include IE.au3 just for this example assuming you're making an embedded browser.
#include <IE.au3>

; In this example you would create your embedded IE object and use as follows.

_SetProxy('108.247.158.12:8080')

; Now your proxy is set. This would be an HTTP proxy. For SOCKS you would use:

_SetProxy('socks=108.247.158.12:1080')

; Or if you have TOR running and would like to use it as your proxy simply use:

_UseTOR()

; But if your TOR isn't running on default port 9150 (Like if you changed it to 9292) you must specify your TOR port:

_UseTOR(9292)

; The following is an example of setting your user agent:

_SetUserAgent('Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.95 Safari/537.36')

; At this point any browsing you perform will use the previously set proxy and user agent. Such as:

_IENavigate($ie,"http://www.ipchicken.com")

; If your proxy or SOCKS requires authentication you would add the proxy auth to the URL like this:

_IENavigate($ie,"http://ProxyUser:ProxyPass@www.ipchicken.com")

; Let's clear all browser & Flash cookies

_ClearCookies()

; Note that you can change these settings as many times as you need to in your application and these
; settings will only be applied to the .exe they were set from. This means you don't have to change
; the system-wide proxy or user-agent settings and can have per-.exe embedded browser settings.

I welcome anyone who wants to contribute. Any suggestions will be much appreciated.

The UDF NetSession-0.9d.au3 is attached to this post. The filename will always reflect the version number and this thread post will be kept up to date. I've chosen 0.9 because at this point we only need to figure out one more thing to consider it a complete 1.0. Version 1.0 will include an advanced authentication mechanism for proxies and socks servers (Better than passing proxy auth via the URL). The reason we want to use the authentication capabilities of the DLL is because when you pass authentication via the URL you can't access HTTPS sites through the proxy (You can if no proxy auth is required).

If you can help make this UDF better by improving authentication as just previously mentioned or add any other functionality PLEASE don't hesitate to reply to this thread with some code. Here are the references to how this UDF came about and where you would look to help improve it:

 

Current Functions:

  • _SetProxy(string $Proxy) - Sets an HTTP or SOCKS server for embedded IE browsers in the current process.
  • _SetUserAgent(string $Agent) - Sets the user/browser agent for embedded IE browsers in the current process.
  • _ClearCookies() - Deletes all IE and system Flash cookies. Returns a Boolean value.
  • _UseTOR(int $TORPort = 9150) - Sets TOR as your proxy. You must have TOR running. $TORPort is only necessary if your TOR isn't using default 9150. TOR can be downloaded here: https://www.torproject.org/download/download-easy.html

Planned Features:

  • Proxy authentication via DLL rather than passing to URL.
  • Function to set HTTP referrer.
  • Support for other (Non-IE) embedded browsers.
  • An ease-of-use function for setting TOR as the proxy server (This can currently be done manually). (Done)

Compatability: All known versions of Windows since 2000/XP (Possibly earlier versions as well). Note: The settings applied by this UDF do not appear to affect functions such as InetGet. For those functions you would want to use HttpSetProxy. This UDF is for browser controls (which HttpSetProxy does not affect). Also, the browser must be embedded into the application as with _IECreateEmbedded. It will not work with a new window created with _IECreate.

System Requirements:

  • The existance of urlmon.dll on the system usually located in WindowsSystem32

Releases:

NetSession-0.9.au3 {OLD}

NetSession-0.9b.au3 {OLD}

NetSession-0.9c.au3 {OLD}

NetSession-0.9d.au3 {Newest}

    The changes in each version are detailed near the top of this post.

!!! WE NEED HELP FOR THE NEXT RELEASE !!!

Here's our current (not working) attempt to use a proxy's username & password without passing it in the URL. Without this capability we can't browse to HTTPS sites if proxy auth is required:

 Please help if you can  :)

Happy coding!

Edited by drego
4 people like this

Share this post


Link to post
Share on other sites



#3 ·  Posted (edited)

Can get user agent working but not proxy.

For example this works...

HttpSetProxy(2, "108.165.33.12:3128") 

But this does not...

_SetProxy("108.165.33.12:3128")

HTTP proxy.

 

Not sure what's going on with your app but I just retested with an HTTP proxy and it worked just fine. First I set the proxy and then navigated to a page using a browser control. I'm not sure about using the other net functions but I assume it would work for them too, though browser controls are my main focus.

Edit: The answer to this is that the UDF only affects embedded browser controls which HttpSetProxy does not.

Edited by drego

Share this post


Link to post
Share on other sites

I just used InetRead, I'll try with a browser control.

Fancy posting your code to save me farting about?

 

The file I'm using it with right now is huge but you've got the usage right. Just call it before navigating.

$ie = _IECreateEmbedded ()
$GUIActiveX = GUICtrlCreateObj($ie, 1, 25, 780, 500)
; set the proxy
_IENavigate($ie,"http:/www.ipchicken.com",1)

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

Please let me know if it doesn't work with the inet functions and only browser instances so I can update the main post. Also, as far as HttpSetProxy goes I don't believe it works with browser controls. I remember that being the original point of coming up with this years ago and this being the only solution for IE controls.

Edited by drego

Share this post


Link to post
Share on other sites

Works fine with browser control.

With InetRead it still does not though.

 

That's fine because with inet you already have a function to set the proxy but not for browser controls. Thanks, I'll update the main post with this info which is that the UDF is geared toward browser objects since there's no other way to accomplish it.

Share this post


Link to post
Share on other sites

Agreed, will this udf evolve to cater for third party (child) Processes, such as IE, FF, GC?

 

I'm not sure if it's even possible to use with _IECreate (I'll test), it might only work for embedded IE controls (_IECreateEmbedded). As for other browsers I would say that if they're embedded then yes I would take a shot at them.

Share this post


Link to post
Share on other sites

#12 ·  Posted (edited)

Thanks. Now if I could just figure out how to authenticate a username & password without doing it in the URL so that accessing HTTPS sites when having to provide proxy authentication isn't a problem.

Edited by drego

Share this post


Link to post
Share on other sites

#14 ·  Posted (edited)

I don't really know what that means, is it for some sort of registered or paid proxy service?

If so do you have any links?

 

It could be any proxy server that requires username/password authentication. There are many paid services and in situations where someone is rotating through a list of proxies it's likely that they're going to be using a paid service that requires authentication. Here is one such service http://www.changemyip.com/ (I don't own it). This isn't going to be an issue for proxies on public proxy lists. I don't use public lists though because the proxies are always dying or are slow.

Maybe I'll setup a proxy for testing auth in this UDF and post it here if I can get some help from you and others figuring out how to do it with the DLL without passing auth in the URLs.

Edited by drego

Share this post


Link to post
Share on other sites

#15 ·  Posted (edited)

I don't have a proxy that needs user/pass.  You might try this and see if it works as you expect.

#include <WinAPI.au3>

Func _proxySet($sUser = "", $sPass = "", $sProxy = "", $sProxyByPass = "")

    Local Static $INTERNET_OPTION_PROXY = 38
    Local Static $INTERNET_OPTION_PROXY_USERNAME = 43
    Local Static $INTERNET_OPTION_PROXY_PASSWORD = 44
    Local Static $INTERNET_OPEN_TYPE_PROXY = 3

    Local Const $tagInternetProxyInfo = _
        "dword dwAccessType;ptr lpszProxy;ptr lpszProxyByPass"

    Local $tUsername, $tPassword, $iEnum, $iErr

    ; set username
    If $sUser <> Default And StringLen($sUser) Then
        $sUser = _WinAPI_WideCharToMultiByte($sUser)
        $tUsername = DllStructCreate("char username[" & StringLen($sUser) + 1 & "]")
        DllStructSetData($tUsername, "username", $sUser)
        $iEnum += _WinAPI_UrlMkSetSessionOption($INTERNET_OPTION_PROXY_USERNAME, $tUsername)
        $iErr = @error
    EndIf

    ; set password
    If $sPass <> Default And StringLen($sPass) Then
        $sPass = _WinAPI_WideCharToMultiByte($sPass)
        $tPassword = DllStructCreate("char password[" & StringLen($sPass) + 1 & "]")
        DllStructSetData($tPassword, "password", $sPass)
        $iEnum += _WinAPI_UrlMkSetSessionOption($INTERNET_OPTION_PROXY_PASSWORD, $tPassword)
        $iErr = @error
    EndIf

    Local $tProxy
    $sProxy = _WinAPI_WideCharToMultiByte($sProxy)
    $tProxy = DllStructCreate("char proxy[" & StringLen($sProxy) + 1 & "]")
    DllStructSetData($tProxy, "proxy", $sProxy)

    Local $tProxyByPass
    $sProxyByPass = _WinAPI_WideCharToMultiByte($sProxyByPass)
    $tProxyByPass = DllStructCreate("char proxybypass[" & StringLen($sProxyByPass) + 1 & "]")
    DllStructSetData($tProxyByPass, "proxybypass", $sProxyByPass)

    Local $tProxyBuffer = DllStructCreate($tagInternetProxyInfo)
    If (($sProxyByPass <> Default) And StringLen($sProxyByPass)) Or _
        (($sProxy <> Default) And StringLen($sProxy)) Then
        DllStructSetData($tProxyBuffer, "dwAccessType", $INTERNET_OPEN_TYPE_PROXY)
        DllStructSetData($tProxyBuffer, "lpszProxy", DllStructGetPtr($tProxy))
        DllStructSetData($tProxyBuffer, "lpszProxyByPass", DllStructGetPtr($tProxyByPass))
        $iEnum += _WinAPI_UrlMkSetSessionOption($INTERNET_OPTION_PROXY, $tProxyBuffer)
        $iErr = @error
    EndIf

    If Not $iEnum Then
        Return SetError($iErr, 0, 0)
    EndIf

    Return $iEnum
EndFunc

Func _WinAPI_UrlMkSetSessionOption($nOption, $tBuffer)

    Local $aRet = DllCall("urlmon.dll", "long", "UrlMkSetSessionOption", _
        "dword", $nOption, "ptr", DllStructGetPtr($tBuffer), _
        "dword", DllStructGetSize($tBuffer), "dword", 0)
    If Not IsArray($aRet) Or $aRet[0] <> 0 Then
        If IsArray($aRet) Then Return SetError($aRet[0], 0, 0)
        Return SetError(1, 0, 0)
    EndIf

    Return 1
EndFunc

Edit:

I'll just add.  I could not get this or the original to work for me with embedded IE or "InternetExplorer.Application" object (_IECreate()).  The embedded may be because I'm forcing my embedded browsers to use IWebBrowser2.  Something I'm not willing to change.

However, anything I used to test that uses the wininet.dll other than IE has produced the results I would have expected (eg. _GetIP()).

Edited by SmOke_N

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Share this post


Link to post
Share on other sites

I don't have a proxy that needs user/pass.  You might try this and see if it works as you expect.

#include <WinAPI.au3>

Func _proxySet($sUser = "", $sPass = "", $sProxy = "", $sProxyByPass = "")

    Local Static $INTERNET_OPTION_PROXY = 38
    Local Static $INTERNET_OPTION_PROXY_USERNAME = 43
    Local Static $INTERNET_OPTION_PROXY_PASSWORD = 44
    Local Static $INTERNET_OPEN_TYPE_PROXY = 3

    Local Const $tagInternetProxyInfo = _
        "dword dwAccessType;ptr lpszProxy;ptr lpszProxyByPass"

    Local $tUsername, $tPassword, $iEnum, $iErr

    ; set username
    If $sUser <> Default And StringLen($sUser) Then
        $sUser = _WinAPI_WideCharToMultiByte($sUser)
        $tUsername = DllStructCreate("char username[" & StringLen($sUser) + 1 & "]")
        DllStructSetData($tUsername, "username", $sUser)
        $iEnum += _WinAPI_UrlMkSetSessionOption($INTERNET_OPTION_PROXY_USERNAME, $tUsername)
        $iErr = @error
    EndIf

    ; set password
    If $sPass <> Default And StringLen($sPass) Then
        $sPass = _WinAPI_WideCharToMultiByte($sPass)
        $tPassword = DllStructCreate("char password[" & StringLen($sPass) + 1 & "]")
        DllStructSetData($tPassword, "password", $sPass)
        $iEnum += _WinAPI_UrlMkSetSessionOption($INTERNET_OPTION_PROXY_PASSWORD, $tPassword)
        $iErr = @error
    EndIf

    Local $tProxy
    $sProxy = _WinAPI_WideCharToMultiByte($sProxy)
    $tProxy = DllStructCreate("char proxy[" & StringLen($sProxy) + 1 & "]")
    DllStructSetData($tProxy, "proxy", $sProxy)

    Local $tProxyByPass
    $sProxyByPass = _WinAPI_WideCharToMultiByte($sProxyByPass)
    $tProxyByPass = DllStructCreate("char proxybypass[" & StringLen($sProxyByPass) + 1 & "]")
    DllStructSetData($tProxyByPass, "proxybypass", $sProxyByPass)

    Local $tProxyBuffer = DllStructCreate($tagInternetProxyInfo)
    If (($sProxyByPass <> Default) And StringLen($sProxyByPass)) Or _
        (($sProxy <> Default) And StringLen($sProxy)) Then
        DllStructSetData($tProxyBuffer, "dwAccessType", $INTERNET_OPEN_TYPE_PROXY)
        DllStructSetData($tProxyBuffer, "lpszProxy", DllStructGetPtr($tProxy))
        DllStructSetData($tProxyBuffer, "lpszProxyByPass", DllStructGetPtr($tProxyByPass))
        $iEnum += _WinAPI_UrlMkSetSessionOption($INTERNET_OPTION_PROXY, $tProxyBuffer)
        $iErr = @error
    EndIf

    If Not $iEnum Then
        Return SetError($iErr, 0, 0)
    EndIf

    Return $iEnum
EndFunc

Func _WinAPI_UrlMkSetSessionOption($nOption, $tBuffer)

    Local $aRet = DllCall("urlmon.dll", "long", "UrlMkSetSessionOption", _
        "dword", $nOption, "ptr", DllStructGetPtr($tBuffer), _
        "dword", DllStructGetSize($tBuffer), "dword", 0)
    If Not IsArray($aRet) Or $aRet[0] <> 0 Then
        If IsArray($aRet) Then Return SetError($aRet[0], 0, 0)
        Return SetError(1, 0, 0)
    EndIf

    Return 1
EndFunc

Edit:

I'll just add.  I could not get this or the original to work for me with embedded IE or "InternetExplorer.Application" object (_IECreate()).  The embedded may be because I'm forcing my embedded browsers to use IWebBrowser2.  Something I'm not willing to change.

However, anything I used to test that uses the wininet.dll other than IE has produced the results I would have expected (eg. _GetIP()).

 

It only affects embedded IE. I've never forced IWebBrowser2 before; however, if you test the original UDF with the default AutoIt  _IECreateEmbedded browser it will work. It won't have any affect on any other net functions that I'm aware of (Though it could be possible). Have you tested the code you posted with a default embed? That would be the best starting point for testing any additions/modifications. Then we can worry about IWebBrowser2 (Which I never knew about until now).

Share this post


Link to post
Share on other sites

#17 ·  Posted (edited)

I was pretty clear on what I tested.

1.  It works.  But works with anything that uses the wininet.dll except IE

2.  It does not work for me with embedded IE (the original didn't either)

3.  It does not work with me with standard IE

I merely put the username/password for solution for you to test, as I stated, I do not have a proxy that requires username/password.

Edit:

I take that back, I now have (non-user/pass) working with the version I posted and embedded IE9 version.

Edited by SmOke_N

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Share this post


Link to post
Share on other sites

#18 ·  Posted (edited)

I was pretty clear on what I tested.

1.  It works.  But works with anything that uses the wininet.dll except IE

2.  It does not work for me with embedded IE (the original didn't either)

3.  It does not work with me with standard IE

I merely put the username/password for solution for you to test, as I stated, I do not have a proxy that requires username/password.

Edit:

I take that back, I now have (non-user/pass) working with the version I posted and embedded IE9 version.

 

I just tested your code as: _proxySet('user22','pass2','105.190.102.248:64043')

Then tried navigating to a page and was unable to get a connection out. IE threw: Navigation to the webpage was canceled.

Edit: In your 1 2 3 list you were talking about your code I presume? Mine works for embedded IE. There's just that issue of having to pass the login through the URL.

These are great additions though. Like I said I'll see about providing a proper proxy to test auth.

Edited by drego

Share this post


Link to post
Share on other sites

#19 ·  Posted (edited)

I was pretty clear on what I tested.

1.  It works.  But works with anything that uses the wininet.dll except IE

2.  It does not work for me with embedded IE (the original didn't either)

3.  It does not work with me with standard IE

I merely put the username/password for solution for you to test, as I stated, I do not have a proxy that requires username/password.

Edit:

I take that back, I now have (non-user/pass) working with the version I posted and embedded IE9 version.

 

I just tested your code as: _proxySet('user22','pass2','105.190.102.248:64043')

Then tried navigating to a page and was unable to get a connection out. IE threw: Navigation to the webpage was canceled.

Edit: In your 1 2 3 list you were talking about your code I presume? Mine works for embedded IE. There's just that issue of having to pass the login through the URL.

These are great additions though. Like I said I'll see about providing a proper proxy to test auth.

 

I just messaged you a test proxy that takes authentication.

Edit: Looks like sometime tomorrow we could have a new version with better authentication that can manipulate more than just embedded browser objects (Though that isn't nearly as important as better auth). There are also some other features of the Windows API and urlmon.dll that are very interesting that haven't been explored with AutoIt. Good things to come :)

Edited by drego

Share this post


Link to post
Share on other sites

New version 0.9b has just been released. It now includes the _ClearCookies function which clears all of your browser's cookies as well as all Flash cookies.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now

  • Similar Content

    • BlazerV60
      By BlazerV60
      Hello all,
      I've written the code below which launches chrome in incognito mode and then proceeds to go to the autoit website.
      From my understanding, the Run() command is also supposed to output the PID number related to the application that got launched from the Run command.
      However when I run the below lines, it outputs a PID number that is different from the newly launched chrome browser's PID number, does anyone know why and possibly explain how I could retrieve the accurate PID number associated with the newly launched browser?
      Global $iPid = Run(@ComSpec & ' /c start chrome.exe https://www.autoitscript.com/forum/ -incognito' ,"", "") msgbox(0,"",$iPid) Thank you,
      Brian
    • BlazerV60
      By BlazerV60
      Hello all,
      I've been trying to figure out how to launch Google Chrome in the background (hidden) but it doesn't seem possible. I've tried the following methods:
      ShellExecute("C:\Program Files (x86)\Google\Chrome\Application\chrome.exe", "", "", "", @SW_HIDE) Also I've tried:
      ShellExecute(@ComSpec, "/c start chrome.exe","","",@SW_HIDE) Lastly I tried:
      RunWait('"'&@ProgramFilesDir&'\Google\Chrome\Application\chrome.exe" --silent-launch',@ScriptDir)  
      But all of them launch my chrome browser without hiding it. Does anyone know a workaround for this or if AutoIT just can't Chrome? 
      Bonus points if you know how to make it launch chrome hidden and make it go to https://www.autoitscript.com
       
      Thank you,
      Brian
    • BOUNCER
      By BOUNCER
      I'm trying to get the output data from https://www.guilded.gg but it uses a web app that generates that output on the fly and this doesn't show up in the page source.
      Only in web inspector of each browser does this data show up. How do I read this data in autoit (equivalent to the web inspector)
       
      thank you
    • ur
      By ur
      We can select elements in IE using their IDs as below.
      Local $oDiv = _IEGetObjById($oIE, "x-auto-16-input") But to one button in the webpage, there is no ID to it.
      In selenium we have option to select this element using the CssSelector and clicked the button using below code in c# selenium.
      driver.FindElement(By.CssSelector("button.x-btn-text")).Click(); What is the alternative for this in AUtoIT?
    • FrancescoDiMuro
      By FrancescoDiMuro
      Good morning everyone
      I'm working on a little project, and, I encountered a little strange error when I try to add some data to an array...
      The code I wrote is this:
      Func _WMI_Get_Win32_TemperatureProbe($blnCanUseWMI, $blnCustomArrayDisplay = False, $blnReturnEU = False) If $blnCanUseWMI Then Local $objWMI_QueryResult = $objWMI.ExecQuery("SELECT * FROM Win32_TemperatureProbe", "WQL", 32) If @error Then __ConsoleWrite("Error executing the query on Win32_TemperatureProbe class.", @error, 9999) Else Local $arrWin32_TemperatureProbe[1][3] _ArrayDelete($arrWin32_TemperatureProbe, 0) If @error Then __ConsoleWrite("Error deleting the 0st element $arrWin32_TemperatureProbe array.", @error, 9999) Else Local $objWMI_Variable = Null, $strWMI_QueryResult = "", $i = 0 For $objWMI_Variable In $objWMI_QueryResult $strWMI_QueryResult &= "QUERY RESULT" & "|# " & $i & "|/" & @CRLF & _ "Accuracy" & "|" & $objWMI_Variable.Accuracy & "|" & "[sint32]" & @CRLF & _ "Availability" & "|" & $objWMI_Variable.Availability & "|" & "[uint16]" & @CRLF & _ "Caption" & "|" & $objWMI_Variable.Caption & "|" & "[string]" & @CRLF & _ "ConfigManagerErrorCode" & "|" & $objWMI_Variable.ConfigManagerErrorCode & "|" & "[uint32]" & @CRLF & _ "ConfigManagerUserConfig" & "|" & $objWMI_Variable.ConfigManagerUserConfig & "|" & "[boolean]" & @CRLF & _ "CreationClassName" & "|" & $objWMI_Variable.CreationClassName & "|" & "[string]" & @CRLF & _ "CurrentReading" & "|" & $objWMI_Variable.CurrentReading & "|" & "[sint32]" & @CRLF & _ "Description" & "|" & $objWMI_Variable.Description & "|" & "[string]" & @CRLF & _ "DeviceID" & "|" & $objWMI_Variable.DeviceID & "|" & "[string]" & @CRLF & _ "ErrorCleared" & "|" & $objWMI_Variable.ErrorCleared & "|" & "[boolean]" & @CRLF & _ "ErrorDescription" & "|" & $objWMI_Variable.ErrorDescription & "|" & "[string]" & @CRLF & _ "InstallDate" & "|" & $objWMI_Variable.InstallDate & "|" & "[datetime]" & @CRLF & _ "IsLinear" & "|" & $objWMI_Variable.IsLinear & "|" & "[boolean]" & @CRLF & _ "LastErrorCode" & "|" & $objWMI_Variable.LastErrorCode & "|" & "[uint32]" & @CRLF & _ "LowerThresholdCritical" & "|" & $objWMI_Variable.LowerThresholdCritical & "|" & "[sint32]" & @CRLF & _ "LowerThresholdFatal" & "|" & $objWMI_Variable.LowerThresholdFatal & "|" & "[sint32]" & @CRLF & _ "LowerThresholdNonCritical" & "|" & $objWMI_Variable.LowerThresholdNonCritical & "|" & "[sint32]" & @CRLF & _ "MaxReadable" & "|" & $objWMI_Variable.MaxReadable & "|" & "[sint32]" & @CRLF & _ "MinReadable" & "|" & $objWMI_Variable.MinReadable & "|" & "[sint32]" & @CRLF & _ "Name" & "|" & $objWMI_Variable.Name & "|" & "[string]" & @CRLF & _ "NominalReading" & "|" & $objWMI_Variable.NominalReading & "|" & "[sint32]" & @CRLF & _ "NormalMax" & "|" & $objWMI_Variable.NormalMax & "|" & "[sint32]" & @CRLF & _ "NormalMin" & "|" & $objWMI_Variable.NormalMin & "|" & "[sint32]" & @CRLF & _ "PNPDeviceID" & "|" & $objWMI_Variable.PNPDeviceID & "|" & "[string]" & @CRLF & _ "PowerManagementCapabilities" & "|" & $objWMI_Variable.PowerManagementCapabilities & "|" & "[uint16]" & @CRLF & _ "PowerManagementSupported" & "|" & $objWMI_Variable.PowerManagementSupported & "|" & "[boolean]" & @CRLF & _ "Resolution" & "|" & $objWMI_Variable.Resolution & "|" & "[uint32]" & @CRLF & _ "Status" & "|" & $objWMI_Variable.Status & "|" & "[string]" & @CRLF & _ "StatusInfo" & "|" & $objWMI_Variable.StatusInfo & "|" & "[uint16]" & @CRLF & _ "SystemCreationClassName" & "|" & $objWMI_Variable.SystemCreationClassName & "|" & "[string]" & @CRLF & _ "SystemName" & "|" & $objWMI_Variable.SystemName & "|" & "[string]" & @CRLF & _ "Tolerance" & "|" & $objWMI_Variable.Tolerance & "|" & "[sint32]" & @CRLF & _ "UpperThresholdCritical" & "|" & $objWMI_Variable.UpperThresholdCritical & "|" & "[sint32]" & @CRLF & _ "UpperThresholdFatal" & "|" & $objWMI_Variable.UpperThresholdFatal & "|" & "[sint32]" & @CRLF & _ "UpperThresholdNonCritical" & "|" & $objWMI_Variable.UpperThresholdNonCritical & "|" & "[sint32]" $i+=1 Next ConsoleWrite($strWMI_QueryResult & @CRLF) _ArrayAdd($arrWin32_TemperatureProbe, $strWMI_QueryResult) ; I'll wait for an answer... See you later :) If @error Then __ConsoleWrite("Error inserting item #" & $i & " in the $arrWin32_TemperatureProbe array.", @error, 9999) Else If $blnCustomArrayDisplay Then _ArrayDisplay($arrWin32_TemperatureProbe, "Win32_TemperatureProbe:", "", 64 + 32 + 4, "|", "VARIABLE NAME|ACTUAL VALUE|ENGINEERING UNIT", 350, 0xD3D3D3) If @error Then __ConsoleWrite("Error displaying the $arrWin32_TemperatureProbe array.", @error, 9999) EndIf EndIf If $blnReturnEU = False Then _ArrayColDelete($arrWin32_TemperatureProbe, 2) If @error Then __ConsoleWrite("Error deleting the column #2 of $arrWin32_TemperatureProbe array.") EndIf EndIf If IsArray($arrWin32_TemperatureProbe) Then Return $arrWin32_TemperatureProbe Else Return False EndIf EndIf EndIf EndIf EndIf EndFunc And I get this error ( undocumented in the Help File on _ArrayAdd() function ):
      [15/09/2017 10:24:46] : Error inserting item #4 in the $arrWin32_TemperatureProbe array. > Error: 0 Adding a ConsoleWrite() before the _ArrayAdd() function, I can see the content of $strWMI_QueryResult, and, here it is:
      QUERY RESULT|# 0|/
      Accuracy|32768|[sint32]
      Availability||[uint16]
      Caption|Sensore numerico|[string]
      ConfigManagerErrorCode||[uint32]
      ConfigManagerUserConfig||[boolean]
      CreationClassName|Win32_TemperatureProbe|[string]
      CurrentReading||[sint32]
      Description|CPU Thermal Probe|[string]
      DeviceID|root\cimv2 0|[string]
      ErrorCleared||[boolean]
      ErrorDescription||[string]
      InstallDate||[datetime]
      IsLinear||[boolean]
      LastErrorCode||[uint32]
      LowerThresholdCritical||[sint32]
      LowerThresholdFatal||[sint32]
      LowerThresholdNonCritical||[sint32]
      MaxReadable|1270|[sint32]
      MinReadable|64266|[sint32]
      Name|Sensore numerico|[string]
      NominalReading||[sint32]
      NormalMax||[sint32]
      NormalMin||[sint32]
      PNPDeviceID||[string]
      PowerManagementCapabilities||[uint16]
      PowerManagementSupported||[boolean]
      Resolution|1000|[uint32]
      Status|Unknown|[string]
      StatusInfo||[uint16]
      SystemCreationClassName|Win32_ComputerSystem|[string]
      SystemName|DESKTOP-25LFPVU|[string]
      Tolerance|32768|[sint32]
      UpperThresholdCritical||[sint32]
      UpperThresholdFatal||[sint32]
      UpperThresholdNonCritical||[sint32]QUERY RESULT|# 1|/
      Accuracy|32768|[sint32]
      Availability||[uint16]
      Caption|Sensore numerico|[string]
      ConfigManagerErrorCode||[uint32]
      ConfigManagerUserConfig||[boolean]
      CreationClassName|Win32_TemperatureProbe|[string]
      CurrentReading||[sint32]
      Description|True Ambient Thermal Probe|[string]
      DeviceID|root\cimv2 1|[string]
      ErrorCleared||[boolean]
      ErrorDescription||[string]
      InstallDate||[datetime]
      IsLinear||[boolean]
      LastErrorCode||[uint32]
      LowerThresholdCritical||[sint32]
      LowerThresholdFatal||[sint32]
      LowerThresholdNonCritical||[sint32]
      MaxReadable|1270|[sint32]
      MinReadable|64266|[sint32]
      Name|Sensore numerico|[string]
      NominalReading||[sint32]
      NormalMax||[sint32]
      NormalMin||[sint32]
      PNPDeviceID||[string]
      PowerManagementCapabilities||[uint16]
      PowerManagementSupported||[boolean]
      Resolution|1000|[uint32]
      Status|Unknown|[string]
      StatusInfo||[uint16]
      SystemCreationClassName|Win32_ComputerSystem|[string]
      SystemName|DESKTOP-25LFPVU|[string]
      Tolerance|32768|[sint32]
      UpperThresholdCritical||[sint32]
      UpperThresholdFatal||[sint32]
      UpperThresholdNonCritical||[sint32]QUERY RESULT|# 2|/
      Accuracy|32768|[sint32]
      Availability||[uint16]
      Caption|Sensore numerico|[string]
      ConfigManagerErrorCode||[uint32]
      ConfigManagerUserConfig||[boolean]
      CreationClassName|Win32_TemperatureProbe|[string]
      CurrentReading||[sint32]
      Description|Memory Module Thermal Probe|[string]
      DeviceID|root\cimv2 2|[string]
      ErrorCleared||[boolean]
      ErrorDescription||[string]
      InstallDate||[datetime]
      IsLinear||[boolean]
      LastErrorCode||[uint32]
      LowerThresholdCritical||[sint32]
      LowerThresholdFatal||[sint32]
      LowerThresholdNonCritical||[sint32]
      MaxReadable|1270|[sint32]
      MinReadable|64266|[sint32]
      Name|Sensore numerico|[string]
      NominalReading||[sint32]
      NormalMax||[sint32]
      NormalMin||[sint32]
      PNPDeviceID||[string]
      PowerManagementCapabilities||[uint16]
      PowerManagementSupported||[boolean]
      Resolution|1000|[uint32]
      Status|Unknown|[string]
      StatusInfo||[uint16]
      SystemCreationClassName|Win32_ComputerSystem|[string]
      SystemName|DESKTOP-25LFPVU|[string]
      Tolerance|32768|[sint32]
      UpperThresholdCritical||[sint32]
      UpperThresholdFatal||[sint32]
      UpperThresholdNonCritical||[sint32]QUERY RESULT|# 3|/
      Accuracy|32768|[sint32]
      Availability||[uint16]
      Caption|Sensore numerico|[string]
      ConfigManagerErrorCode||[uint32]
      ConfigManagerUserConfig||[boolean]
      CreationClassName|Win32_TemperatureProbe|[string]
      CurrentReading||[sint32]
      Description|Video Card Thermal Probe|[string]
      DeviceID|root\cimv2 3|[string]
      ErrorCleared||[boolean]
      ErrorDescription||[string]
      InstallDate||[datetime]
      IsLinear||[boolean]
      LastErrorCode||[uint32]
      LowerThresholdCritical||[sint32]
      LowerThresholdFatal||[sint32]
      LowerThresholdNonCritical||[sint32]
      MaxReadable|1270|[sint32]
      MinReadable|64266|[sint32]
      Name|Sensore numerico|[string]
      NominalReading||[sint32]
      NormalMax||[sint32]
      NormalMin||[sint32]
      PNPDeviceID||[string]
      PowerManagementCapabilities||[uint16]
      PowerManagementSupported||[boolean]
      Resolution|1000|[uint32]
      Status|Unknown|[string]
      StatusInfo||[uint16]
      SystemCreationClassName|Win32_ComputerSystem|[string]
      SystemName|DESKTOP-25LFPVU|[string]
      Tolerance|32768|[sint32]
      UpperThresholdCritical||[sint32]
      UpperThresholdFatal||[sint32]
      UpperThresholdNonCritical||[sint32]
       
      Could please anyone help me out? 
      Thanks in advance
      Francesco