Jump to content

StudentJack

Members
  • Posts

    7
  • Joined

  • Last visited

Recent Profile Visitors

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

StudentJack's Achievements

Seeker

Seeker (1/7)

1

Reputation

  1. That works indeed. Thanks! ❤️ Also, I have around 60 inputs in my script, maybe is there faster way to do it? @ I have checked, and it works with case of 1 input, but with several inputs it doesn't.
  2. Hello! I am having a little problem with GUI's and its data. I want to keep data inside the input even when the data form is closed. Is it possible to do it? #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 613, 431, 192, 132) $MenuItem1 = GUICtrlCreateMenu("File") $MenuItem4 = GUICtrlCreateMenuItem("Load File", $MenuItem1) $MenuItem5 = GUICtrlCreateMenuItem("Save File", $MenuItem1) $MenuItem6 = GUICtrlCreateMenuItem("Exit", $MenuItem1) $MenuItem2 = GUICtrlCreateMenu("Program") $MenuItem7 = GUICtrlCreateMenuItem("Connector IP", $MenuItem2) $MenuItem3 = GUICtrlCreateMenu("Help") $MenuItem8 = GUICtrlCreateMenuItem("About", $MenuItem3) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $MenuItem7 Connector() EndSwitch WEnd Func Connector() #Region ### START Koda GUI section ### Form= $Connector = GUICreate("Connector IP", 614, 129, 192, 132) $Label1 = GUICtrlCreateLabel("Insert IP", 24, 24, 51, 20) $Input1 = GUICtrlCreateInput("", 80, 24, 121, 24) $Button1 = GUICtrlCreateButton("Connect", 48, 88, 75, 25) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE GUIDelete($Connector) ExitLoop EndSwitch WEnd EndFunc I have prepared a sample. What can you see is Func Conncetor() which has a couple of information. I am interested in $Input1, where I'd like to store data.When I insert the data into it, and close $Connector's GUI, all the data is no longer available in program. If I'd like to click to "Save File" it'd show that there is no data to save. Is there any option to close that window without erasing data, and saving it ?
  3. Hello, Here's code that I used and there is result. Thanks to @careca. #include<Misc.au3> WinActivate("[CLASS:MSPaintApp]") Global $WPos = [5,143,823,630] Global $dot = 0, $h = $WPos[1] While 1 If _IsPressed('1B') Then Exit EndIf For $i = 1 To 2 If $i = 1 Then For $w = $WPos[0] + 15 To $WPos[2] Step 10 $dot = PixelSearch($w, $h, $w+10, $WPos[3], 0x000000, 0, 2) If Not @error Then MouseMove($dot[0], $dot[1], 5) EndIf Next Else For $w = $WPos[2] To $WPos[0] + 15 Step -10 $dot = PixelSearch($w, $h, $w-10, $WPos[3], 0x000000, 0, 2) If Not @error Then MouseMove($dot[0], $dot[1], 5) EndIf Next EndIf Next WEnd I've got another task and need a little more help ^^ . I do not want to start new thread so I will ask question here. I have to measure the distance from one dot to another and write the result. But it couldn't be so easy, so here is a catch! If the distance from mouse cord is less than 1, do not click this dot. Look for another that is further. I have an idea, that I will show to you guys. To calculate the distance we can use this: Func Pixel_Distance($x1, $y1, $x2, $y2) ;Pythagoras theorem for 2D Local $a, $b, $c If $x2 = $x1 And $y2 = $y1 Then Return 0 Else $a = $y2 - $y1 $b = $x2 - $x1 $c = Sqrt($a * $a + $b * $B) Return $c EndIf EndFunc ;==>Pixel_Distance The credits goes to @UEZ. I did not write it. To get the mouse cords, I can use: MouseGetPos Now I don't know exacly how to glue it into one. Script looks for dots and it's great. I definitly use it for finding dots, but now I have to calculate distance betwen this dots. @Edit Please look at this pseudocode, is my way of thinking right? $BlackDotCord $RedDotCord $OrangeDotCord ;First calculate distance black to orange. So xy,x1y1 should be $x = $BlackDotCord[0] $y = $BlackDotCord[1] $x1 = $OrangeDotCord[0] $y1 = $OrangeDotCord[1] $dist = Pixel_Distance($x,$y,$x1,$y1) If $dist < 1 Then MouseMove(~~? I have to store every distance in table?
  4. Thank you @careca, @JoHanatCent, @junkew for help! You guys awesome!
  5. Okey. That's nice, thanks @JoHanatCent. So if I'd like to make it search from left to right and when there is no more black dots, start searching from right to left I need to change this: (?) Global $Paused HotKeySet('{Insert}', 'TogglePause') WinActivate("dots - Paint") $dot = 1 $count = 1 ; =>change here to 1187 While $count < 1187 ; => and here to 8? ; and then $dot would looks like this: ; $dot = PixelSearch(0 + $count, 613, 0 + $count, 146, 0x00000) $dot = PixelSearch(8 + $count, 146, 8 + $count, 613, 0x000000) If Not @error Then MouseMove($dot[0], $dot[1], 50) MouseClick("Left", $dot[0], $dot[1], 1, 10) EndIf $count = $count + 4 WEnd I understand the point?
  6. I tried to figure it out, so I wrote this code and found out something weird. PixelSearch - searches the nearest point to x1 and x2 (PixelSearch(x1,x2)). My code: Global $Paused HotKeySet('{Insert}','TogglePause') WinActivate("dots - Paint") Func FindDot() $dot = PixelSearch(8,146,1187,613,0x000000) $nextdot = PixelSearch(8,146,1187,613,0x000000,0,10) If @error Then Exit Else MouseMove($nextdot[0],$nextdot[1],10) EndIf EndFunc While 1 FindDot() WEnd Func TogglePause() $Paused = NOT $Paused While $Paused sleep(100) WEnd EndFunc In Java: I'd get mouse cords every time I found the black dot, then add it to the table, stop the loop while it's on first dot and then search for another and again. In autoit I have found something like "Imagesearch" ? Maybe it's better to use than PixelSearch? @mLipok Hello
  7. Hello, At the beggining I have to say "Hello" to everyone. It's my first post here. I am student and I got an exercise from my teacher (He is active member here, so if you reading this, don't lower my grade please ^^ ) I have to write program that click on dots in MSPaint. Here it is visualisation how it should work. (image) Teacher makes dots in random places on screen in MSPaint, and my code has to click each and then click them backward. Okey. That's all about how it should work. Now the part what I did figuret out: local dots[] = [] $dot = PixelSearch(0,90,1365,650,0x000000) If Not @error Then MouseClick("Left",$dot[0],$dot[1],1,10) EndIf I don't know how exacly should I add the position of the each dot ( or I shouldn't ?) . It's strange for me - I mostly code in Java. Is there any library that I can use? Thanks for help. ~StudentJack
×
×
  • Create New...