Sign in to follow this  
Followers 0
Dawid

Code works on one machine - stops responding after few minutes on another

11 posts in this topic

I have quite simple code which does few things. I know it can be made much better but I'm complete newbie, I'm not coding in any language - just used help file and google to find what I was looking for.

 

I'll explain quickly what it does:

- checks IP

- Starts VPN client and connects it to one of 20 locations (pics name randomly)

- checks if IP has changed (when VPN connects IP will change) and when it does

- clicks a button to run scraper

- runs for 80sec

- clicks a button to stop scraper

- disconnects

- kills VPN client

- and starts VPN client again and loops through that.

 

Everything was fine, I've managed to make it to work. Tested - it's running for over 24h on one machine so I was happy to copy the whole thing to other machines. It runs for few minutes (will loop through the whole process few times) and then it stops responding.

 

That is what windows have to say:

The program AutoIt3.exe version 3.3.8.1 stopped interacting with Windows and was closed. To see if more information about the problem is available, check the problem history in the Action Center control panel.

 Process ID: c18

 Start Time: 01ce6e82f8ea0e36

 Termination Time: 15

 Application Path: C:Program Files (x86)AutoIt3AutoIt3.exe

 Report Id: 78fd5993-da77-11e2-aa9b-4c72b921bbb1

And here's the code:

#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Compile_Both=y
#AutoIt3Wrapper_UseX64=y
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#include <array.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Inet.au3>
Global $PublicIP = _GetIP()

Global $WatchTime = 1 * 1000 ;Check every 1 seconds
Global $TimeStamp = TimerInit()
Global $CB_SETCURSEL = 0x14E
Global $start = "dupa"

$hGUI = GUICreate("Test", 300, 300)

$hButton = GUICtrlCreateButton("Read", 10, 10, 80, 30)
$hButton2 = GUICtrlCreateButton("Connect", 10, 50, 80, 30)
$hButton3 = GUICtrlCreateButton("Disconnect", 100, 50, 80, 30)

$hButton4 = GUICtrlCreateButton("Start Hrefer", 10, 100, 80, 30)
$hButton5 = GUICtrlCreateButton("Stop Hrefer", 100, 100, 80, 30)

$hButton6 = GUICtrlCreateButton("Statuscheck", 10, 150, 80, 30)

$label = GUICtrlCreateLabel("Viscosity status: n/a", 100, 10, 200)
$label2 = GUICtrlCreateLabel("Hrefer status: n/a", 100, 25, 200)

$runStatus = "dupa"
GUISetState()
$x = 1
While 1

If TimerDiff($TimeStamp) >= $WatchTime Then

Global $PublicIPcheck = _GetIP()

If $PublicIP <> $PublicIPcheck Then

ControlClick("[CLASS:TFormMain]", "", "TTeButton3")
GUICtrlSetData($label, "Viscosity status: Connected")
GUICtrlSetData($label2, "Hrefer status: Enabled")

If $start == "dupa" Then
$start = TimerInit()
Else
If TimerDiff($start) > 80000 Then
Run("C:\Program Files\Viscosity\Viscosity.exe disconnect " & $x, "", @SW_MAXIMIZE)
ControlClick("[CLASS:TFormMain]", "", "TTeButton2")
Sleep(1000)
ProcessClose("Viscosity.exe")
$start = "dupa"
$runStatus = "dupa"
Sleep(20)
$PublicIPcheck = $PublicIP
_Taskbar_Refresh()
EndIf
EndIf

Else
GUICtrlSetData($label, "Viscosity status: Disconnected")
ControlClick("[CLASS:TFormMain]", "", "TTeButton2")
Sleep(100)
If $runStatus == "dupa" Then
Global $x = Random(1, 20, 1)
Sleep(100)
Run("C:\Program Files\Viscosity\Viscosity.exe connect " & $x, "", @SW_MAXIMIZE)
$runStatus = "cipa"
EndIf
EndIf


HreferStyle()

$TimeStamp = TimerInit()
EndIf

Sleep(20)

Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE
Exit

Case $hButton
$w = ControlCommand("frmStats", "", "comboBox1", "SelectString", '2')
ConsoleWrite($w)

Case $hButton2
Run("C:\Program Files\Viscosity\Viscosity.exe connect 4", "", @SW_MAXIMIZE)

Case $hButton3
Run("C:\Program Files\Viscosity\Viscosity.exe disconnect 4", "", @SW_MAXIMIZE)
Sleep(3000)
ProcessClose("Viscosity.exe")

Case $hButton4
ControlClick("[CLASS:TFormMain]", "", "TTeButton3")

Case $hButton5
ControlClick("[CLASS:TFormMain]", "", "TTeButton2")

Case $hButton6
$iStyle = _GetWindowStyle(ControlGetHandle("[CLASS:TFormMain]", "", "TTeButton2"))
If BitAND($iStyle, $WS_DISABLED) Then
MsgBox(64, "Test Button is...", "Disabled")
Else
MsgBox(64, "Test Button is...", "Enabled")
EndIf
EndSwitch

WEnd



Func _Taskbar_Refresh() ; By rasim >> http://www.autoitscript.com/forum/topic/66629-systemtray-refresh/.
Local $aMouseGetPos, $hHandle, $hParent, $hTaskBar, $tLeft, $tRight, $tTop, $tWinRect

$hTaskBar = _WinAPI_FindWindow("Shell_TrayWnd", "")
$hParent = ControlGetHandle($hTaskBar, "", "TrayNotifyWnd1")
$hHandle = ControlGetHandle($hParent, "", "ToolbarWindow321")
$tWinRect = _WinAPI_GetWindowRect($hHandle)
$aMouseGetPos = MouseGetPos()
$tLeft = DllStructGetData($tWinRect, "Left")
$tRight = DllStructGetData($tWinRect, "Right")
$tTop = DllStructGetData($tWinRect, "Top")
For $A = $tLeft To $tRight
MouseMove($A, $tTop, 0)
Next
MouseMove($aMouseGetPos[0], $aMouseGetPos[1], 0)
EndFunc ;==>_Taskbar_Refresh


