AlphaWolf Posted July 8, 2008 Share Posted July 8, 2008 Hi, could anyone help me with a piece of code im trying to learn,im trying to make a program to launch other programs,very simple,but when i use the run command for a button,it comes up with a random number (4 digits). I would like it say something like You have just launched "Program" , very simple,just a dropmenu or a button. Please help me,i really wonna get into coding,im only 14,so want to start early. Thanks Joe Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted July 8, 2008 Moderators Share Posted July 8, 2008 Hi,could anyone help me with a piece of code im trying to learn,im trying to make a program to launch other programs,very simple,but when i use the run command for a button,it comes up with a random number (4 digits). I would like it say something like You have just launched "Program" , very simple,just a dropmenu or a button.Please help me,i really wonna get into coding,im only 14,so want to start early.ThanksJoeJoe, it's difficult to help anyone without the actual code they are using.What I am going to assume is you are using a variable with run:$var = Run(...)In this case, $var will actually be the PID (process identification) of the process you just executed.If you are trying to get the name of the process just ran, look at the example in the help file under _ProcessGetName(). Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
Kitsune Posted July 8, 2008 Share Posted July 8, 2008 Hi,could anyone help me with a piece of code im trying to learn,im trying to make a program to launch other programs,very simple,but when i use the run command for a button,it comes up with a random number (4 digits). I would like it say something like You have just launched "Program" , very simple,just a dropmenu or a button.Please help me,i really wonna get into coding,im only 14,so want to start early.ThanksJoeThose 4 digits are probably because of the return value of that function is the PID of the program process that you are starting with Run(). Link to comment Share on other sites More sharing options...
AlphaWolf Posted July 8, 2008 Author Share Posted July 8, 2008 I am using: GuiCtrlCreateButton("Run (program)", Positioning) in a very plain background please try and help muttley Thanks Joe Note: i am very new to this Link to comment Share on other sites More sharing options...
AlphaWolf Posted July 8, 2008 Author Share Posted July 8, 2008 Sorry: Full Script: #include <GuiConstantsEx.au3> ; GUI GuiCreate("Sample GUI", 400, 400) GuiSetIcon(@SystemDir & "\mspaint.exe", 0) ; MENU GuiCtrlCreateMenu("Context Menu") GuiCtrlCreateMenu("Menu&Two") GuiCtrlCreateMenu("MenuTh&ree") GuiCtrlCreateMenu("Menu&Four") ; CONTEXT MENU $contextMenu = GuiCtrlCreateContextMenu() GuiCtrlCreateMenuItem("Context Menu", $contextMenu) GuiCtrlCreateMenuItem("", $contextMenu) ;separator GuiCtrlCreateMenuItem("&Properties", $contextMenu) ; BUTTON GuiCtrlCreateButton("Sample Button", 10, 330, 100, 30) ; GUI MESSAGE LOOP GuiSetState() While GuiGetMsg() <> $GUI_EVENT_CLOSE WEnd Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted July 8, 2008 Moderators Share Posted July 8, 2008 Sorry:Full Script:#include <GuiConstantsEx.au3>; GUIGuiCreate("Sample GUI", 400, 400)GuiSetIcon(@SystemDir & "\mspaint.exe", 0); MENUGuiCtrlCreateMenu("Context Menu")GuiCtrlCreateMenu("Menu&Two")GuiCtrlCreateMenu("MenuTh&ree")GuiCtrlCreateMenu("Menu&Four"); CONTEXT MENU$contextMenu = GuiCtrlCreateContextMenu()GuiCtrlCreateMenuItem("Context Menu", $contextMenu)GuiCtrlCreateMenuItem("", $contextMenu) ;separatorGuiCtrlCreateMenuItem("&Properties", $contextMenu); BUTTONGuiCtrlCreateButton("Sample Button", 10, 330, 100, 30); GUI MESSAGE LOOPGuiSetState()While GuiGetMsg() <> $GUI_EVENT_CLOSEWEnd@Joe...That doesn't do anything at all, where are you getting the display of 4 numbers? What exactly do you need help with? I believe I gave you the answer to your original question. Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
AlphaWolf Posted July 8, 2008 Author Share Posted July 8, 2008 Sorry,i sent you the wrong bit,i cant find the but that worked,but i know it used : GuiCtrlCreateButton("Paint", Run (mspaint)10, 330, 100, 30) , but i know that doesnt work,it was something along that line, but i didnt use PID or $var, or atleast i dont think it did muttley sorry,you'll have to be patient,im new to coding,but really want to be a coder or something later in my life Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted July 8, 2008 Moderators Share Posted July 8, 2008 (edited) Sorry,i sent you the wrong bit,i cant find the but that worked,but i know it used :GuiCtrlCreateButton("Paint", Run (mspaint)10, 330, 100, 30), but i know that doesnt work,it was something along that line, but i didnt use PID or $var, or atleast i dont think it did muttleysorry,you'll have to be patient,im new to coding,but really want to be a coder or something later in my life Run returns the PID as I said, you are using Run.So simply assign a variable to Run: $i_PID = Run(etc..):After you execute the above, then use _ProcessGetName() (repeating myself here).Now go try that, if it fails, then post all the code you are using, along with the failing attempts. Edited July 8, 2008 by SmOke_N Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
AlphaWolf Posted July 8, 2008 Author Share Posted July 8, 2008 Thanks for that, but i think we might be getting confused,im try to get the button to execute the program, if im just stupid or something,or anoying you,just say so,or dont reply,before i wanted the button to execute say mspaint,and a box came up with 4 random numbers,but i dont know whats going on now. Sorry for any bother Joe Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted July 8, 2008 Moderators Share Posted July 8, 2008 Thanks for that, but i think we might be getting confused,im try to get the button to execute the program, if im just stupid or something,or anoying you,just say so,or dont reply,before i wanted the button to execute say mspaint,and a box came up with 4 random numbers,but i dont know whats going on now. Sorry for any bother JoeAhh, you are actually Running Paint as you are launching that way.Global $h_gui, $h_mspaint, $i_paint_pid $h_gui = GUICreate("Example") $h_mspaint = GUICtrlCreateButton("Run mspaint", 10, 10, 100, 25) GUISetState() While 1 Switch GUIGetMsg() Case -3 Exit Case $h_mspaint If ControlGetText($h_gui, "", $h_mspaint) = "Run mspaint" Then $i_paint_pid = Run(@SystemDir & "\mspaint.exe") GUICtrlSetData($h_mspaint, "Close mspaint") Else ProcessClose($i_paint_pid) GUICtrlSetData($h_mspaint, "Run mspaint") EndIf EndSwitch WEndI thought you just posted it wrong. Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
AlphaWolf Posted July 8, 2008 Author Share Posted July 8, 2008 thanks i have to go,my sick uncle is better,so im off to go be with him,thanks so much for the help! ill recomment you guys,and maybe donate muttley 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