dushkin Posted February 8, 2012 Share Posted February 8, 2012 Hi. I don't know if it is possible, so I am asking your help... I would like to execute an autoit executable from some C# client. If the autoit exe does not use arguments there is no problem. But if It does, how can I know what are they? Can I define them in the scripts in some kind of a meatdata and read it in my C# client? Is there another way? Thanks! Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted February 8, 2012 Moderators Share Posted February 8, 2012 dushkin,Look in the Help file under <Using AutoIt - Command Line Parameters> to find out how to recognize what parameters have been passed to to an AutoIt script/executable. 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...
dushkin Posted February 8, 2012 Author Share Posted February 8, 2012 Thanks M23. I searched there. I couldn't any relevant information. I would like to clarify my problem: I need that the autoit scriptexe will expose the arguments it uses, so other modules, like my C# program, will be able to use them. I would like that my client will be generic and be able to execute every exe file, but then, it needs to know the exe arguments types if exixts (string, int, etc.) to display them to the user so he can set their values. Thanks! Link to comment Share on other sites More sharing options...
JohnOne Posted February 8, 2012 Share Posted February 8, 2012 If you are asking how do you know what parameters an exe takes, then apart from you really ought to know them since you wrote the script, I think it's usual practice to make a 'usage' function to call when incorrect params are entered. 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...
Belini Posted February 8, 2012 Share Posted February 8, 2012 (edited) @Duschkin, i made a test script demonstrating how autoit recognize the the passed parametersSwitch $cmdline[0] Case 1 MsgBox("","","was passed " & $cmdline[0] & " parameter to the script",3) IniWrite(".parameters passed.txt","information passed","1º parameter (teste 1)",$cmdline[1]) FileWriteLine(".parameters passed.txt","") Case 2 MsgBox("","","were passed " & $cmdline[0] & " parameters to the script",3) IniWrite(".parameters passed.txt","information passed","1º parameter (teste 2)",$cmdline[1]) IniWrite(".parameters passed.txt","information passed","2º parameter (teste 2)",$cmdline[2]) FileWriteLine(".parameters passed.txt","") Case 3 MsgBox("","","were passed " & $cmdline[0] & " parameters to the script",3) IniWrite(".parameters passed.txt","information passed","1º parameter (teste 3)",$cmdline[1]) IniWrite(".parameters passed.txt","information passed","2º parameter (teste 3)",$cmdline[2]) IniWrite(".parameters passed.txt","information passed","3º parameter (teste 3)",$cmdline[3]) FileWriteLine(".parameters passed.txt","") case else MsgBox("","","There was no parameter passed to the script.",3) IniWrite(".parameters passed.txt","information passed","Nenhum parameter","0") FileWriteLine(".parameters passed.txt","") EndSwitch exitInstructions:- Compile the script and let this same folder- Create 4 bat files with the content below1st Bat (With no parameter)@echo offstart == .teste.exe2nd Bat (passing a parameter)@echo offstart == .teste.exe teste13rd Bat (passing 2 parameters)@echo offstart == .teste.exe teste1 teste23rd Bat (passing 3 parameters)@echo offstart == .teste.exe teste1 teste2 teste3- Run each bat file you created and see the recorded file parameters intormações passados.txt Edited February 8, 2012 by Belini My Codes: Virtual Key Code UDF: http://www.autoitscript.com/forum/topic/138246-virtual-key-code-udf/ GuiSplashTextOn.au3: http://www.autoitscript.com/forum/topic/143542-guisplashtexton-udf/ Menu versions of Autoit: http://www.autoitscript.com/forum/topic/137435-menu-versions-of-autoit/#entry962011 Selects first folder of letters: ]http://www.autoitscript.com/forum/topic/144780-select-folders-by-letter/#entry1021708/spoiler] List files and folders with long addresses.: http://www.autoitscript.com/forum/topic/144910-list-files-and-folders-with-long-addresses/#entry102 2926 Program JUKEBOX made in Autoit:some functions:http://www.youtube.com/watch?v=WJ2tC2fD5Qs Navigation to search:http://www.youtube.com/watch?v=lblwOFIbgtQ Link to comment Share on other sites More sharing options...
dushkin Posted February 8, 2012 Author Share Posted February 8, 2012 Of course I know the parameters of my scripts. But I won't necessarily know the parameters of the scripts others wrote :-) My aim is to select an autoit exe file in file open browser and then display the relevant GUI for each parameter it requires. If it will not be possible I will have to think of something less generic, but I stillwould prefer this way which is transparent to the user. Link to comment Share on other sites More sharing options...
dushkin Posted February 8, 2012 Author Share Posted February 8, 2012 Thanks Belini. But I don't need the script to recognize the parameters passed to it. I need that a C# program will be able to know which parameters an autoit exe file needs before it (the C# client) runs it using Process.Start() for example . Link to comment Share on other sites More sharing options...
Belini Posted February 8, 2012 Share Posted February 8, 2012 (edited) Was it? ShellExecute("teste.exe", "test1 test2 test3",@ScriptDir) Edited February 8, 2012 by Belini My Codes: Virtual Key Code UDF: http://www.autoitscript.com/forum/topic/138246-virtual-key-code-udf/ GuiSplashTextOn.au3: http://www.autoitscript.com/forum/topic/143542-guisplashtexton-udf/ Menu versions of Autoit: http://www.autoitscript.com/forum/topic/137435-menu-versions-of-autoit/#entry962011 Selects first folder of letters: ]http://www.autoitscript.com/forum/topic/144780-select-folders-by-letter/#entry1021708/spoiler] List files and folders with long addresses.: http://www.autoitscript.com/forum/topic/144910-list-files-and-folders-with-long-addresses/#entry102 2926 Program JUKEBOX made in Autoit:some functions:http://www.youtube.com/watch?v=WJ2tC2fD5Qs Navigation to search:http://www.youtube.com/watch?v=lblwOFIbgtQ Link to comment Share on other sites More sharing options...
dushkin Posted February 8, 2012 Author Share Posted February 8, 2012 Belini, I would like, in my C# ui client, to select a file using a file open dialog, in my case and autoit script exe file, and by selecting it, automatically reveal it's list of arguments it accepts, so I can display this list to the end user. Then he will give them values, and with those values I will be able to use ShellExecute. Link to comment Share on other sites More sharing options...
Belini Posted February 8, 2012 Share Posted February 8, 2012 Unfortunately I do not know how to do this. My Codes: Virtual Key Code UDF: http://www.autoitscript.com/forum/topic/138246-virtual-key-code-udf/ GuiSplashTextOn.au3: http://www.autoitscript.com/forum/topic/143542-guisplashtexton-udf/ Menu versions of Autoit: http://www.autoitscript.com/forum/topic/137435-menu-versions-of-autoit/#entry962011 Selects first folder of letters: ]http://www.autoitscript.com/forum/topic/144780-select-folders-by-letter/#entry1021708/spoiler] List files and folders with long addresses.: http://www.autoitscript.com/forum/topic/144910-list-files-and-folders-with-long-addresses/#entry102 2926 Program JUKEBOX made in Autoit:some functions:http://www.youtube.com/watch?v=WJ2tC2fD5Qs Navigation to search:http://www.youtube.com/watch?v=lblwOFIbgtQ Link to comment Share on other sites More sharing options...
dushkin Posted February 8, 2012 Author Share Posted February 8, 2012 Thanks for your effort!!! Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted February 8, 2012 Moderators Share Posted February 8, 2012 dushkin,select a file using a file open dialog, in my case and autoit script exe file, and by selecting it, automatically reveal it's list of arguments it accepts, so I can display this list to the end userHow on earth do you expect to be able to do this in any language? Simply selecting a random executable file does not expose the arguments it takes! 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...
dushkin Posted February 8, 2012 Author Share Posted February 8, 2012 :-)I didn't say it is possible. I asked if it is possible. It seems to be reasonable to me because it is obvious that the exe file holds this information somewhere.Also I thought that maybe we can add metadata to the script, just as html files that have metadata that the search engines uses. Link to comment Share on other sites More sharing options...
JohnOne Posted February 8, 2012 Share Posted February 8, 2012 Well there you have it, it is not possible. Normal procedure to find and applications command line parameters is to read it's documentation, or ask its author. Any other possible methods are hacks and I doubt they are allowed to be discussed 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 February 8, 2012 Moderators Share Posted February 8, 2012 dushkin, You could add something about the required parameters in the resource table of a compiled file and then use a script to read it. But that would require the author to add the metadata and the use of a script to extract it. It would not be available on simple selection of any old exe file. 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...
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