Brightview Posted November 9, 2011 Share Posted November 9, 2011 Good evening! is there a way to combine these two codes? **************** #include <File.au3> $textToFind = "text" $readLine = FileReadLine($logFile, $i) --- i dont know whats this for. If StringInStr($readLine, $textToFind) Then (I WANT THE CODE TO STOP THE PRESSING OF UP AND DOWN IN THE KEYBOARD) EndIf Next ************** AND ************ (HERES THE CODE TO PUSH KEYS IN KEYBOARD) $y=2 sleep (3000) Do Send("{UP 1}") sleep (0) Send("{DOWN 1}") sleep (0) until $y=3 *************** hmm, so i want to press the keys Up and down until a certain text pops up, if the text appears, then the pressing would stop. Thanks in advance.. please help.. Link to comment Share on other sites More sharing options...
careca Posted November 9, 2011 Share Posted November 9, 2011 (edited) Hi $readLine = FileReadLine($logFile, $i) --- i dont know whats this for. FileReadLine Read in a line of text from a previously opened text file. FileReadLine ( "filehandle/filename" [, line] ) $logFile should point out to some file $i should point out to some line or a number of lines, dont know since you didnt show all the code. Let me see if i understand what you want. 1 - you have a script searching for "text" in a file, and then you want the search to stop when the text is found. 2 - Or can be that you want to keep pressing keys yourself and kinda "lock" the keyboard when the word is found. EDIT: 3 - Or you want to combine them so you dont have to press the keys yourself...and make it stop when the word is found. Is it one of these? Can you explain a bit better? $y=2 sleep (3000) Do Send("{UP 1}") sleep (0) Send("{DOWN 1}") sleep (0) until $y=3 Why do you have a sleep = 0? Why do you have UP 1 and DOWN 1? i thought it defaults to one press, when there are no numbers. Edited November 9, 2011 by careca Spoiler Renamer - Rename files and folders, remove portions of text from the filename etc. GPO Tool - Export/Import Group policy settings. MirrorDir - Synchronize/Backup/Mirror Folders BeatsPlayer - Music player. Params Tool - Right click an exe to see it's parameters or execute them. String Trigger - Triggers pasting text or applications or internet links on specific strings. Inconspicuous - Hide files in plain sight, not fully encrypted. Regedit Control - Registry browsing history, quickly jump into any saved key. Time4Shutdown - Write the time for shutdown in minutes. Power Profiles Tool - Set a profile as active, delete, duplicate, export and import. Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes. NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s. IUIAutomation - Topic with framework and examples Au3Record.exe Link to comment Share on other sites More sharing options...
Brightview Posted November 9, 2011 Author Share Posted November 9, 2011 Uhm, i want the program to run UNDER the mouse, mostlikey google chrome, Hi FileReadLine Read in a line of text from a previously opened text file. FileReadLine ( "filehandle/filename" [, line] ) $logFile should point out to some file $i should point out to some line or a number of lines, dont know since you didnt show all the code. Let me see if i understand what you want. 1 - you have a script searching for "text" in a file, and then you want the search to stop when the text is found. 2 - Or can be that you want to keep pressing keys yourself and kinda "lock" the keyboard when the word is found. EDIT: 3 - Or you want to combine them so you dont have to press the keys yourself...and make it stop when the word is found. Is it one of these? Can you explain a bit better? $y=2 sleep (3000) Do Send("{UP 1}") sleep (0) Send("{DOWN 1}") sleep (0) until $y=3 Why do you have a sleep = 0? Why do you have UP 1 and DOWN 1? i thought it defaults to one press, when there are no numbers. Well, its like that, when you press the keys UP and DOWN on the keyboard, a certain text pops up. So, i would like a program to Loop the keys UP and DOWN until it search for the text i want. And when the program detects the text, the looping of the UP and DOWN keys will stop. sorry for my bad english........ thanks for replying :] Link to comment Share on other sites More sharing options...
careca Posted November 9, 2011 Share Posted November 9, 2011 Yeah, but if you have some code like [font=monospace] $y=2 sleep (3000) Do Send("{UP 1}") sleep (0) Send("{DOWN 1}") sleep (0) until $y=3[/font] All it will do is go up a bit and then down a bit, not till the end of the page and back to top like you want. If it is to search for text on chrome, the first part of the script wont do, because its purpose is to open files and search them, not text in a browser window, i guess. Im not able to help in that matter, from what i gathered, autoit cant search text inside firefox, chrome is probably the same, some expert in the matter come in and help! Spoiler Renamer - Rename files and folders, remove portions of text from the filename etc. GPO Tool - Export/Import Group policy settings. MirrorDir - Synchronize/Backup/Mirror Folders BeatsPlayer - Music player. Params Tool - Right click an exe to see it's parameters or execute them. String Trigger - Triggers pasting text or applications or internet links on specific strings. Inconspicuous - Hide files in plain sight, not fully encrypted. Regedit Control - Registry browsing history, quickly jump into any saved key. Time4Shutdown - Write the time for shutdown in minutes. Power Profiles Tool - Set a profile as active, delete, duplicate, export and import. Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes. NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s. IUIAutomation - Topic with framework and examples Au3Record.exe Link to comment Share on other sites More sharing options...
Brightview Posted November 9, 2011 Author Share Posted November 9, 2011 Oh, thanks you. So its not possible, my friends also said that its hard to do,.. ok thanks for your help Link to comment Share on other sites More sharing options...
careca Posted November 9, 2011 Share Posted November 9, 2011 Glad to help Spoiler Renamer - Rename files and folders, remove portions of text from the filename etc. GPO Tool - Export/Import Group policy settings. MirrorDir - Synchronize/Backup/Mirror Folders BeatsPlayer - Music player. Params Tool - Right click an exe to see it's parameters or execute them. String Trigger - Triggers pasting text or applications or internet links on specific strings. Inconspicuous - Hide files in plain sight, not fully encrypted. Regedit Control - Registry browsing history, quickly jump into any saved key. Time4Shutdown - Write the time for shutdown in minutes. Power Profiles Tool - Set a profile as active, delete, duplicate, export and import. Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes. NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s. IUIAutomation - Topic with framework and examples Au3Record.exe Link to comment Share on other sites More sharing options...
Brightview Posted November 9, 2011 Author Share Posted November 9, 2011 Uhm hey, a finding certain color in a web browser, is it possible? Link to comment Share on other sites More sharing options...
careca Posted November 9, 2011 Share Posted November 9, 2011 (edited) well, you could use PixelGetColor ( x , y [, hwnd] ) but this is to get the color on a specific pixel, doesnt search in the page for the color you want. EDIT: this one does, kinda PixelSearch ( left, top, right, bottom, color [, shade-variation [, step [, hwnd]]] ) example: ; Find a pure red pixel in the range 0,0-20,300 $coord = PixelSearch( 0, 0, 20, 300, 0xFF0000 ) If Not @error Then MsgBox(0, "X and Y are:", $coord[0] & "," & $coord[1]) EndIf Edited November 9, 2011 by careca Spoiler Renamer - Rename files and folders, remove portions of text from the filename etc. GPO Tool - Export/Import Group policy settings. MirrorDir - Synchronize/Backup/Mirror Folders BeatsPlayer - Music player. Params Tool - Right click an exe to see it's parameters or execute them. String Trigger - Triggers pasting text or applications or internet links on specific strings. Inconspicuous - Hide files in plain sight, not fully encrypted. Regedit Control - Registry browsing history, quickly jump into any saved key. Time4Shutdown - Write the time for shutdown in minutes. Power Profiles Tool - Set a profile as active, delete, duplicate, export and import. Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes. NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s. IUIAutomation - Topic with framework and examples Au3Record.exe Link to comment Share on other sites More sharing options...
Brightview Posted November 9, 2011 Author Share Posted November 9, 2011 how does it work? hmm can you make it that when the code finds the color the keys up and down will stiop? Link to comment Share on other sites More sharing options...
careca Posted November 9, 2011 Share Posted November 9, 2011 (edited) Something you can play with: Local $coord coord() Func coord() sleep (2000) $coord = PixelSearch( 0, 0, 1700, 1100, 0xFFCC33, 0, 2) If @error Then coord() EndIf MsgBox(0, "found at:", $coord[0] & "," & $coord[1]) coord() EndFunc Now you can adapt this to your need. EDIT: code was not as good as now. example in the pic, searching for light orange FFCC33 Edited November 9, 2011 by careca Spoiler Renamer - Rename files and folders, remove portions of text from the filename etc. GPO Tool - Export/Import Group policy settings. MirrorDir - Synchronize/Backup/Mirror Folders BeatsPlayer - Music player. Params Tool - Right click an exe to see it's parameters or execute them. String Trigger - Triggers pasting text or applications or internet links on specific strings. Inconspicuous - Hide files in plain sight, not fully encrypted. Regedit Control - Registry browsing history, quickly jump into any saved key. Time4Shutdown - Write the time for shutdown in minutes. Power Profiles Tool - Set a profile as active, delete, duplicate, export and import. Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes. NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s. IUIAutomation - Topic with framework and examples Au3Record.exe Link to comment Share on other sites More sharing options...
Brightview Posted November 10, 2011 Author Share Posted November 10, 2011 Something you can play with: Local $coord coord() Func coord() sleep (2000) $coord = PixelSearch( 0, 0, 1700, 1100, 0xFFCC33, 0, 2) If @error Then coord() EndIf MsgBox(0, "found at:", $coord[0] & "," & $coord[1]) coord() EndFunc Now you can adapt this to your need. EDIT: code was not as good as now. example in the pic, searching for light orange FFCC33 again, thank you Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now