-
Posts
1,005 -
Joined
-
Last visited
Reputation Activity
-
computergroove got a reaction from VINAYAK_R_KADAM in GUI Always on top question
For future reference
$Form1 = GUICreate("Form 1", 377, 280, 192, 114) WinSetOnTop($Form1,"",1) Worked
and
$Form1 = GUICreate("Form 1", 377, 280, 192, 114,0,$WS_EX_TOPMOST) also worked
-
computergroove got a reaction from BlackLumiere in ImageSearch is giving me an error message when I try to compile
That worked. Here it is the imagesearch.au3 modified code that worked.
#include-once ; ------------------------------------------------------------------------------ ; ; AutoIt Version: 3.0 ; Language: English ; Description: Functions that assist with Image Search ; Require that the ImageSearchDLL.dll be loadable ; ; ------------------------------------------------------------------------------ ;=============================================================================== ; ; Description: Find the position of an image on the desktop ; Syntax: _ImageSearchArea, _ImageSearch ; Parameter(s): ; $findImage - the image to locate on the desktop ; $tolerance - 0 for no tolerance (0-255). Needed when colors of ; image differ from desktop. e.g GIF ; $resultPosition - Set where the returned x,y location of the image is. ; 1 for centre of image, 0 for top left of image ; $x $y - Return the x and y location of the image ; ; Return Value(s): On Success - Returns 1 ; On Failure - Returns 0 ; ; Note: Use _ImageSearch to search the entire desktop, _ImageSearchArea to specify ; a desktop region to search ; ;=============================================================================== Func _ImageSearch($findImage, $resultPosition, ByRef $x, ByRef $y, $tolerance, $HBMP=0) return _ImageSearchArea($findImage,$resultPosition,0,0,@DesktopWidth,@DesktopHeight,$x,$y,$tolerance,$HBMP) EndFunc Func _ImageSearchArea($findImage, $resultPosition, $x1, $y1, $right, $bottom, ByRef $x, ByRef $y, $tolerance, $HBMP=0) ;MsgBox(0,"asd","" & $x1 & " " & $y1 & " " & $right & " " & $bottom) if $tolerance>0 then $findImage = "*" & $tolerance & " " & $findImage If IsString($findImage) Then $result = DllCall("ImageSearchDLL.dll","str","ImageSearch","int",$x1,"int",$y1,"int",$right,"int",$bottom,"str",$findImage,"ptr",$HBMP) Else $result = DllCall("ImageSearchDLL.dll","str","ImageSearch","int",$x1,"int",$y1,"int",$right,"int",$bottom,"ptr",$findImage,"ptr",$HBMP) EndIf ; If error exit if $result[0]="0" then return 0 ; Otherwise get the x,y location of the match and the size of the image to ; compute the centre of search $array = StringSplit($result[0],"|") $x=Int(Number($array[2])) $y=Int(Number($array[3])) if $resultPosition=1 then $x=$x + Int(Number($array[4])/2) $y=$y + Int(Number($array[5])/2) endif return 1 EndFunc ;=============================================================================== ; ; Description: Wait for a specified number of seconds for an image to appear ; ; Syntax: _WaitForImageSearch, _WaitForImagesSearch ; Parameter(s): ; $waitSecs - seconds to try and find the image ; $findImage - the image to locate on the desktop ; $tolerance - 0 for no tolerance (0-255). Needed when colors of ; image differ from desktop. e.g GIF ; $resultPosition - Set where the returned x,y location of the image is. ; 1 for centre of image, 0 for top left of image ; $x $y - Return the x and y location of the image ; ; Return Value(s): On Success - Returns 1 ; On Failure - Returns 0 ; ; ;=============================================================================== Func _WaitForImageSearch($findImage, $waitSecs, $resultPosition, ByRef $x, ByRef $y, $tolerance, $HBMP=0) $waitSecs = $waitSecs * 1000 $startTime=TimerInit() While TimerDiff($startTime) < $waitSecs sleep(100) $result=_ImageSearch($findImage,$resultPosition,$x, $y,$tolerance,$HBMP) if $result > 0 Then return 1 EndIf WEnd return 0 EndFunc ;=============================================================================== ; ; Description: Wait for a specified number of seconds for any of a set of ; images to appear ; ; Syntax: _WaitForImagesSearch ; Parameter(s): ; $waitSecs - seconds to try and find the image ; $findImage - the ARRAY of images to locate on the desktop ; - ARRAY[0] is set to the number of images to loop through ; ARRAY[1] is the first image ; $tolerance - 0 for no tolerance (0-255). Needed when colors of ; image differ from desktop. e.g GIF ; $resultPosition - Set where the returned x,y location of the image is. ; 1 for centre of image, 0 for top left of image ; $x $y - Return the x and y location of the image ; ; Return Value(s): On Success - Returns the index of the successful find ; On Failure - Returns 0 ; ; ;=============================================================================== Func _WaitForImagesSearch($findImage, $waitSecs, $resultPosition, ByRef $x, ByRef $y, $tolerance, $HBMP=0) $waitSecs = $waitSecs * 1000 $startTime=TimerInit() While TimerDiff($startTime) < $waitSecs for $i = 1 to $findImage[0] sleep(100) $result=_ImageSearch($findImage[$i],$resultPosition,$x, $y,$tolerance,$HBMP) if $result > 0 Then return $i EndIf Next WEnd return 0 EndFunc
-
computergroove got a reaction from bbthai77 in ImageSearch doesn't work at all.
Is the picture the same size in its default open size as what is seen on the screen? If you can post the 1.bmp and let me know where it is to be found I will try to fix it.
*Edit - Found where you got your code
In the comments of that video it says: Replace the dll by one compatible with Windows 7 and/or 64 bit operating systems. Reinstall AutoIt for x68 operating system.
I can only test it in Windows 7 x64 and xp x32 on my end.
-
computergroove got a reaction from aa2zz6 in SoftEther VPN Client Script - Question
When you are connected to your vpn your wan ip will show from Korea.
#include <Inet.au3> #include <MsgBoxConstants.au3> Local $oIE = _INetGetSource("http://wanip.info/") Local $CharacterCount = StringInStr($oIE,'.png" alt="');return the number of characters that '.png" alt="' starts at in the html source Local $TrimmedHTML = StringTrimLeft($oIE,$CharacterCount + 10);trim the characters from the left of country Local $sCountry = StringLeft($TrimmedHTML,5);Read the characters from the country alt code in the HTML. Korea has 5 letters MsgBox(0,0,$sCountry)Use this to get your current wan ip detected location and use it to compare to what you want. If it says Korea then sleep 30 minutes. If it doesn't say Korea then reinitialize your vpn. For my the above returns 'us" /' because Im in the us with a us wan ip.
-
computergroove got a reaction from ahmet in Detect Special Mouse Key
Does the special button only send ctrl/alt/shift+ something or do they send different combinations of ctrl/alt/shift like ctrl + alt + something? I would use a hotkeyset if you know the "something" variable for different scenarios. Are you setting the "something" manually or is that an internal thing with the mouse?
-
computergroove got a reaction from Trong in Keep It
Do you have any code? Are you trying to make a teamviewer clone? if you are just trying to send commands or files ou could just use Hamachi but I am having all kinds of stupid connection issues all the time with it.
-
computergroove reacted to mikell in 911 Evaluation Project help request
If I understood correctly you need to store data (about 20 items by call) for 100 calls a day, meaning about 36000 calls a year
For such a storage I strongly suggest a SQLite database which is extremely powerful - no problem with 100 chars items - and fast and allows all kinds of reports
-
computergroove got a reaction from argumentum in Calendar UDF (WIP)
On line 657 in the UDF you need to change to the following in what is now autoit version 3.3.14.2:
$__aCALDAYS[$i][0] = GUICtrlCreateLabel("", $iDayPosX + ($iDayOfWeek = 7 ? 0 : $iGridSize), $iDayPosY + $iGridSize, $iDayWidth - $iGridSize, $iDayHeight - $iGridSize)
-
computergroove got a reaction from Trong in How to determine the PNG image is black or white.
Can you show your code? The pictures above are both black and white. What are you trying to do exactly? PixelSearch will only search the user defined area for 1 pixel being a user defined color. Maybe this will help.
You can use this script to identify the location of the pixel position your mouse is currently on. It has been invaluable to me when using autoit:
#Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Outfile=C:\Users\user\Desktop\PGCAH2.0.Exe #AutoIt3Wrapper_UseX64=n #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** #include <GuiConstants.au3> Opt("GUIOnEventMode", 1) Opt("WinTitleMatchMode", 4) Global $xoffset = 10;X axis distance from mouse pointer to blue label Global $yoffset = 23;Y axis distance from mouse pointer to blue label Global $wposx, $wposy, $dt, $cwin, $xcalcl, $xcalcr, $ycalc, $cpos, $pos, $tpos, $hexv, $pcolor Global $title = "Your Title Here" HotKeySet("{ESC}", "Terminate") $pgui = GUICreate($title, 250, 13, -1, -1, $ws_popup);Rear place holder for back of the blue label box (Title, Length of the blue lable box, Height of the blue label box,,) $startlab = GUICtrlCreateLabel(" X: 0000, Y: 0000", 0, -1080, 250, 13) GUICtrlSetBkColor($startlab, 13434879);blue label box color WinSetOnTop($pgui, "", 1) GUISetState(@SW_SHOW) While 1 _nmgp() WEnd Func _nmgp() Local $_cpos = MouseGetPos();get current position of the mouse on desktop Sleep(10) $pcolor = PixelGetColor($_cpos[0], $_cpos[1]);help $pos = MouseGetPos() GUICtrlSetData($startlab, " X: " & $pos[0] & ", Y: " & $pos[1] & " HEX: " & Hex($pcolor, 6) & " DEC: " & $pcolor) ;************************************ Moves the blue label with the mouse ***************************** If $dt = 1 Then $xcalcr = 0.95 * @DesktopWidth $xcalcl = 0.05 * @DesktopWidth $ycalc = 0.9 * @DesktopHeight If $pos[1] > $ycalc Then $wposy = $pos[1] - $yoffset * 2 Else $wposy = $pos[1] + $yoffset EndIf If $pos[0] > $xcalcr Then $wposx = $pos[0] - $xoffset * 3 ElseIf $pos[0] < $xcalcl Then $wposx = $pos[0] + 10 Else $wposx = $pos[0] - $xoffset EndIf Else _clientmouse() EndIf WinMove($title, "", $wposx, $wposy) ;************************************ End Moves the blue label with the mouse *************************** EndFunc Func _clientmouse() Opt("MouseCoordMode", 1) $tpos = MouseGetPos() $cpos = WinGetPos($cwin) $xcalcr = 0.95 * $cpos[2] $xcalcl = 0.95 * $cpos[2] $ycalc = 5.0 * $cpos[3];Y axis for offsetting the text box when you reach the top of the screen (so you can stil see the coordinates) If $tpos[1] > $ycalc Then $wposy = $tpos[1] - $yoffset * 2; Y Axis to determine the distance from the mouse pointer and the blue text box Else $wposy = $tpos[1] + $yoffset EndIf If $tpos[0] > $xcalcr Then $wposx = $tpos[0] - $xoffset - $xcalcr ; X Axis to determine the distance from the mouse pointer and the blue text box ElseIf $tpos[0] < $xcalcl Then $wposx = $tpos[0] + 10 Else $wposx = $tpos[0] - $xoffset EndIf EndFunc Func terminate() Exit 0 EndFunc Compile the above code and run it. You can hit esc to exit out of it. pixlesearch - https://www.autoitscript.com/autoit3/docs/functions/PixelSearch.htm If you want to look for a black color then I would try something like this:
#include <MsgBoxConstants.au3> $color = PixelSearch(0,0,500,500,0);This checks the upper left corner of your main monitor for the color black (dec code '0') If Not @Error Then MsgBox(0,0,"Black was found!") EndIF
-
computergroove got a reaction from christian11 in mouseclick random on specific coordinates?
I may be reading this incorrectly. You want to click either (592,173) or (309,631)
ClickRandomly();Call the ClickRandomly Function from within another part of the script Func ClickRandomly() Local $RandomNumber = Random(1,2,1);Randomly generate 1 or 2 If $RandomNumber == 1 Then MouseClick("Left",592,173) EndIF If $RandomNumber == 2 Then MouseClick("Left",309,631) EndIF EndFunc
-
computergroove got a reaction from theSkareqro in Pause script momentarily after x no. of presses.
Local $a = 0 While 1 (my command here) $a += 1 If $a==300 Then Sleep(500) $a = 0 EndIf WEnd
-
computergroove got a reaction from mLipok in Need help to download a file whose link is hidden via __doPostBack()
This looks useful - https://www.autoitscript.com/forum/topic/34478-udfs-for-ie-find-x-and-y-of-element/
-
computergroove got a reaction from MyUM in How to control a console application ?
Lookup Koda and this - https://www.autoitscript.com/autoit3/docs/functions/StdoutRead.htm try out some code and post if you get stuck.
-
computergroove got a reaction from WannaBeGut in GUI Create Date, check if the selected Date is the current one!
are you familiar with _nowtime and _nowdate? https://www.autoitscript.com/autoit3/docs/libfunctions/_NowTime.htm https://www.autoitscript.com/autoit3/docs/libfunctions/_NowDate.htm
-
computergroove got a reaction from Estimize in How to use selected text in autoit
Local $Data, $NewData;variable placeholder for selected text While 1; make a loop to keep the script running inefinately WinActive(name of your program);You will probably want to use this to make the screen with the text the active window Send("^c");Send Ctrl + C to copy the copied text sleep(250);I add this to give the computer time to copy the data to the clipboard. It may not be necessary $NewData = ClipGet();This will read the clipboard data in windows and set it to the variable $data for comparisons If $NewData == $Data Then Click_1() $Data = $NewData EndIF IF $NewData == 0.00 Then Click_2() $Data == $NewData EndIF Sleep(1000);pause the program for 1 second so it doesn't overuse your processor. WEnd Func Click1() MouseClick("",x1,y1) EndFunc Func Click_2() MouseClick("",x1,y1) EndFuncHaven't tested this but it is how I would write what you are explaining.
-
-
computergroove got a reaction from kcvinu in Which is the best practice in GUI automation
You need to always know the size of the window and its position and the relative positions of the controls fro the windows position. I just maximize the window to solve this. You'll probably need to check the desktop resolution if its for other computers too. You can imgsearch and pixelgetcolor OCR and pixelchecksums to do most of the rest.
-
computergroove got a reaction from zxtnt09 in [Solved] Use HTML / Online check update
Look at koda for autoit. https://www.google.com/url?sa=t&rct=j&q=&esrc=s&source=web&cd=1&cad=rja&uact=8&sqi=2&ved=0CB4QFjAA&url=https%3A%2F%2Fp.rizon.top%3A443%2Fhttps%2Fwww.autoitscript.com%2Fforum%2Ftopic%2F32299-gui-designer-koda-1730%2F&ei=rDdZVZ3JE4zBtQWq-4G4Bg&usg=AFQjCNHl1W-WbjZprZ2-fU3DrN7qUE5tCw&sig2=Cjl9x1HkHJHAMM1TgxCA1g&bvm=bv.93564037,d.b2w
If you are too new to do this I am for hire.
-
-
computergroove reacted to argumentum in Making a toggle button while searching array is interrupting
so then post your fixed code and mark the topic as answered
-
computergroove reacted to JohnOne in AutoIt problem Line 0 How can i fix this?
Do you even know what a script is?
-
computergroove got a reaction from FeliXXL in First time working with "_WinAPI_GetModuleHandle"
Your video was a good idea to post here. Go to your script window and click f5 (this will run your opened script) and open notepad and don't maximize the window (You want to see the console in Scite). Add a @CR at the end of your text insertion. This works for me more than 10 times on windows 7 x64 (I had to change the F1 to F2 because I have the help menu popping up with F1):
#include <WinAPI.au3> #include <WindowsConstants.au3> Global $g_hHook, $g_hStub_KeyProc = "" Test() Func Test() OnAutoItExitRegister("CleanUp") Local $hMod $g_hStub_KeyProc = DllCallbackRegister("_KeyProc", "Int", "int;wparam;lparam") $hMod = _WinAPI_GetModuleHandle(0) $g_hHook = _WinAPI_SetWindowsHookEx($WH_KEYBOARD_LL, DllCallbackGetPtr($g_hStub_KeyProc), $hMod) While 1 Sleep(100) WEnd EndFunc Func _KeyProc($nCode, $wParam, $lParam) Local $tKEYHOOKS $tKEYHOOKS = DllStructCreate($tagKBDLLHOOKSTRUCT, $lParam) If $wParam = $WM_KEYDOWN Then KeyValue(DllStructGetData($tKEYHOOKS, "vkCode")) EndIf Return _WinAPI_CallNextHookEx($g_hHook, $nCode, $wParam, $lParam) EndFunc Func KeyValue($iKeycode) If ($iKeycode = 113) Then send("This is a really long bit of text I dont want to type manually" & @CR) ElseIf ($iKeycode = 117) Then Exit ;exit if F6 has been pressed EndIf EndFunc Func CleanUp() _WinAPI_UnhookWindowsHookEx($g_hHook) DllCallbackFree($g_hStub_KeyProc) EndFunc Look in the console window below your code in the scite window for an error to occur when your script stops working.
-
computergroove reacted to JLogan3o13 in IE_Create and vista
Oh, the problem is on line 47...
You see, it is a tad difficult to help you if you don't bother posting your code.
-
computergroove got a reaction from Sodori in Trying to route address through web proxy
I know this isn't what you are looking for but I got the second one to work with this:
Func _Method2() Local $oIE = _IECreate("https://hide.me/en/proxy") Local $pURL = _IEGetObjByName($oIE, "u") Local $pButton = _IEGetObjById($oIE, "hide_register_save") _IEPropertySet($pURL, "innertext", "http://whatismyipaddress.com/") Sleep(5000) For $i = 1 TO 19 Send("{TAB}") Sleep(100) Next Send("http://whatismyipaddress.com/{ENTER}") EndFunc Even WinWait doesn't work on that page. The developers must not like automation.
The first one works for me. I get a new proxy for the ie session.
-
computergroove got a reaction from Sodori in Need easy help to retrieve proxies
#include <array.au3> #include <File.au3> #include <String.au3> #include <IE.au3> Local $oIE = _IECreate("http://proxyipchecker.com/") WinWait("Online Proxy Checker - IP Checker - Check Proxy - Internet Explorer") Local $HTML = _IEDocReadHTML($oIE);Gets all HTML Local $LeftCount = StringInStr($HTML,'<ul class="freshproxies">');find the count of characters that come before the first string you want to find Local $temp = StringTrimLeft($HTML,$LeftCount + 25);removes all characters before the first ipaddress Local $RightLocation = StringInStr($temp,"</li></ul>");position of the end of the ip address section in the html Local $RawData = StringMid($temp,1,$RightLocation - 1);unedited datablock of ip address information Local $SplitRaw = StringSplit($RawData,'</li>',1) Local $TempArray[0][3] For $i = 1 To Ubound($SplitRaw) - 1 Local $M = StringReplace($SplitRaw[$i],'<li class="',"");remove leading text Local $N = StringReplace($M,'">',";");remove unwanted characters Local $O = StringReplace($N,":",";") _ArrayAdd($TempArray,$O,0,";") Next _ArrayDisplay($TempArray) This just needs the description removed and it is ready to use.
Edit - For anyone who wants to chime in on this one there is a description that becomes part of the string behind the port number that sometimes does not show up at all (it's optional when entering the data in the website). I cannot figure out how to trim the description from my array.