Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 01/21/2015 in Posts

  1. 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: 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. Version 0.9b now has the new _ClearCookies function which will remove all IE and Flash cookies. 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. 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: http://msdn.microsoft.com/en-us/library/ms775125%28v=vs.85%29.aspx http://msdn.microsoft.com/en-us/library/aa385148%28v=vs.85%29.aspx http://msdn.microsoft.com/en-us/library/aa385328%28v=vs.85%29.aspx http://msdn.microsoft.com/en-us/library/aa383630%28v=vs.85%29.aspx http://support.microsoft.com/kb/226473 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!
    1 point
  2. [ACTIVE] is the window that is active right now. Storing the returned result (which is the handle) in a variable will give you the ability to use WinActivate to re-activate the window that you want. EDIT: see the title special definiton
    1 point
  3. just send alt+tab as pressing alt+tab once takes you to the last active window. But it would take more effort to find your script and run it than it would to just press alt+tab.
    1 point
  4. You would do something like so: Local $myLastWin = WinActive("[ACTIVE]") ; your code goes after Local $winList = WinList() Local $Mywindow1 = "handle for window 1 here", $MyWindow2 = "handle for window 2 here" If WinExists($Mywindow1) And WinExists($Mywindow2) Then ; toggle the windows Else WinActivate($myLastWin) EndIf Does that help?
    1 point
  5. Look at that. Within an hour or two of telling MikahS (a fan of the program) that v1.5 could very well be the last update, unless some issue arises, the following suddenly occurred to me, which I wrote in a PM to MikahS. I then thought I should share those thoughts here.
    1 point
  6. C and C++ were written decades ago, they've learned a lot since then.
    1 point
  7. Of course not. I realise this "rule" can't be followed 100% of the time, but a good 90% of the scripts I write can.
    1 point
  8. Well in C# it's said (in the community) that it's pointless to declare a variable with the default value e.g. object objectVar = null, as you're repeating what the compiler does behind the scenes. I also get it in regards to loops in AutoIt (doesn't apply to Java or C#) where for execution purposes it's best to declare outside a tight loop. Otherwise, I see it as good coding practice to declare and intialise, generally speaking.
    1 point
  9. Thanks! Next time I will check the documentation before I ask any question
    1 point
  10. Just downloaded it. Looks like a much needed tool for me.
    1 point
  11. Another way: StringLower(StringLeft($sString, 1)) & StringTrimLeft($sString, 1) And another: StringRegExpReplace($sString, "(.)(.*?)$", StringLower(StringLeft($sString, 1)) & "$2") And another: StringLower(StringSplit($sString, "", 2)[0]) & StringTrimLeft($sString, 1) I could probably do this all day.
    1 point
  12. Thank you for posting that program, as looking through it there is a couple ideas I can use to make this program a bit more cleaner. I love the idea of putting in code tags for forum posts, as that could help people post easily to forum quickly, then turning around and using the Au3 syntax to then check to see if it looks correct (the ability to compile said script if it is au3 would be pretty cool, which I think I can achieve this using cmd line and Aut2Exe). Thank you for the ideas TheSaint, I greatly appreciate it.
    1 point
  13. Sorry SmOke_N, but I couldn't hold myself to test ^^ #include <IE.au3> #include <Array.au3> #include <Excel.au3> #include <File.au3> #include <Misc.au3> #include <MsgBoxConstants.au3> #include <GuiListBox.au3> #include <String.au3> Local $oIE = _IECreate("https://ematrica.autopalya.hu/") Local $username = _IEGetObjById($oIE, "ctl00_wpm_AdvancedLoginPortlet976985280_ctl00_LoginViewControl_LoginControl_UserName") If @error Then ConsoleWrite("We got a error trying to attach to UserName!" & @LF) Exit EndIf Local $password = _IEGetObjById($oIE, "ctl00_wpm_AdvancedLoginPortlet976985280_ctl00_LoginViewControl_LoginControl_Password") If @error Then ConsoleWrite("We got a error trying to attach to PassWord!" & @LF) Exit EndIf Local $submit = _IEGetObjById($oIE, "ctl00_wpm_AdvancedLoginPortlet976985280_ctl00_LoginViewControl_LoginControl_Login") _IEPropertySet($username, "innertext", "TheUnpatientCricket") _IEPropertySet($password, "innertext", "TheCricket") _IEAction($submit, "click") Yes I know I am including unnecessary items, it's my test bed. This "should" automatically log into the site Not sure if that's off topic because you wanted something else, but I noticed a challenge and took it. Besides, if you are as green as I take it you are, this is a rather neat example of how to Do ask if you have anything unanswered by it. Also, yes, it's console. So I recommend debug this in SciTE or replace consoles with message boxes ^^
    1 point
×
×
  • Create New...