Jump to content

mc83

Members
  • Posts

    14
  • Joined

  • Last visited

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

mc83's Achievements

Seeker

Seeker (1/7)

0

Reputation

  1. sorry, i really can't write if for you i lack the time & motivation to do it ) i can, however, provide you with some more in-depth tips http://img146.imageshack.us/my.php?image=blablakh0.jpg as you can see, i have highlighted an area in the attached image if my logic serves me correct, that image will only look like that when you are not connected in your While loop, prior to calling the StartScript function, add another while statement (i said if-then at first, but i just changed my mind) something line while pixelchecksum(left,top,right,bottom) = "value" mouseclick(left, x, y) ;x,y = the coords of a pixel on the connect button wend this will click the connect button until the checksum of the highlighted area no longer equals "value" go read the manual for pixelchecksum(), figure out how it works and it will all seem so much easier good luck
  2. hi mate just do a pixelchecksum() of the area where the login screen appears before sending the actual clicks. do an if then against the checksum, if it turns out the login screen is there, click the button simple as that
  3. Hi everyone! I find myself in need of monitoring a VSFlexGrid control. I my search "skills" serve me right ), this control has been developed by ComponentOne and these are its properties, events and methods. The question is: is there any way I can access the properties of a custom control, such as the above one? PS: really sorry if it turns out the solution is obvious and I didn't read the AutoIt manual properly... I have spent the past three months trying programatically monitor several applications in a (nasty, to say the least) corporate environment, which brought me to a point where i'm overwhelmed with frustration. Lucky me LOL Thanks in advance! Edit: typo
  4. Hi everyone, When i try to move a Citrix window (an application broadcasted through Citrix, that is; Au3Info reports this to be a "Transparent Windows Client"), WinMove returns 1, but it doesn't really move it. Ideas, anyone? Many thanks!
  5. Hi everyone! I'm trying to use this UDF to retrieve the source code of a page that requires basic http authentication This is the code i use so far: #include <WinINet.au3> $s_UserAgent = "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3" $b_WinINET_Startup = _WinINet_Startup() $h_internet = _WinINet_InternetOpen($s_UserAgent) $h_Connect = _WinINet_InternetConnect($h_internet, $INTERNET_SERVICE_HTTP, "http://networkspy", 80, "", "[b]USERNAME[/b]", "[b]PASSWORD[/b]") $h_OpenURL = _WinINet_InternetOpenUrl($h_internet, "http://networkspy/map.asp?map=UKBranches.wup&MapViewMode=Summary") local $readfile = binary("") do $readfile &= _WinINet_InternetReadFile($h_OpenURL, 5000) until @error Or Not @extended msgbox(0, "Content", binarytostring($readfile)) The page it retrieves, though, is the one that I normally get after 3 failed authentication attempts, so I guess i'm not properly sending the username & password to the server. Can anyone tell me what I'm doing wrong & how to correct it, please? Many thanks! PS: thanks for the UDF, Ultima -it would have taken me ages to read&understand the MSDN wininet documentation
  6. hi well... you can get a list of files in a directory by using _FileListToArray() and then you can go through all of the files and check their size with FileGetSize() hope this helps
  7. afaik, if StringRegExp does not return an array, it means it could not match anything with your pattern i've written a couple of web crawlers in PHP, and i can tell you one thing: never trust "user" input (well, it's a well known fact, actually) maybe, in some cases, there is no _space_ before or after the number, so the pattern can't match. Maybe it would be a good idea to capture anything in between maximum of and shares and then trim the result. you could also fetch a large number of such pages and analyze the text yourself, in order to see whether it really changes every once in a while. anyway, i think you should use regexes on the actual html code... i believe it's easier to extract bits of text by using the tag structure of a html document hope it helps Radu edit: typo
  8. Hi, thanks for your reply. i don't think the ini files are relevant as they only hold a bunch of coordinates & checksums i am going to include them, but you will still be unable to test this because it only works on the applications i'm connecting to through Citrix (OpenUpTime, Lotus Notes & an IE window) anyhow, here they are: Thanks, Radu
  9. hi everyone i wrote a script to click a couple of buttons and do some checking on some applications the "nasty" part is that the apps i need to monitor are broadcasted through Citrix, so all i get is an image -no controls to [click on/read from/write to] long story short, i thought it would be nice if I send the data across the network to my colleagues, so i used alek's TCP UDF along with his server & client example scripts (i'm a script kiddie, i know) the actual issue: if I try to close the program while it is running, the console shows "1-> Connected", which means it somehow called _On_Connect(). Not long after, the console starts showing "Recursion level has bla bla AutoIt will now close blabla.: Sleep(xx)". ======== you will not be able to run this because you won't have the citrix-broadcasted apps that i'm monitoring however, i hope someone will be able to spot the flaw(s) in my code many thanks in advance #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <ButtonConstants.au3> #include <Array.au3> ;~ alek's TCP UDF #include <TCP.au3> ; let's set a couple of options Opt( "MustDeclareVars", 1) ; all variables must be declared before we can use them Opt( "GUIOnEventMode", 1) ; switch to OnEvent mode Opt( "MouseCoordMode", 0) ; mouse coords relative to the active window Opt( "PixelCoordMode", 0) ; pixel coords relative to the active window Opt( "MouseClickDragDelay", 0) ;~ Opt("TrayMenuMode",1) ;~ TrayCreateItem("gigi") Global $working ; the working state Global $tbaWindow = "Train01" ;title of the "To Be Assessed" window Global $tbaPosition ; the position of the "To be Assessed" window Global $tbaScan ;this will hold the overview of "To be Assessed" Global $mTBA, $mNotes, $mNetSpy, $m012 ; used to decide whether or not to check/monitor a particular app Global $mainTimer ; timer to track progress & slow the script down :)) ;~ read the INI values for _numOCR & _getCallRef Global $vHashes = IniReadSection("numDef.ini", "vHashes") Global $hHashes = IniReadSection("numDef.ini", "hHashes") Global $xBIC1 = IniRead("numDef.ini", "xBIC1", "x", 510) Global $xRef = IniReadSection("numDef.ini", "xRef") Global $yRow = IniReadSection("numDef.ini", "yRow") _ArrayDelete($vHashes,0) _ArrayDelete($hHashes,0) _ArrayDelete($xBIC1,0) _ArrayDelete($xRef,0) _ArrayDelete($yRow,0) Global $pColor = "000000" Global $nColor = "FFFFFF" ;~ read the INI values for _getCtrType GLobal $ctrCoords = IniReadSection("Coords.ini", "contractCoords") Global $ctrChecksums = IniReadSection("checksums.ini", "ctrChecksums") For $i=1 To 10 Step +1 Dim $tmp = StringSplit($ctrCoords[$i][1], ",") $ctrCoords[$i][0] = $tmp[1] $ctrCoords[$i][1] = $tmp[2] Next _ArrayDelete($ctrChecksums, 0) ;~ at this point, $ctrCoords[$i][0] = top coord ;~ [1] = bottom coord ;~ and $ctrChecksums[$i][0] = type of line (contract) ;~ [1] = two checksums -> normal + highlighted, separated by a comma Global $checkBIC1s, $checkNotes, $checkNetSpy, $check012, $startPause, $statusLabel ;the GUI controls ;create the GUI GUICreate("clickerV3.b1", 126, 203, 1147, 731, $WS_SYSMENU,$WS_EX_TOPMOST) ;create a group and some checkboxes GUICtrlCreateGroup("Check/monitor", 5, 10, 110, 110) $checkBIC1s = GUICtrlCreateCheckbox("monitor TBA", 15, 30, 90, 20) $checkNotes = GUICtrlCreateCheckbox("refresh Notes", 15, 50, 90, 20) $checkNetSpy = GUICtrlCreateCheckbox("NetworkSpy", 15, 70, 90, 20) $check012 = GUICtrlCreateCheckbox("monitor 012", 15, 90, 90, 20) GUICtrlSetState($checkBIC1s, $GUI_CHECKED) GUICtrlSetState($checkNotes, $GUI_CHECKED) ; we'll disable these two for now... GUICtrlSetState($checkNetSpy, $GUI_DISABLE) GUICtrlSetState($check012, $GUI_DISABLE) $startPause = GUICtrlCreateButton("Start", 5, 130, 60, 40) GUICtrlSetState($startPause, $GUI_FOCUS) $statusLabel = GUICtrlCreateLabel("", 70, 130, 45, 40) GUICtrlSetBkColor($statusLabel, 0xBB0000) ; 0xBB0000 = ~red, 0x008000 = ~green GUISetState() GUISetOnEvent($GUI_EVENT_CLOSE, "_closeClicked") GUICtrlSetOnEvent($startPause, "_toggleWorking") ;~ try to start alek's server If Not _TCP_Server_Start("10.121.1.101", 30213) Then MsgBox(16, "Error!", "Failed to start the server..." & @CRLF & "pls try to re-start the application.") Exit EndIf _TCP_Server_SetOnEvent($Tcp_Server_Event_Open, "_On_Connect") _TCP_Server_SetOnEvent($Tcp_Server_Event_Close, "_On_Close") _TCP_Server_SetOnEvent($Tcp_Server_Event_Recv, "_On_Recv") ;~ on with the main loop While 1 While $working If Not $working Then ExitLoop _testCheckboxes() ; retrieve the state of the checkboxes ; start the main timer $mainTimer = TimerInit() If $mTBA = True Then WinActivate($tbaWindow) ; get rid of "No records found", if present If Hex(PixelGetColor(251, 243),6) = "0000FF" Then Do MouseClick('left', 300, 303, 1, 0) Sleep(50) Until Hex(PixelGetColor(251, 243),6) <> "0000FF" Sleep(100) EndIf ; click "beginScan" until until it really is pressed Do MouseClick("left", 120, 80, 1, 0) Sleep(50) Until PixelChecksum(102,77,171,108) = 1282018304 ; 3548298478 normal ; 1282018304 clicked (scanning) EndIf ; refresh Notes If $mNotes = True Then WinActivate("GlobalAccounts") ;returns 1 if the window is found & activated ; if not found generate some sort of warning, pls! Sleep(100) Send("{F9}") ; sends F9 to Lotus Notes -this refreshes the view EndIf If $mNetSpy = True Then ; check it's source code EndIf Sleep(20000-TimerDiff($mainTimer)) If $mTBA = True Then WinActivate($tbaWindow) If Hex(PixelGetColor(251, 243),6) <> "0000FF" Then $tbaScan = _getOUTdetails() $tbaScan = _parseOUTdetails2String($tbaScan) ConsoleWrite("Sending data... ") _TCP_Server_Send($tbaScan) ConsoleWrite("OK!" & @CRLF) EndIf EndIf Sleep(30000-TimerDiff($mainTimer)) WEnd WEnd ;~ no civillians beyond this point LOL Func _parseOUTdetails2String($raw) ;~ parses the output of _getOUTdetails to into a string that we can send over TCP Local $result = "tbaScan=" For $i = 0 To UBound($raw)-1 $result &= $raw[$i][0] & "&" $result &= $raw[$i][1] & "|" Next $result = StringLeft($result, StringLen($result)-1) Return $result EndFunc Func _getOUTdetails() ;~ the main function that returns an array overview of OUT ;~ elements [$i][0] = call ref and [$i][1] = ctrType Local $overview[10][2] For $i = 0 to 9 Step +1 $overview[$i][1] = _getCtrType($i+1) If ($overview[$i][1] <> "blankROW") Then $overview[$i][0] = _getCallRef($i+1) Next For $i = UBound($overview)-1 To 0 Step -1 If $overview[$i][1] == "blankROW" Or $overview[$i][1] == "False" Then _ArrayDelete($overview, $i) Next Return $overview EndFunc ;~ the _numOCR functions below Func _getCallRef($row) ;~ ===> this function takes $row as an argument -the row to be checked, that is ;~ and it returns the reference number on that row ;~ basically, it runs _numOCR a bunch of times Global $xRef, $yRow, $pColor, $nColor Local $tmp, $result, $mcolor Select Case $row = 1 $mcolor = $nColor Case $row <> 1 $mcolor = $pColor EndSelect For $j = 0 To 6 Step +1 $tmp = _numOCR($xRef[$j][1],$yRow[$row-1][1],$mcolor) ;~ ConsoleWrite("$tmp = _numOCR("&$xRef[$j][1] & ", " & $yRow[$row-1][1] & ", " & $mcolor & ")" & @TAB & @TAB & $tmp & @CRLF) If $tmp == False Then ;do nothing --but if this happens before 6 digits are matched, fuxx it up!!! :D Else $result &= $tmp EndIf Next Return $result EndFunc Func _numOCR($x,$y, $mColor) ;~ ===> numOCR returns the digit matched in the 5x8 px area that "starts" from the $x & $y coordinates ;~ if nothing is matched, it returns False Local $blackPx[5][8] Dim $tmp = 0, $result = False Local $vHash, $hHash ;check to see if colors are in place For $i = 0 To 4 Step +1 For $j = 0 to 7 Step +1 If Hex(PixelGetColor($x+$i, $y+$j), 6) == $mColor Then $blackPx[$i][$j] = 1 Else $blackPx[$i][$j] = 0 EndIf Next Next ;calculate the vertical hash For $i = 0 to 4 Step +1 For $j = 7 to 0 Step -1 $tmp += $blackPx[$i][$j] Next $vHash &= $tmp $tmp = 0 Next ;calculate the horizontal hash For $j = 0 to 7 Step +1 For $i = 4 to 0 Step -1 $tmp += $blackPx[$i][$j] Next $hHash &= $tmp $tmp = 0 Next ;check if we matched any digit For $i=0 To 9 Step +1 If $vHash = $vHashes[$i][1] And $hHash = $hHashes[$i][1] Then $result = $i ExitLoop EndIf Next Return $result EndFunc Func _getCtrType($row) ;~ ===> this function takes $row as an argument -the row to be checked, that is ;~ and it returns either a contract type or "blankROW" (all strings) Local $result = False Local $tmpChecksum = PixelChecksum(481, $ctrCoords[$row][0], 534, $ctrCoords[$row][1]) For $j=0 to UBound($ctrChecksums)-1 Step +1 If(StringInStr($ctrChecksums[$j][1],$tmpChecksum)) Then $result = $ctrChecksums[$j][0] EndIf Next Return $result EndFunc ;~ this bit below can be used to create new checksums ;~ ;~ WinActivate("Train01") ;~ For $i = 0 to 50 Step +1 ;~ $gigi = PixelChecksum(481, $ctrCoords[1][0], 534, $trCoords[1][1]) ;~ ConsoleWrite($gigi & @CRLF) ;~ Next ;~ WinActivate("E:\AutoIt v3\") ;~ server related functions START Func _On_Close($s_Id) ConsoleWrite($s_Id & '->left' & @CRLF) ;Debug, for fun :P EndFunc Func _On_Connect($s_Id) ConsoleWrite($s_Id & '->Connected' & @CRLF) ;Debug, for fun :P EndFunc Func _On_Recv($s_Recv, $s_Id) ConsoleWrite($s_Id & '->message-> ' & $s_Recv & @CRLF) ;Debug, for fun :P ;~ _TCP_Server_Send($s_Recv) EndFunc ;~ server related functions END Func _testCheckboxes() ;~ this tests the checkboxes prior to entering the "work loop" ;~ we need to do this when a loop first starts, otherwise the script might fail ;~ while trying to do a check that requires another one to be done before it Global $mTBA, $mNotes, $mNetSpy, $m012 If Bitand(GUICtrlRead($checkBIC1s),$GUI_CHECKED) = $GUI_CHECKED then $mTBA = True Else $mTBA = False EndIf If Bitand(GUICtrlRead($checkNotes),$GUI_CHECKED) = $GUI_CHECKED then $mNotes = True Else $mNotes = False EndIf If Bitand(GUICtrlRead($checkNetSpy),$GUI_CHECKED) = $GUI_CHECKED then $mNetSpy = True Else $mNetSpy = False EndIf If Bitand(GUICtrlRead($check012),$GUI_CHECKED) = $GUI_CHECKED then $m012 = True Else $m012 = False EndIf EndFunc Func _toggleWorking() If Not $working then _positionWindows() GUICtrlSetBkColor($statusLabel, 0x008000) ; = ~green GUICtrlSetData ($startPause, "Pause") EndIf If $working then GUICtrlSetBkColor($statusLabel, 0xBB0000) ; = ~red GUICtrlSetData ($startPause, "Resume") EndIf $working = Not $working EndFunc Func _positionWindows() ;does the positioning of all the windows on the desktop WinMove($tbaWindow, "", 570, 200) ;change to 0,0 when in production $tbaPosition = WinGetPos($tbaWindow,"") WinMove("GlobalAccounts", "", 0, $tbaPosition[3]-130, $tbaPosition[2], @DesktopHeight - $tbaPosition[3]+102) WinActivate("GlobalAccounts") Local $notesSeparator = PixelSearch(45, 76, 640, 77, 0x000000) If @error <> 1 Then MouseClickDrag("left", $notesSeparator[0], $notesSeparator[1], 25, $notesSeparator[1], 0) ;WinMove("WhatsUp Gold", "", $tbaPosition[2], 0, @DesktopWidth-$tbaPosition[2], @DesktopHeight-28) EndFunc Func _closeClicked() _toggleWorking() Sleep(50) _TCP_Server_Stop() Exit EndFunc Cheers!
  10. thank you SmOke_N, that is exactly what i wanted. i'm starting to really like AutoIt
  11. hey guys. I'm trying to write very basic autoclicker, but i'm rather new to AutoIt (just started using it 6 hours ago), so i made a mistake, but I CAN'T figure out what it is. here is the code, and below it a description of what happens #include <GUIConstants.au3> Opt("GUIOnEventMode", 1) ; Change to OnEvent mode $mainwindow = GUICreate("autoclick", 80, 140, 930, 50,-1,$WS_EX_TOPMOST) GUISetOnEvent($GUI_EVENT_CLOSE, "CLOSEClicked") $startbutton = GUICtrlCreateButton("Start", 10, 10, 60) $pausebutton = GUICtrlCreateButton("Pause", 10, 45, 60) $statuslabel = GuiCtrlCreateLabel("NOT STARTED", 10, 80, 60, 30) GUICtrlSetOnEvent($startbutton, "start") GUICtrlSetOnEvent($pausebutton, "pause") GUISetState(@SW_SHOW) $pause = 0 ;clicker running While 1 Sleep(1000) ; Idle around WEnd Func start() GUICtrlSetData ($statuslabel, "CLICKING") While 1 If not $pause = 1 Then Sleep(5000) MouseClick("left") EndIf WEnd EndFunc Func pause() If $pause = 1 Then $pause = 0 GUICtrlSetData ($pausebutton, "Pause") GUICtrlSetData ($statuslabel, "CLICKING") Else $pause = 1 GUICtrlSetData ($pausebutton, "Resume") GUICtrlSetData ($statuslabel, "PAUSED") EndIf EndFunc Func CLOSEClicked() Exit EndFunc ok... the GUI is pretty much self explanatory: the "Start" button should make the program start clicking, the "Pause" button should pause it first time it is clicked, and resume it the next time. the thing is... it doesn't do that. I mean... if i hit the "Pause" button before hitting "Start", it works just fine, no matter how many times i use it (i know that because its caption and the text of the label change the way they are supposed to), but if i hit start first and then try to use "Pause", nothing happens. Can anyone please help? I assume this would not take much time for someone with experience using AutoIt. Thank you
  12. oh... it appears i haven't looked deep enough through the documentation. what i wanted to do can be done with GUICtrlSetData (control ID, data)
  13. hello guys. I'm trying to write a autoclicker, and i want to have a pause/resume button, that would change caption according to the state of the program. What i mean is it should first say "Pause" and when you click it, it should change to "Resume". (and viceversa) is there any way to do that? (i have looked through the documentation & searched the forums, but wasn't able to find anything useful) thank you
×
×
  • Create New...