BenjaminAlvarado Posted November 15, 2012 Share Posted November 15, 2012 Hello, Completely new to everything computer techy related. Found this autoit and forums and have been wanting to learn programming as a hobby to eventually be proficient at editing things, pluggins for games like minecraft, create custom things etc. maybe one day develop, but not my goal. I am doing the tutorial and have been able to do all the steps on my end. The hello world msg box, my own stuff though, played with the box and options etc. Problem: Now I was able to use "run" to get notepad open, but I canot get it to open a particular saved notepad. I copied title from teh tool, and nothing. what am I doing wrong? the code I have is as follows Run("notepad.exe") WinWaitActive("asdfasdfasdf - Notepad") it will open notepad, but a new untitled one, not the one I named. idk if I gave enough info for someone to tell me whats wrong? sorry am completely new to this. Link to comment Share on other sites More sharing options...
BrewManNH Posted November 15, 2012 Share Posted November 15, 2012 Look in the help file for Opt and "WinTitleMatchMode". Try using a part of the title of the Notepad window so that it can match the one you want. Also, the Run command runs the program you tell it to, so it will naturally open a new Notepad window. If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator Link to comment Share on other sites More sharing options...
BenjaminAlvarado Posted November 15, 2012 Author Share Posted November 15, 2012 Ummm thanks for answering! I read it but dont know where to put the AutoItSetOption ? i put it on a new line in teh script file ? or maybe I am missing something. like to make my computer auto open a specific notepad file, I would write the run command The winwaitactive command with the file name ? Link to comment Share on other sites More sharing options...
kylomas Posted November 15, 2012 Share Posted November 15, 2012 (edited) BenjaminAlvarado, If you want to open an existing ".txt"file then name the file as a parameter of the run command, something like run(notepad.exe asdfasdfasdf.txt) Not sure of the syntax. kylomas Edited November 15, 2012 by kylomas Forum Rules Procedure for posting code "I like pigs. Dogs look up to us. Cats look down on us. Pigs treat us as equals." - Sir Winston Churchill Link to comment Share on other sites More sharing options...
kylomas Posted November 15, 2012 Share Posted November 15, 2012 (edited) BenjaminAlverado, Here is the correct syntax run ("notepad.exe C:UsersADMIN010Desktopasdfasdfasdf.txt"). You can also use "shellexecute" on the file name and let windows use the default program for that extention. kylomas edit: change the file name to the fully qualified name...my example happens to be on the desktop Edited November 15, 2012 by kylomas Forum Rules Procedure for posting code "I like pigs. Dogs look up to us. Cats look down on us. Pigs treat us as equals." - Sir Winston Churchill Link to comment Share on other sites More sharing options...
kylomas Posted November 15, 2012 Share Posted November 15, 2012 BenjaminAlvarado, The winwaitactive command with the file nameJust to be clear...The winwait command waits for a window based on the title, not file name. It just happens that notepad uses the file name for it's window title.Good Luck,kylomas Forum Rules Procedure for posting code "I like pigs. Dogs look up to us. Cats look down on us. Pigs treat us as equals." - Sir Winston Churchill Link to comment Share on other sites More sharing options...
BenjaminAlvarado Posted November 15, 2012 Author Share Posted November 15, 2012 thanks so much! it opened it now. ONly thing that confuses me is how I could not and still do not see your answer anywhere in teh guide nor can I find it in the help thing. . . but whatevs. it works. I dont know what the shellexecute thing is? but I"m sure I"ll come across it in the guide or help. thanks again! . . . MsgBox(0, "reply to kylomas", "Thank you sir!" 3) Link to comment Share on other sites More sharing options...
JohnOne Posted November 15, 2012 Share Posted November 15, 2012 If you used shellexecute it will open a file with its default application. So ShellExecute("C:UsersADMIN010Desktopasdfasdfasdf.txt") Will do the same job as above To save more typing, and if the file really is on the desktop ShellExecute(@DesktopDir & "asdfasdfasdf.txt") @DesktopDir is just MACRO 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...
BenjaminAlvarado Posted November 15, 2012 Author Share Posted November 15, 2012 Ooohhh thanks john! I think I get it. shellexecute and this macro thing are shortcuts you all use to save typing. when you really undestand the concept of what yorue doing. kk thanks! this is so exciting and interesting! very intriguing Indeed. Now I am trying to use the wait and send thing to write a text, and save it. I can write the text, (though it only writes half for some reason , its a repeat, "the monkeys are coming the monkeys are coming" but only puts it once in teh file). and I am having trouble getting it to do the alt-y to save. not sure why but I'll figur eit! thanks again! Link to comment Share on other sites More sharing options...
BenjaminAlvarado Posted November 15, 2012 Author Share Posted November 15, 2012 OMG! i'm actually doing it haha! I was using "!" halfway in the text, and I read that somehting about flagging it. anyways removed it and it typed it all out sweet! this is the last post I can make till tomorrow night but thanks all! I"ll be around , hope I dont pester y'all! Link to comment Share on other sites More sharing options...
JohnOne Posted November 15, 2012 Share Posted November 15, 2012 Well if you need to, post it up for explanations why. So long as you are putting in some effort, you will get all the help you need here. 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...
Moderators Melba23 Posted November 15, 2012 Moderators Share Posted November 15, 2012 (edited) BenjaminAlvarado,Welcome to the AutoIt forum. As you have been told, if you make some effort you will get lots of help here, but you did say earlier....."to learn programming as a hobby to eventually be proficient at editing things, pluggins for games like minecraft"Please make sure you read the Forum Rules before you post again - we would not want you to get off on the wrong foot. M23Edit: And if you come back early, I have lifted the restriction so you can post again immediately. Edited November 15, 2012 by Melba23 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...
BenjaminAlvarado Posted November 15, 2012 Author Share Posted November 15, 2012 Hello Melba23, Thanks for your time! and for allowing me to post again I have spent like 6 hours already going over the guide. and messed around with opening files and stuff. ITs probably kid stuff, but I am really diggin it IN regards to my earlier post, I read the rules now, and believe that you do not want anything related to violating ToS of games/servers or editing their functionality intended by the creator? Very good. I did not intend it to sound like that and shall refrain from any game-related comunication. I do wish to learn programming in general, and only for personal enrichment to stay on top of the modern world, and stuff Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted November 15, 2012 Moderators Share Posted November 15, 2012 BenjaminAlvarado, and shall refrain from any game-related comunicationExcellent news. I am delighted you are using the tutorial to learn - so many people do not even bother and then wonder why they have problems. There is another good basic guide here and a good FAQ in the Wiki - so you have plenty of reading to keep you interested! 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...
BenjaminAlvarado Posted November 15, 2012 Author Share Posted November 15, 2012 Yup! Glad youre here I'll finish this tutorial then I'll check the one you posted as well. I already went to teh wiki as well. Atm I am starting Loops. but honestly, started getting lost (and I think the author started speeding up) around arrays, branches, and such. the last part I knew decent was variables. Also, I"m still unsure of a lot of things, but is this a good place to start as well for learning other thigns in teh future like java and other programming/developing stuff? like, are the concepts or foundational principles the same? Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted November 15, 2012 Moderators Share Posted November 15, 2012 BenjaminAlvarado, Learning how to code in AutoIt will teach you many things which will be useful regardless of the language you use: logic, rigour, attention to detail. However, standard AutoIt code follows the procedural paradigm - structured code which flows logically. As such it will not prepare you for languages which use the object-oriented paradigm - although there is an OO AutoIt UDF that does a pretty good job of doing that too. Autoit is also not that fast (in computer, not human terms) as it is interpreted and not truly compiled (even though we use that term when converting a script to an executable file). And it is not really suited to really low-level kernel work - which is true of almost all high-level languages - yet I am constantly amazed at what people can do with it. Overall I would suggest that AutoIt is as good a place to start coding as anywhere else - and a lot better than many. You have an excellent Help file, good tutorials and a very supportive forum (as long as you make some effort as well - we do not like people who just ask for code). So keep at it and do not be afraid to ask even simple questions - we were all beginners once and are always happy to help those who want to learn. M23 P.S. The words in bold]/b] should offer some more bedtime reading if you are interested. 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...
BenjaminAlvarado Posted November 15, 2012 Author Share Posted November 15, 2012 Thankyou soo much! Sounds good. sounds like AutoIt is like a hobby/toy for programmers? either way, if it is a start into the world, good start wiht good habits, then sounds good. ;in some random notepad file. . . . AutoItSendOption("SendKeyDelay", 100) Send("Those words sound complicated! {enter} but I will add them to my list! along with the guide you mentioned also." & @CRLF & "Thanks for the support!") I was kinda shying away from asking a question, but I will now IF I understood the guide correctly, a variable $whatever is to store lines of code or strings into it so that next I can just use the variable and it will execute the code I put into it without writing it all over again or copy/pasting? So I would use teh following line of code Assign("varname", "data" [, flag] ) and on the "data" area I would put the code? or am I gravely missing something? cause its not wokring Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted November 15, 2012 Moderators Share Posted November 15, 2012 BenjaminAlvarado,You do not need Assign - just a simple "=":; Assign data to a variable $sData = "Those words sound complicated! {enter} but I will add them to my list! along with the guide you mentioned also." & @CRLF & "Thanks for the support!" ; Use the variable Send($sData)All clear? 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 November 15, 2012 Moderators Share Posted November 15, 2012 (edited) Speaking only to your question about AutoIt being a hobby/toy, I would say definitely not. I use AutoIt almost exclusively for all my business customers, and do everything from managing their networks to creating full blown customer-facing applications (one in particular is now in use in a hospital by ~5500 caregivers). As Melba stated, if you take the time to learn AutoIt, you will be astounded at the power of the language. I think most would agree there is very little you can't do with it. In addition, and one of the reasons I think AutoIt rises above the rest, you have a large community that is dedicated to helping like-minded folks who have a love for the language. Can't ask for much more than that Edit: corrected horrid grammar Edited November 15, 2012 by JLogan3o13 "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...
BenjaminAlvarado Posted November 15, 2012 Author Share Posted November 15, 2012 (edited) ]@jlogan thanks! that sounds good, like knowing it can be put practically into a business etc is really good. I am starting to dabble into programming (more like obsessively dabble) as something I am liking, but also want it to have a practical application in the future should I choose to use it. You ppretty much testifiy to that @m23 I see clearly how to assign it now this is correct as it works BlockInput(1) Run("notepad.exe C:UsersBenjyDesktopfff.txt") WinWaitActive("fff - Notepad") AutoItSetOption("SendKeyDelay", 100) Send("ummm so this is supposed to be on a different line {enter} not sure what that means though." & @CRLF & "This should be on a new line!") WinClose("fff - Notepad") WinWaitActive("Notepad") Send("!s") $sData = MsgBox(0, "To Commander Atg", "Everything has been done as ordered Sir!", 4) BlockInput(0) that should end with the message box. so I assigned into the variable $sData the command of the "msgBox etc". is it possible to assign a second line of code (for example, the entire code I just put) into one variable? would I just separate the functions with commas or end each line with the () and then "msgbox(etc), Send(newtext)" etc? ps, sorry fixed the code, was overzealos and didn't test it before posting pps: i tried adding more than one line of code into a variable and it wont let me. Edited November 15, 2012 by BenjaminAlvarado 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