Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 03/21/2014 in all areas

  1. I've got the following script: #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <Array.au3> $Site = "http://whatismyipaddress.com/" $a = FileRead(@ScriptDir & "\Proxies.txt") $b = StringSplit($a, @CR & @LF & @CRLF) $b = ClearArray($b) Global $oIE[UBound($b)] GUICreate("Test Browser", 1000, 500, 0, 0) GUISetState(@SW_SHOW) $Bound = UBound($b) - 1 For $i = 0 To $Bound If $i > 0 Then GUICtrlDelete($oIE[$i - 1]) HttpSetProxy(2, $b[$i]) $oIE[$i] = ObjCreate("Shell.Explorer.2") GUICtrlCreateObj($oIE[$i], 0, 0, 1000, 500) $oIE[$i].navigate($Site) ToolTip($i & "/" & $Bound & @CRLF & $b[$i], 0, 0) Sleep(5000) Next Func ClearArray($arr) $i = 0 While 1 If $i > UBound($arr) - 1 Then ExitLoop Local $Delete = 0 If $arr[$i] = " " Then $Delete = 1 EndIf If $arr[$i] = "" Then $Delete = 1 EndIf If $arr[$i] = @CR Then $Delete = 1 EndIf If $arr[$i] = @LF Then $Delete = 1 EndIf If $arr[$i] = @CRLF Then $Delete = 1 EndIf If StringLen($arr[$i]) < 9 Then $Delete = 1 EndIf If Not StringInStr($arr[$i], ":") Then $Delete = 1 EndIf If $Delete = 0 Then $arr[$i] = StringReplace($arr[$i], " ", "") $arr[$i] = StringReplace($arr[$i], @TAB, "") EndIf If $Delete = 1 Then _ArrayDelete($arr, $i) $i -= 1 EndIf $i += 1 If $i = UBound($arr) Then ExitLoop WEnd Return $arr EndFuncThe problem is that my IP isn't changing. It should be different every time, but it isn't different... Did I miss something?
    1 point
  2. mylise

    GDI cheat sheet

    Here is a cheat sheet to understand how to used GDI on GDI and WINAPI bitmaps. Examples in help get very confusing at times. I have used "$hGDIbitmap" and "$hAPIbitmap" handle variable names to make sense of it all. Hope this helps some of you.
    1 point
  3. Kevitto, I found regular expressions rather cryptic and this site helped me understand them better than any other: http://regexone.com/ It is interactive, progresses from basic to complicated smoothly, and made all the difference to my understanding.
    1 point
  4. Sir, you are a gentleman and a scholar. I've spent a lot of time trying to understand Regexp properly and it always eludes me. Thank you so much! Marking as Solved.
    1 point
  5. Then define the variable as Static in your function - that is good coding practice for what you need the variable for.
    1 point
  6. JohnOne

    Invert a number

    ConsoleWrite("Result just in: " & Invert(0) & @LF) Func Invert($i) If $i < 0 Then $i = 0 If $i > 1 Then $i = 1 ConsoleWrite("computing ") For $n = 1 To Random(5, 10, 1) ConsoleWrite(". ") Sleep(800) Next ConsoleWrite(@LF) Return Number(Not $i) EndFunc
    1 point
  7. Try this: #include <ButtonConstants.au3> #include <ComboConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <TreeViewConstants.au3> #include <WindowsConstants.au3> #include <GuiTreeView.au3> #NoTrayIcon $Combo1_1 = "" #region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 465, 301, 396, 247) $Input1 = GUICtrlCreateInput("", 28, 8, 121, 21) $Button1 = GUICtrlCreateButton("add name", 34, 30, 75, 25) $Combo1 = GUICtrlCreateCombo("", 24, 130, 137, 25, BitOR($CBS_DROPDOWNLIST, $CBS_AUTOHSCROLL)) $Button2 = GUICtrlCreateButton("add text to name", 33, 64, 107, 25) $Input2 = GUICtrlCreateInput("", 28, 100, 121, 21) $TreeView1 = GUICtrlCreateTreeView(168, 4, 289, 289) GUISetState(@SW_SHOW) #endregion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 $Combo1_1 = $Combo1_1 & GUICtrlRead($Input1) & ";" $Split1 = StringSplit($Combo1_1, ";") If IsArray($Split1) Then For $q = 1 To UBound($Split1) - 2 GUICtrlSetData($Combo1, $Split1[$q], $Split1[$q]) Next $TreeView1_23 = GUICtrlCreateTreeViewItem(GUICtrlRead($Input1), $TreeView1) EndIf Case $Button2 $TreeView1_24 = _GUICtrlTreeView_AddChild( $TreeView1, _GUICtrlTreeView_FindItem($TreeView1, GUICtrlRead($Combo1)), GUICtrlRead($Input2)) EndSwitch WEnd
    1 point
  8. The checkbox isn't contained within the form. Therefore, _IEFormElementCheckBoxSelect won't work. Try this: #include <ie.au3> $oIE = _IECreate ("http://login.microsoftonline.com",0,1,1) $oChk = _IEGetObjByName( $oIE, "persist") _IEAction($oChk, 'click')
    1 point
  9. $text = FileRead("AR123.html") Msgbox(0,"", StringRegExpReplace($text, '(?s).+SR_NUMBER:\s*([^<]+).+', "$1") )
    1 point
  10. This is one way to do it. Certainly others will show you different ways to skin this cat. They all will do pretty much the same thing, just in different ways. It'll be up to you to decide which one fits with your whole script better. #include <String.au3> Local $file = FileOpen("AR123.html", 0), _ $data = FileRead($file), _ $found = _StringBetween($data, 'SR_NUMBER: ', '<br>') MsgBox(0, '', $found[0])
    1 point
  11. This is a down to earth DLL to access webcams in Direct Show. The only hick is it lacks access to webcam's adjustments. You can find more information here: http://sol.gfxile.net/escapi/index.html Here is a simple script showing how to use it. Have fun! ;-------------------------------------------------------------------------- ; ESCAPI is a very simple DLL interface to use video capture devices ; (most commonly webcams, but also video in devices and other similar things) ; Get dll from --> [url="http://sol.gfxile.net/escapi/index.html"]http://sol.gfxile.net/escapi/index.html[/url] ; #include <GDIplus.au3> #Include <GUIConstantsEx.au3> ;-------------------------------------------------------------------------- ; Local variables Local $Width = 640 ;Escapi seems to use 640x480 (or lower) as webcam resolution and will Local $Height = 480 ; adjust the image size to $Width by $Height ;-------------------------------------------------------------------------- ; variables required for dshow escapi Local $tagSimpleCapParams = _ "ptr mTargetBuf;" & _ "int mWidth;" & _ "int mHeight;" Local $tSimpleCapParams = DllStructCreate($tagSimpleCapParams) Local $tTargetBuf = DllStructCreate("BYTE[" & $Width*$Height*4 & "]") Global $pTargetBuf = DllStructGetPtr($tTargetBuf) DllStructSetData($tSimpleCapParams, 1, $pTargetBuf) DllStructSetData($tSimpleCapParams, 2, $Width) DllStructSetData($tSimpleCapParams, 3, $Height) Local $pSimpleCapParams = DllStructGetPtr($tSimpleCapParams) Local $device = 0 ;change this number to select dshow device ;--------------------------------------------------------------------------- ;Escapi init local $_escapi_Dll = DllOpen("escapi.dll") $return = DllCall($_escapi_Dll,"int","initCOM") $return = DllCall($_escapi_Dll,"int:cdecl","initCapture", "int", $device, "ptr", $pSimpleCapParams) ;--------------------------------------------------------------------------- ; GUI and GDI init Global $hwnd = GUICreate("EscApi WebCam", $Width, $Height) GUISetState(@SW_SHOW,$hwnd) _GDIPlus_Startup() Global $hGraphics = _GDIPlus_GraphicsCreateFromHWND($hwnd) ;--------------------------------------------------------------------------- ;Get frame DllCall($_escapi_Dll,"none:cdecl","doCapture", "int", 0) Do $return = DllCall($_escapi_Dll,"int:cdecl","isCaptureDone", "int", 0) sleep(100) Until $return[0] = 1 ;--------------------------------------------------------------------------- ;Display frame $hBMP = _WinAPI_CreateBitmap($Width, $Height , 1 , 32 , $pTargetBuf) Local $hImage = _GDIPlus_BitmapCreateFromHBITMAP($hBMP) _GDIPlus_GraphicsDrawImageRect($hGraphics, $hImage, 0, 0, $Width, $Height) _GDIPlus_BitmapDispose($hImage) _WinAPI_DeleteObject($hBMP) While 1 Local $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then ExitLoop sleep(50) WEnd ;-------------------------------------------------------------------------- ;Clean up _GDIPlus_GraphicsDispose($hGraphics) _GDIPlus_Shutdown() GUIDelete($hwnd)
    1 point
  12. Jon

    Server Outage - 24th-26th Feb

    The dedicated server that runs the autoitscript.com / autoitconsulting.com site had a severe outage for the last couple of days. The main problem was that one of the disk drives failed. The server has two drives in RAID 1 so normally this isn't a problem, in fact there have been two disk outages over the past few years that many people won't have even noticed. Usually the server runs as normal with one drive down and there is only a brief 5 minute outage required when the disk is replaced and the server is rebooted. However in this case the server hard crashed and wouldn't boot into the OS on the remaining disk. I'm guessing that the drive was actually failing...working...failing and causing issues because it wouldn't just die. I logged a support call and asked to get the disk replaced, but some of the communications were lost and it took 12 hours for them to acknowledge that the drive was dead and that they had the authorisation to go ahead and open the box and replace the drive (they only touch the hardware, I'm responsible for all the software/OS config). During this time the server was sitting in a recovery/linux boot disk mode used for troubleshooting. When the disk was finally replaced (8pm UK time 25th of Feb) the the technician only emailed my hostmaster / autoitscript email address to say that it was complete but I didn't receive it because of course that email address is hosted by the server...which is in recovery mode - they forgot to email the temporary gmail address I was using during the outage. So I only found out the work had actually been completed when I chased them up this morning on the phone. I've started the RAID rebuild onto the new drive which will take a few hours to complete so the site may be sluggish until then. I also had to repair a few mysql tables that had crashed - but it didn't look to be a problem.
    1 point
  13. Tried to simplify everything, but the following one isn't working too: $Site = "http://whatismyipaddress.com/" GUICreate("Test Browser", 1000, 500, 0, 0) GUISetState(@SW_SHOW) HttpSetProxy(2, "109.123.115.157:3128") $a = ObjCreate("Shell.Explorer.2") $b = GUICtrlCreateObj($a, 0, 0, 1000, 500) $a.navigate($Site) Sleep(8000)
    1 point
  14. I kinda feel useful, for the first time in... 8 years? hahaha.
    1 point
  15. I normally just lurk for long periods of time, but I saw this topic, and decided to post here. I looked into what it would take to properly implement SSL/TLS in Autoit. You have working sockets that would do for the connecting, the hard part comes in with the encryption. SSL and TLS encrypt all communication, so you'll need to implement or use someone's encryption algorithms right before sending/after receiving anything over the sockets. Having translated some different encryption algorithms myself, I can tell you it's not that easy. Another thing you'll have to fight with is compression, which is ZLib if I recall correctly, the deflate algorithm specifically. I keep trying to talk myself into converting it into pure AutoIt code, but I always decide I have better uses of my time. Best solution you might find is DLL's with some of these needed functions already implemented in them, so you get their raw speed. You'll still have to handle managing keys, sessions, and all that, but it's the only solution currently available. If you really want to try to tackle doing all this, here's the route I took to see what all it would take. SSL and TLS are usually used with the OpenSSL project, and is a very nice project to browse through the source of it. Of course, not everyone reads C code that well, and even less so translates it into a scripting language. So, the best thing to do is find another scripted solution, and see if that could be used. In my searches, the only one that didn't just call the OpenSSL installed on most systems were some Javascript implementations of SSL/TLS. Googling for "Javascript SSL" is the fastest way to find several of the attempts at doing this, and they give information on how they did it, as well as share more source to browse and build an AutoIt clone from as well. They do use a lot of libraries from others, some of which there are no AutoIt counterparts, which means you'd need to either build those libraries as well, or at least enough of them for your purposes. As for the helpfulness of this forum, as I started off with, I lurk far more than I post, and search even more than that. I've been around for a number of years, and haven't found many situations where the code I'm writing is complex enough where no one has ever asked, even in part, about what I am attempting to do. I may have had to change my search terms a few times, and look for other things related to what I'm looking for, and I've also had to follow links to external places for other things as well. I will have to say that, if one searches hard enough, you'll likely find at least parts of what you need here on this forum, long before you ever have to ask a question. Very few other places can boast such a thing, so I would say this forum is extremely helpful, even before asking a question. Whether new people provide answers or not shouldn't matter, as the forum shouldn't be just the people who currently happen to be reading the forum at this time. Hopefully this is useful to not only you, but any one else who tries to work out SSL/TLS within AutoIt.
    1 point
  16. Syed23

    XML DOM wrapper (COM)

    Hi eltorro, I am syed and i am new to this Function. Today when i dig in to the forum i got an opportunity come accross the _XMLDomWrapper.au3 and i am strugling my self to understand the functions to use. Do you have any example codes for each function? if so that will help for my tool creation. could you please help me ?
    1 point
×
×
  • Create New...