jamesch222 Posted March 9, 2015 Share Posted March 9, 2015 (edited) I would like to know the script to press "F1" and a msgbox would pop up on the screen. Thanks Edited.. Example HotKeySet("{F1}", "Msgboxtest") Func Msgboxtest() MsgBox(0,"Message","This is a message") EndFunc Edited March 9, 2015 by jamesch222 Link to comment Share on other sites More sharing options...
JohnOne Posted March 9, 2015 Share Posted March 9, 2015 HotKeySet("{F1}", "Msgboxtest") While 3 ;Keep script alive. Sleep(333) WEnd Func Msgboxtest() MsgBox(0, "Message", "This is a message") EndFunc ;==>Msgboxtest AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
jamesch222 Posted March 9, 2015 Author Share Posted March 9, 2015 HotKeySet("{F1}", "Msgboxtest") While 3 ;Keep script alive. Sleep(333) WEnd Func Msgboxtest() MsgBox(0, "Message", "This is a message") EndFunc ;==>Msgboxtest How would I be able to run 2 functions at one time, it seems when I run the 2nd function, it cancels out the first. Link to comment Share on other sites More sharing options...
jdelaney Posted March 9, 2015 Share Posted March 9, 2015 (edited) Adlibregister, or instead of directly calling msgbox, initiate another script that opens the msgbox (so your script won't be forced to wait for the message box to close)....helpfile, search for command line parameters. Run(@AutoItExe & ' /AutoIt3ExecuteLine "MsgBox(0, ''Hello World!'', ''Hi 1 !'')"') Run(@AutoItExe & ' /AutoIt3ExecuteLine "MsgBox(0, ''Hello World!'', ''Hi 2 !'')"') Edited March 9, 2015 by jdelaney IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window. Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted March 9, 2015 Moderators Share Posted March 9, 2015 AutoIt is not multi-threaded, so no running 2 functions at once. If you have multiple functions to call, you call them sequentially, or do something like this: HotKeySet("{F1}", "Msgboxtest") HotKeySet("{F2}", "Msgboxtest2") While 3 ;Keep script alive. Sleep(333) WEnd Func Msgboxtest() MsgBox(0, "Message", "This is a message") EndFunc ;==>Msgboxtest Func Msgboxtest2() MsgBox(0, "Message", "This is another message") EndFunc ;==>Msgboxtest "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
jdelaney Posted March 9, 2015 Share Posted March 9, 2015 Global $iPid HotKeySet("{F1}", "Msgboxtest") HotKeySet("{F2}", "Msgboxtest2") While 3 ;Keep script alive. Sleep(333) WEnd Func Msgboxtest() Global $iPid = Run(@AutoItExe & ' /AutoIt3ExecuteLine "MsgBox(0, ''Hello World!'', ''Hi 1 !'')"') EndFunc ;==>Msgboxtest Func Msgboxtest2() If $iPid Then ProcessClose($iPid) Run(@AutoItExe & ' /AutoIt3ExecuteLine "MsgBox(0, ''Hello World!'', ''Hi 2 !'')"') EndFunc ;==>Msgboxtest IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window. Link to comment Share on other sites More sharing options...
jamesch222 Posted March 9, 2015 Author Share Posted March 9, 2015 AutoIt is not multi-threaded, so no running 2 functions at once. If you have multiple functions to call, you call them sequentially, or do something like this: HotKeySet("{F1}", "Msgboxtest") HotKeySet("{F2}", "Msgboxtest2") While 3 ;Keep script alive. Sleep(333) WEnd Func Msgboxtest() MsgBox(0, "Message", "This is a message") EndFunc ;==>Msgboxtest Func Msgboxtest2() MsgBox(0, "Message", "This is another message") EndFunc ;==>Msgboxtest hmm, is there anyway I can have it detect a certain "Text" that may pop up on the screen, that would cause it to stop all functions? Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted March 9, 2015 Moderators Share Posted March 9, 2015 jamesch222,When you reply, please use the "Reply to this topic" button at the top of the thread or the "Reply to this topic" editor at the bottom rather than the "Quote" button - we know what we wrote and it just pads the thread unnecessarily. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted March 9, 2015 Moderators Share Posted March 9, 2015 Maybe a little clarification on what exactly you're trying to do. All the questions seem rather broad, and we seem to be skipping about. Can you please define what application you're trying to manipulate, and exactly what you want to accomplish? It will greatly assist us in helping you. "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
jamesch222 Posted March 9, 2015 Author Share Posted March 9, 2015 (edited) For example, say a word would pop up at a certain area. like "Welcome" were to pop up in the middle of the screen. when that "Welcome" were to pop up, I would like all function to stop so I could control it myself. (or the script to close) I could also make it work if a color was detected in a specific area. Edited March 9, 2015 by jamesch222 Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted March 9, 2015 Moderators Share Posted March 9, 2015 jamesch222, that is the ambiguity I'm referencing - what causes the word to pop up? Is it a window in an application (if so, what app, or a screenshot of what it looks like), is it in a web page (if so, what web page or a screen shot)? A "certain word" can pop up on screen in a number of scenarios: an embedded control, a windows pop up, a message from a web page, etc. Just saying "if this certain word appears" doesn't really help us help you "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
jdelaney Posted March 9, 2015 Share Posted March 9, 2015 (edited) AdlibRegister("CheckforWelcome") Global $iPid HotKeySet("{F1}", "Msgboxtest") HotKeySet("{F2}", "Msgboxtest2") While 3 ;Keep script alive. Sleep(333) WEnd Func Msgboxtest() Global $iPid = Run(@AutoItExe & ' /AutoIt3ExecuteLine "MsgBox(0, ''Welcome!'', ''Hi 1 !'')"') EndFunc ;==>Msgboxtest Func CheckForWelcome() While WinGetHandle("[CLASS:#32770; REGEXPTITLE:.*[wW]elcome.*]","") HotKeySet("{F1}") HotKeySet("{F2}") Sleep(1000) ConsoleWrite("wait for user to close welcome window" & @CRLF) WEnd HotKeySet("{F1}", "Msgboxtest") HotKeySet("{F2}", "Msgboxtest2") EndFunc Func Msgboxtest2() If $iPid Then ProcessClose($iPid) Run(@AutoItExe & ' /AutoIt3ExecuteLine "MsgBox(0, ''Hello World!'', ''Hi 2 !'')"') EndFunc ;==>Msgboxtest Press F1 Edited March 9, 2015 by jdelaney IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window. Link to comment Share on other sites More sharing options...
jamesch222 Posted March 9, 2015 Author Share Posted March 9, 2015 (edited) Say that text were to pop up on my screen, which would be a chatroom. Is there a way to stop all functions (or close the script) when that were to pop up. (either by color, or text (prefer text) Edited March 9, 2015 by jamesch222 Link to comment Share on other sites More sharing options...
jdelaney Posted March 9, 2015 Share Posted March 9, 2015 Now you are traveling into OCR realm, which is unreliable at best. The best I've seen OCR work is 85-90% text recognition, and you need to know exactly where to look. You can download sharepoint designer, and install MODI. Examples scripts forum to see how it works. IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window. Link to comment Share on other sites More sharing options...
jamesch222 Posted March 9, 2015 Author Share Posted March 9, 2015 Is it not easy to simply detect when that color were to pop up on a specific spot on the screen? Like if it were to pop up on a specific pixel at the bottom of the screen, the script would detect the color "Found" and pause, or exit after seeing this color? Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted March 9, 2015 Moderators Share Posted March 9, 2015 You can look in the Help file under the Pixel functions, but they too are notoriously unstable. It is best to know the application, as each one is different in how you obtain and manipulate its controls. "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
jamesch222 Posted March 9, 2015 Author Share Posted March 9, 2015 Global $color PixelSearch(1057, 841, 1292, 848, $color) Send("{ESC 1}") would something like that work, if so. How to set the color? Link to comment Share on other sites More sharing options...
JohnOne Posted March 9, 2015 Share Posted March 9, 2015 If you know exactly where the word appears, then you can loop PixelChecksum(). Look at the help file, try something. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
jamesch222 Posted March 9, 2015 Author Share Posted March 9, 2015 HotKeySet("{ESC}", "Terminate") Func Terminate() Exit 0 EndFunc Local $iCheckSum = PixelChecksum(1057, 841, 1292, 848) While $iCheckSum = PixelChecksum(1057, 841, 1292, 848) Sleep(100) Send("{ESC 1}") WEnd it seems to end instantly regardless of any changes on the screen. any ideas? Link to comment Share on other sites More sharing options...
jdelaney Posted March 9, 2015 Share Posted March 9, 2015 Global $color PixelSearch(1057, 841, 1292, 848, $color) Send("{ESC 1}") would something like that work, if so. How to set the color? Use the AutoIT window info tool to get the color...mouse tab when focused on your pixel. IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window. 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