Steven Vandenhoute Posted November 30, 2006 Share Posted November 30, 2006 Can somebody give me some help on this isue. I want to start my program with some options (like this: program/start) How can I program this in my program? "You cannot solve a problem with the mind that created it" (Albert Einstein) Link to comment Share on other sites More sharing options...
xcal Posted November 30, 2006 Share Posted November 30, 2006 What? Like Run('program.exe /start')? How To Ask Questions The Smart Way Link to comment Share on other sites More sharing options...
BigDod Posted November 30, 2006 Share Posted November 30, 2006 Lookup command line options in the help file. Time you enjoyed wasting is not wasted time ......T.S. Elliot Suspense is worse than disappointment................Robert Burns God help the man who won't help himself, because no-one else will...........My Grandmother Link to comment Share on other sites More sharing options...
Steven Vandenhoute Posted November 30, 2006 Author Share Posted November 30, 2006 can i use my own command how can i code that "You cannot solve a problem with the mind that created it" (Albert Einstein) Link to comment Share on other sites More sharing options...
xcal Posted November 30, 2006 Share Posted November 30, 2006 Here, try running this: $path = RegRead('HKEY_LOCAL_MACHINE\SOFTWARE\AutoIt v3\AutoIt', "InstallDir") Run('hh.exe ' & $path & '\AutoIt3.chm::/html/intro/running.htm#CommandLine') How To Ask Questions The Smart Way Link to comment Share on other sites More sharing options...
Steven Vandenhoute Posted November 30, 2006 Author Share Posted November 30, 2006 I think you've all misunderstand me (maybe my own fault) What I want is the following: for an example. you can run the command copy with some parameters like copy /y etc i want to code something in my autoit script so i can run my compiled script also with some parameters (defined by me) I know I have seen that piece of code somewhere, but I can't find it anymore "You cannot solve a problem with the mind that created it" (Albert Einstein) Link to comment Share on other sites More sharing options...
Helge Posted November 30, 2006 Share Posted November 30, 2006 Check out command line parameters in the helpfile. Link to comment Share on other sites More sharing options...
NeoFoX Posted November 30, 2006 Share Posted November 30, 2006 ShellExecute("program.exe", "/try /this") Something like that? Neo [center][font="Arial"]--- The Neo and Only --- [/font][font="Arial"]--Projects---[/font]Image to Text converterText to ASCII converter[/center] Link to comment Share on other sites More sharing options...
Steven Vandenhoute Posted November 30, 2006 Author Share Posted November 30, 2006 Check out command line parameters in the helpfile.Thx to you all. I've found the sollution. It was indeed with the command line parameter. But the first thing I felt when reading the help file was... WTF I don't get it. But I found a way to get it. The code I wrote if $CmdLine[0]<1 Then MsgBox(0,"Parameters", "/to and /from") Exit Else If $CmdLine[1] = "to" Then Run("d:\fujitron\brestos4_BO\Brestos4_BO.exe /AB_TOKASSA_COM", "", @SW_MAXIMIZE) MsgBox(0,"","File saved to kassa",2) Else If $CmdLine[1] = "from" Then Run("d:\fujitron\Brestos4_BO\brestos4_BO.exe /AB_FROMKASSA_COM", "", @SW_MAXIMIZE) MsgBox(0,"", "File saved from kassa",2) Else Exit EndIf EndIf EndIf It works, but if anybody can write it in another way, please tell me ( I still want to learn) "You cannot solve a problem with the mind that created it" (Albert Einstein) Link to comment Share on other sites More sharing options...
bluebearr Posted November 30, 2006 Share Posted November 30, 2006 If statements certainly work, but if you have a lot of switches, Select...Case will probably look better. If you have SciTe (and why wouldn't you? ) you can enter Ctrl-Shift-R, enter or select "cmdlineselect" and get this structure inserted into your script: expandcollapse popupIf $Cmdline[0] Then For $i = 1 To $Cmdline[0] Select Case $Cmdline[$i] = '/?' MsgBox(0x40000, StringTrimRight(@ScriptName, 4) & ' Help', _ 'Switches are:' & @LF _ & @LF & '/extract' _ & @LF & @TAB & 'Extract files to current directory' _ & @LF & '/x' _ & @LF & @TAB & '' _ & @LF & '/x' _ & @LF & @TAB & '' _ & @LF & '/x' _ & @LF & @TAB & '' _ & @LF & '/x' _ & @LF & @TAB & '' _ & @LF & '/x' _ & @LF & @TAB & '') Exit Case $Cmdline[$i] = '/extract' FileInstall('?', @ScriptDir & '') Exit Case $Cmdline[$i] = '/x' Case $Cmdline[$i] = '/x' Case $Cmdline[$i] = '/x' Case $Cmdline[$i] = '/x' Case $Cmdline[$i] = '/x' Case Else MsgBox(0x40000, 'Incorrect switch used', 'Command used:' & @LF & $CmdlineRaw _ & @LF & @LF & 'Use /? for the switches available.') Exit EndSelect Next EndIfoÝ÷ Ø è¶«¦nªðk*ºÈ§Ê&©Ý)Þ³r¬Ëhmæëh©Ýë(ëax%Gªº¶)¢ëyÓJ®¢Ú'¶¢iÙbæ§v¶¯j[çM"Ú½ªâi¹^N¬²ÚîrÛ«{¥WÊ¢ØZµ«¢+Ù%ÀÌØí µ1¥¹lÁtÐìÄQ¡¸(%½ÈÀÌØí¤ôÈѼÀÌØí µ1¥¹lÁt($%%MÑÉ¥¹%¹MÑÈ Ìäì½Ñ¥µ½ÕÑðµÑ¥µ½ÕÑð½ÑðµÐÌäì°ÀÌØí µ1¥¹lÀÌØí¤´Åt¤Q¡¸($$$ÀÌØíÑ¥µ½ÕÐôÀÌØí µ1¥¹lÀÌØí¥t($%¹%(%9áÐ)¹% BlueBearrOddly enough, this is what I do for fun. Link to comment Share on other sites More sharing options...
Steven Vandenhoute Posted November 30, 2006 Author Share Posted November 30, 2006 Thx Bluebearr this is helping. First I want to thank you for giving me the tip to use ctrl-shift-R. I didn't know that excist. Now I can modifie everything. Thank you "You cannot solve a problem with the mind that created it" (Albert Einstein) Link to comment Share on other sites More sharing options...
GEOSoft Posted November 30, 2006 Share Posted November 30, 2006 Thx Bluebearrthis is helping.First I want to thank you for giving me the tip to use ctrl-shift-R.I didn't know that excist.Now I can modifie everything.Thank youIf you're going to do it with $CmndLine (as shown in help) or even from the run dialog I strongly recommend that you NOT use '/' as the separator for Commandline parameters. Microsoft is very soon ( I think in Vista) dropping that as a separator in favor of '-' which already works in most cases. George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!" Link to comment Share on other sites More sharing options...
Steven Vandenhoute Posted November 30, 2006 Author Share Posted November 30, 2006 well, that is strange in my example, I didn't hardcoded something like /? but only the ? and it works In the other examples given by other users the /? is fully hardcoded. What is the best thing? Do I need to leave the / or not? "You cannot solve a problem with the mind that created it" (Albert Einstein) Link to comment Share on other sites More sharing options...
GEOSoft Posted December 1, 2006 Share Posted December 1, 2006 well, that is strangein my example, I didn't hardcoded something like /? but only the ? and it worksIn the other examples given by other users the /? is fully hardcoded.What is the best thing? Do I need to leave the / or not?Sometimes Yes, sometimes No. In your case No because if you run a command (don't confuse with file) and you have an invalid switch then it will usually default to "/?"To follow your example it would actually beRunWait(@Comspec & " copy /?)Read about @Comspec in the help file under "Run" George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!" 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