Peter Smith Posted April 18, 2006 Share Posted April 18, 2006 This is my first Post, a newbe. I want to create an exe with a command line to enter data. To make things more concrete let the program test.exe consist of the following: $y = $x * $x where $x is entered in a command line test.exe 2 ,for example, and would cause the value of $y to be calulated as 4. Is it possible to create such a commandline exe in autoit3? Peter Link to comment Share on other sites More sharing options...
Thatsgreat2345 Posted April 18, 2006 Share Posted April 18, 2006 (edited) do u mean like creating a calculator? #include <GUIConstants.au3> ; == GUI generated with Koda == $calc = GUICreate("Calculator", 350, 104, 192, 125) $x = GUICtrlCreateInput("", 16, 8, 49, 21, -1, $WS_EX_CLIENTEDGE) $y = GUICtrlCreateInput("", 16, 40, 49, 21, -1, $WS_EX_CLIENTEDGE) $xy = GUICtrlCreateInput("", 16, 72, 49, 21, -1, $WS_EX_CLIENTEDGE) GUICtrlCreateLabel("x", 80, 8, 9, 17) GUICtrlCreateLabel("y", 80, 40, 9, 17) GUICtrlCreateLabel("x and y", 72, 72, 38, 17) $add = GUICtrlCreateButton("Add", 136, 8, 49, 25) $sub = GUICtrlCreateButton("Subtract", 136, 40, 49, 25) $mult = GUICtrlCreateButton("Multiply", 200, 8, 49, 25) $div = GUICtrlCreateButton("Divide", 200, 40, 49, 25) GUISetState(@SW_SHOW) Do $msg = GUIGetMsg() Select Case $msg = $add Guictrlsetdata($xy,Guictrlread($x) + Guictrlread($y)) Case $msg = $sub Guictrlsetdata($xy,Guictrlread($x) - Guictrlread($y)) Case $msg = $div Guictrlsetdata($xy,Guictrlread($x) / Guictrlread($y)) Case $msg = $mult Guictrlsetdata($xy,Guictrlread($x) * Guictrlread($y)) EndSelect Until $msg = $GUI_EVENT_CLOSE Edited April 18, 2006 by thatsgreat2345 Link to comment Share on other sites More sharing options...
PsaltyDS Posted April 18, 2006 Share Posted April 18, 2006 (edited) This is my first Post, a newbe. I want to create an exe with a command line to enter data. To make things more concrete let the program test.exe consist of the following:$y = $x * $xwhere $x is entered in a command line test.exe 2 ,for example, and would cause the value of $y to be calulated as 4.Is it possible to create such a commandline exe in autoit3?PeterOpen the AutoIT help file, which is also the command reference, and look up InputBox. Put together the basic script and if it doesn't work, post it back here and we'll get it working... P.S. thatsgreat2345 took all the fun out of it... :-(Code your script, code your script...If you don't code your script, you can't have any pudding!How can you have any pudding IF YOU DON'T CODE YOUR SCIPT!!! -- Another brick in the call() -- Edited April 18, 2006 by PsaltyDS Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
Peter Smith Posted April 18, 2006 Author Share Posted April 18, 2006 do u mean like creating a calculator?No I'm not creating a calcutalor. I just used a math example to have a concrete example to use in the discussion. As another example I might have had a Program test1.exe that was called with a string in the commandline such as test1.exe "world" and the program would consist of:$y = "hello" & $xand would product the string "hello world"So what I am asking is: Can I enter the data $x (ie "world" is this example) in a command line call to the compiled version of this program Link to comment Share on other sites More sharing options...
Thatsgreat2345 Posted April 18, 2006 Share Posted April 18, 2006 (edited) im kinda lost here so yeah u can do that $1 = "hello" $2 = "world" $y = $1 & " " & $2 msgbox(0,"TITLE",$y) Edited April 18, 2006 by thatsgreat2345 Link to comment Share on other sites More sharing options...
Peter Smith Posted April 18, 2006 Author Share Posted April 18, 2006 You guys are good (and fast). I will spend some time following up. Thanks Peter Link to comment Share on other sites More sharing options...
Peter Smith Posted April 18, 2006 Author Share Posted April 18, 2006 im kinda lost here so yeah u can do that $1 = "hello" $2 = "world" $y = $1 & " " & $2 msgbox(0,"TITLE",$y) No. I guess I am not stateing this well. Of course this is a trivial peice of code, thats why I put it together. Anyone can multiply two numbers or concatinate 2 strings. My question is how can I get the value $x (string or number is irrelavant) into the program when I call it as an exe. Does autoit3 have the capabilitiy of creating an exe with a command line for an arbitrary program Link to comment Share on other sites More sharing options...
PsaltyDS Posted April 18, 2006 Share Posted April 18, 2006 (edited) No I'm not creating a calcutalor. I just used a math example to have a concrete example to use in the discussion. As another example I might have had a Program test1.exe that was called with a string in the commandline such as test1.exe "world" and the program would consist of: $y = "hello" & $x and would product the string "hello world" So what I am asking is: Can I enter the data $x (ie "world" is this example) in a command line call to the compiled version of this program If you are talking about specifying parameters on the commandline from which you ran the program, as opposed to inputting data after the program is running, look up the $CmdLine[0] array in the help file. It still starts from reading the help file. For $n = 0 To $CmdLine[0] MsgBox(64, 'Example', 'Command line parameter $CmdLine[' & $n & '] = "' & $CmdLine[$n] & '"') Next Compile this script and run it from the command line with as many parameters as you like. You'll get the idea. Edited April 18, 2006 by PsaltyDS Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
Thatsgreat2345 Posted April 18, 2006 Share Posted April 18, 2006 hes just talkin bout variables and such i think .. since ive been using them for examples Link to comment Share on other sites More sharing options...
PsaltyDS Posted April 18, 2006 Share Posted April 18, 2006 Your picture reminds me to always ask: WWJD? "What would JdeB do?" Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
Peter Smith Posted April 18, 2006 Author Share Posted April 18, 2006 So here is the final nugget of knowledge. My script is as follows: $x = $CmdLine[1] $y = $x * $x MsgBox(64, 'Example', $y) It is compiled to test.exe I go to DOS to run it with a commandline and type in to the DOS window the following: Test 2 The program generates a message of 4. Next I intend to apply this to create an audio volume control. Thanks to everyone. Link to comment Share on other sites More sharing options...
Peter Smith Posted April 18, 2006 Author Share Posted April 18, 2006 So here is my application of a commandline. I wanted a have a means of using a volume control without going through a GUI. The code is as follows: Opt("MouseCoordMode",0) Opt("WinTitleMatchMode", 2) $slpos1 = $CmdLine[1] Run("C:\WINDOWS\system32\sndvol32.exe") WinWait("Volume Control","") If Not WinActive("Volume Control","") Then WinActivate("Volume Control","") WinMove ( "Volume Control", "", 133,57,456,327 ) $x1 = 182 $y1 = 13 MouseMove($x1,$y1) MouseDown("left") MouseUp("left") $y1 = (236-170) * $slpos1 + 167 $x1 = 69 MouseMove($x1,$y1) MouseDown("left") MouseUp("left") MouseMove($x1,$y1) MouseDown("left") MouseUp("left") MouseMove($x1,$y1) MouseDown("left") MouseUp("left") If I want to move the volume slider to 40% volume, I launch it with a commandline call of "testvol .4" If anyone has other ideas, I am all ears. Link to comment Share on other sites More sharing options...
Lakes Posted April 18, 2006 Share Posted April 18, 2006 im kinda lost here so yeah u can do that $1 = "hello" $2 = "world" $y = $1 & " " & $2 msgbox(0,"TITLE",$y) Off Topic, but is that a Popsicle that Jesus is holding? Do you a link to a larger version? Thanks! 2015 - Still no flying cars, instead blankets with sleeves. Link to comment Share on other sites More sharing options...
Thatsgreat2345 Posted April 18, 2006 Share Posted April 18, 2006 it says jesus then on bottom the freshmaker and hes holding mentos Link to comment Share on other sites More sharing options...
PsaltyDS Posted April 18, 2006 Share Posted April 18, 2006 (edited) So here is my application of a commandline. I wanted a have a means of using a volume control without going through a GUI. The code is as follows: Opt("MouseCoordMode",0) Opt("WinTitleMatchMode", 2) $slpos1 = $CmdLine[1] Run("C:\WINDOWS\system32\sndvol32.exe") WinWait("Volume Control","") If Not WinActive("Volume Control","") Then WinActivate("Volume Control","") WinMove ( "Volume Control", "", 133,57,456,327 ) $x1 = 182 $y1 = 13 MouseMove($x1,$y1) MouseDown("left") MouseUp("left") $y1 = (236-170) * $slpos1 + 167 $x1 = 69 MouseMove($x1,$y1) MouseDown("left") MouseUp("left") MouseMove($x1,$y1) MouseDown("left") MouseUp("left") MouseMove($x1,$y1) MouseDown("left") MouseUp("left") If I want to move the volume slider to 40% volume, I launch it with a commandline call of "testvol .4" If anyone has other ideas, I am all ears. Your call to the command line parameter looks right ($CmdLine[1]), but I'm not sure what you mouse commands are doing. What happens when you run it? Edited April 18, 2006 by PsaltyDS Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
Valuater Posted April 18, 2006 Share Posted April 18, 2006 So here is my application of a commandline. I wanted a have a means of using a volume control without going through a GUI. The code is as follows: Opt("MouseCoordMode",0) Opt("WinTitleMatchMode", 2) $slpos1 = $CmdLine[1] Run("C:\WINDOWS\system32\sndvol32.exe") WinWait("Volume Control","") If Not WinActive("Volume Control","") Then WinActivate("Volume Control","") WinMove ( "Volume Control", "", 133,57,456,327 ) $x1 = 182 $y1 = 13 MouseMove($x1,$y1) MouseDown("left") MouseUp("left") $y1 = (236-170) * $slpos1 + 167 $x1 = 69 MouseMove($x1,$y1) MouseDown("left") MouseUp("left") MouseMove($x1,$y1) MouseDown("left") MouseUp("left") MouseMove($x1,$y1) MouseDown("left") MouseUp("left") If I want to move the volume slider to 40% volume, I launch it with a commandline call of "testvol .4" If anyone has other ideas, I am all ears. its this simple SoundSetWaveVolume(40) and thats it 8) Link to comment Share on other sites More sharing options...
PsaltyDS Posted April 18, 2006 Share Posted April 18, 2006 its this simple SoundSetWaveVolume(40) and thats it 8) Ow! That really hurts! :"> Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law 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