Func HreferStyle()
$iStyle = _GetWindowStyle(ControlGetHandle("[CLASS:TFormMain]", "", "TTeButton2"))

If BitAND($iStyle, $WS_DISABLED) Then
GUICtrlSetData($label2, "Hrefer status: Disabled")
Else
GUICtrlSetData($label2, "Hrefer status: Enabled")
EndIf
EndFunc ;==>HreferStyle

Func _GetWindowStyle($hWnd)

Local $a_iCall = DllCall("user32.dll", "int", "GetWindowLong", _
"hwnd", $hWnd, _
"int", -16) ; GWL_STYLE

If @error Or Not $a_iCall[0] Then
Return SetError(1, 0, 0)
EndIf

Return SetError(0, 0, $a_iCall[0])

EndFunc ;==>_GetWindowStyle

Any ideas what could be causing that? All machines run on the same system, have the same stuff installed etc.

Share this post


Link to post
Share on other sites



Have you tried trapping the errors in the script itself, to determine if it is something script-side or machine-side? The example under ObjEvent in the help file shows good way to trap COM errors, which you can write out to the console or (with a little modification) to a log file.


√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites

Dawid,

I see you are using Hrefer. I found this interesting reference:

 

Xrumer is capable of posting to blogs and guestbooks in addition to its main role as an automated forum posting tool. It can also create forum profiles complete with signature in an attempt to avoid alerting forum administrators with any off topic forum posts. The software is also able to gather and decipher artificial intelligence such as security questions (i.e. what is 2+2?) often used by forums upon registration. Since the latest version of XRumer, the software is capable of collecting such security questions from multiple sources and is much more effective in defeating them.

Helper program Hrefer is also included. This software is used to automatically parse results from search engines including Google, Yahoo, Bing and Yandex for forums and blogs that can then be used as a target list for the main XRumer application

This does not sound like something we want to support. Anything you want to say? :huh:

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Have you tried trapping the errors in the script itself, to determine if it is something script-side or machine-side? The example under ObjEvent in the help file shows good way to trap COM errors, which you can write out to the console or (with a little modification) to a log file.

 

I did only some little ConsoleWrite to follow what script does and if all works as it should be. I will have  a look on that. Thanks for the tip.

 

Dawid,

I see you are using Hrefer. I found this interesting reference:

 

Xrumer is capable of posting to blogs and guestbooks in addition to its main role as an automated forum posting tool. It can also create forum profiles complete with signature in an attempt to avoid alerting forum administrators with any off topic forum posts. The software is also able to gather and decipher artificial intelligence such as security questions (i.e. what is 2+2?) often used by forums upon registration. Since the latest version of XRumer, the software is capable of collecting such security questions from multiple sources and is much more effective in defeating them.

Helper program Hrefer is also included. This software is used to automatically parse results from search engines including Google, Yahoo, Bing and Yandex for forums and blogs that can then be used as a target list for the main XRumer application

This does not sound like something we want to support. Anything you want to say? :huh:

M23

 

 

I understand your concern but what I'm doing has nothing to do with spamming blogs or xrumer at all. Hrefer is a little handy tool (yes, it's part of xrumer package) that scrapes search results. It doesn't post anything, it doesn't even visit any of the URLs. It just sarches for given keyword in Google (or any other search engine you like) and drops results to a txt file. Probably there are other tools that can do the same or I could try making my own but outcome is still the same - a large text file with URLs.

Just to make it clear - it's not for xrumer. I'm doing a little research in specific region and trying to find every possible domain with specific TLD. There is no public databases or any places that have full lists like that. If I would want to hide it, it wouldn't be hard to just remove hrefer from the code ;)

Edited by Dawid

Share this post


Link to post
Share on other sites

Dawid,

Thank you for understanding ny concern. Please PM me with some details of this "specific region" which you are researching. :)

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

Hi,

After some discussions with Dawid, I am happy with the thread - so do offer help if you can. :)

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

No one had similar issues? Any ideas?

Share this post


Link to post
Share on other sites

What did you find from the error checking I suggested?


√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites

Sorry but I have no idea how to use it with my little script :/

Share this post


Link to post
Share on other sites

Did you look at the example in the help file? To catch COM errors, put this at the top:

Local $oErrorHandler = ObjEvent("AutoIt.Error", "_ErrFunc")

And add this function at the end

Func _ErrFunc($oError)
    ConsoleWrite("err.number is: " & @TAB & $oError.number & @CRLF & _
            "err.windescription:" & @TAB & $oError.windescription & @CRLF & _
            "err.description is: " & @TAB & $oError.description & @CRLF & _
            "err.source is: " & @TAB & $oError.source & @CRLF & _
            "err.helpfile is: " & @TAB & $oError.helpfile & @CRLF & _
            "err.helpcontext is: " & @TAB & $oError.helpcontext & @CRLF & _
            "err.lastdllerror is: " & @TAB & $oError.lastdllerror & @CRLF & _
            "err.scriptline is: " & @TAB & $oError.scriptline & @CRLF & _
            "err.retcode is: " & @TAB & $oError.retcode & @CRLF & @CRLF)
EndFunc

√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites

yeah, but that is not returning anything. When it stops responding it just freezes. When I kill it it that is all that came up:

!>20:18:59 AutoIt3.exe ended.rc:-805306369
>Exit code: -805306369    Time: 912.192

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
Sign in to follow this  
Followers 0