
akshatgupta
Members-
Posts
14 -
Joined
-
Last visited
Everything posted by akshatgupta
-
Issues with Image Search - (Moved)
akshatgupta replied to akshatgupta's topic in AutoIt General Help and Support
i am still learning so i am not working on any app as of now but in future if i need to find an image i will be needing it -
Issues with Image Search - (Moved)
akshatgupta replied to akshatgupta's topic in AutoIt General Help and Support
other than this what will be the suggested image recognition tool to be used -
Hello, I am new to autoit and i was still learning but i am stuck on Image Recognition. i have tried to google and search the forums but no solution (maybe i saw the solution but did not understand). i made a very simple image recognition script that is just checking if image is found or not if yes it just moves the mouse to that location. this is the code: #include <ImageSearch.au3> $x1 = 0 $y1 = 0 $filename = @ScriptDir & '\Capture.PNG' ConsoleWrite(@CRLF & $filename & @CRLF) While 1 Sleep(5000) $result = _ImageSearch('Capture.PNG', 1, $x1, $y1, 0) If $result = 1 Then MouseMove($x1, $y1) EndIf WEnd and this is the console after i try to run the program: >"D:\AutoIt3\SciTE\..\AutoIt3.exe" "D:\AutoIt3\SciTE\AutoIt3Wrapper\AutoIt3Wrapper.au3" /run /prod /ErrorStdOut /in "D:\projects\Autoit\ImageSearch Test\ImgSearch.au3" /UserParams +>15:40:40 Starting AutoIt3Wrapper v.17.224.935.0 SciTE v.3.7.3.0 Keyboard:00004009 OS:WIN_10/ CPU:X64 OS:X64 Environment(Language:0809) CodePage:0 utf8.auto.check:4 +> SciTEDir => D:\AutoIt3\SciTE UserDir => C:\Users\aksha\AppData\Local\AutoIt v3\SciTE\AutoIt3Wrapper SCITE_USERHOME => C:\Users\aksha\AppData\Local\AutoIt v3\SciTE >Running AU3Check (3.3.14.3) from:D:\AutoIt3 input:D:\projects\Autoit\ImageSearch Test\ImgSearch.au3 +>15:40:41 AU3Check ended.rc:0a >Running:(3.3.14.3):D:\AutoIt3\autoit3.exe "D:\projects\Autoit\ImageSearch Test\ImgSearch.au3" --> Press Ctrl+Alt+Break to Restart or Ctrl+Break to Stop D:\projects\Autoit\ImageSearch Test\Capture.PNG "D:\projects\Autoit\ImageSearch Test\ImageSearch.au3" (44) : ==> Subscript used on non-accessible variable.: If $result[0] = "0" Then Return 0 If $result^ ERROR ->15:40:42 AutoIt3.exe ended.rc:1 +>15:40:42 AutoIt3Wrapper Finished. >Exit code: 1 Time: 1.884 I have no idea what is going wrong here please help.
-
issue because of single thread
akshatgupta replied to akshatgupta's topic in AutoIt General Help and Support
yea that might be the issue thanks -
issue because of single thread
akshatgupta replied to akshatgupta's topic in AutoIt General Help and Support
when start is clicked the the start button is disabled so you cant click it anymore though i never tried doing that -
issue because of single thread
akshatgupta replied to akshatgupta's topic in AutoIt General Help and Support
sorry but i am a bit new to autoit and i just saw the help file and not having a clue what could be wrong here is my gui code $Form1 = GUICreate("Form1", 312, 157, 996, 422) $status = GUICtrlCreateLabel("Status: NO ACTIVITY", 0, 136, 307, 17, $SS_CENTER) $start = GUICtrlCreateButton("START", 88, 16, 139, 41) GUICtrlSetFont(-1, 15, 400, 0, "MS Sans Serif") $stop = GUICtrlCreateButton("STOP", 88, 72, 139, 41) GUICtrlSetFont(-1, 15, 400, 0, "MS Sans Serif") GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $start AlignWindow() StartLoop() Case $stop Exit EndSwitch WEnd i used koda for gui creation -
i was working on a small project which uses GUI when i run the program it is supposed to run in an infinite loop but i want it to quit running when i press the stop button but the button does not work because the program is single thread any ideas on what to do?
-
Loops and fileExists issue
akshatgupta replied to akshatgupta's topic in AutoIt General Help and Support
it worked thanks -
I want to save a screenshot of the screen in a particular folder with different names. like img0, img1, img2,... I tried using the while loop first $fileCount = 0 $exists = 1 While $exists = 1 $exists = FileExists(@ScriptDir & "\searches\img" & $fileCount & ".PNG") ConsoleWrite(@ScriptDir & "\searches\img" & $fileCount & ".PNG") $fileCount = $fileCount + 1 Sleep(100) WEnd $fileCount = $fileCount - 1 $screenShot = _ScreenCapture_Capture("") _ScreenCapture_SaveImage(@ScriptDir & "\searches\img" & $fileCount & ".jpg", $screenShot) this function does not search for the next possible file name instead it just overwrites the file with number initialized with $fileCount then I did the same thing using do...Until loop $fileCount = 0 $exists = 1 Do $exists = FileExists(@ScriptDir & "\searches\img" & $fileCount & ".PNG") ConsoleWrite(@ScriptDir & "\searches\img" & $fileCount & ".PNG") $fileCount = $fileCount + 1 Sleep(100) Until $exists = 1 $fileCount = $fileCount - 1 $screenShot = _ScreenCapture_Capture("") _ScreenCapture_SaveImage(@ScriptDir & "\searches\img" & $fileCount & ".jpg", $screenShot) this ends up being an infinite loop I cant see the issue here i am new to autoit
-
unable to open snipping tool using run
akshatgupta replied to akshatgupta's topic in AutoIt General Help and Support
thanks it worked -
unable to open snipping tool using run
akshatgupta posted a topic in AutoIt General Help and Support
i was trying to open the snipping tool on windows 10 using autoit but it does not work. here is the code $sFile = ("C:\WINDOWS\system32\SnippingTool.exe") If FileExists($sFile) Then Run($sFile) Else MsgBox(0,'File Error', "The Windows snipping tool was not found") EndIf and here is the image which shows i have it please tell me what to do -
FileWrite creating issues
akshatgupta replied to akshatgupta's topic in AutoIt General Help and Support
i just attached my file to this so you can see the complete file wtfskins.au3 -
FileWrite creating issues
akshatgupta replied to akshatgupta's topic in AutoIt General Help and Support
sorry but i did not understand as i have closed the file here is the rest of the code(i thought this might not be required) $timeTaken = TimerDiff($starttime)/1000 ;~ MsgBox(0, "time", $timeTaken & " seconds") FileWrite($filewins, "--------" & "time: " & $timeTaken) FileClose($filewins) Func terminate() $stopper = 1 EndFunc -
i tried looking at search and googled it too but nothing helped me so my program is supposed to detect an image on a page and according to the image detected it is suppoed to write something to the file and this is in an infinite loop which is broken when the hotkey is being called the program works perfectly for a while like iwaited for it to write 8-10 times and then i called the hotkey but when i try to leave the program to run for a longer time say like an hour or two the file becomes weird(not the right team to use but hope you get it) my older save to the file is also changed to something like ⁂⁂⁒⁂⁒⁂⁂⁒⁂⁒⁒⁒⁂⁂⁒⁂⁒⁂⁂⁒⁂⁂⁂⁒⁂⁂⁒⁒⁇⁂⁂⁂⁒⁒⁂⁂⁂⁒⁂⁒⁂⁒⁂⁂⁒⁂⁒⁒⁂⁂⁂⁂⁒⁇⁂⁂⁂⁒⁒⁒⁒⁒ while i expect the output to be like R B G B B R R G B B B B R R B (and so on) $filewins = FileOpen($fileloc, $FO_OVERWRITE) Global $stopper = 0 $starttime = TimerInit() while $stopper = 0 $resultroll = _ImageSearch($imgroll, 1, $x1, $y1, 0, 0) If $resultroll = 1 Then While $resultroll = 1 $resultroll = _ImageSearch($imgroll, 1, $x1, $y1, 0, 0) WEnd Sleep(500) $isblack = _ImageSearch($imgblack, 1, $x1, $y1, 0, 0) $isred = _ImageSearch($imgred, 1, $x1, $y1, 0, 0) $isgreen = _ImageSearch($imggreen, 1, $x1, $y1, 0, 0) If $isblack = 1 Then $isblack = 0 FileWrite($filewins, "B ") ConsoleWrite("B " & @LF) ElseIf $isred = 1 Then $isred = 0 FileWrite($filewins, "R ") ConsoleWrite("R " & @LF) ElseIf $isgreen = 1 Then $isgreen = 0 FileWrite($filewins, "G ") ConsoleWrite("G " & @LF) EndIf EndIf WEnd i have no clue how to fix this or what is cauing it