MrChris Posted January 19, 2009 Posted January 19, 2009 How can I get and set a environment var from a command line that is passed while launching my compiled script? for example if I run from windows "compiledscript.exe /test" or "compiledscript.exe /test /test2" I would like to set "test" and or "test2" as a $var that can be used in my script to make my script a little more user dynamic? Hope this makes sense! Regards, MrChris
November Posted January 19, 2009 Posted January 19, 2009 Hi there,Check in help file for command line parametersCheers Old Scriptology Visual Ping 1.8 - Mass Ping Program with export to txt delimited. Desktop 2 RGB and YMCK - Pick a color in the desktop and get the RGB and YMCK code. Desktop 2 RGB - Pick a color in the desktop and get the RGB code. ShootIT 1.0 - Screen Capture full and partial screen [font="'Arial Black';"]Remember Remember The Fifth of November.[/font]
Mobius Posted January 19, 2009 Posted January 19, 2009 Any strings passed via the cmdline to your script or binary are automatically stored in the $Cmdline[] array. Check out the helpfile under: running scripts - Commandline parameters. For environment variables check out the EnvSet() , EnvGet() functions. IF $Cmdline[0] > 0 THEN FOR $i = 1 TO $Cmdline[0]; 0 stores the total amount of cmdline strings. ConsoleWrite($Cmdline[$i] & @LF) NEXT ENDIF
MrChris Posted January 19, 2009 Author Posted January 19, 2009 (edited) Hi there,Check in help file for command line parametersCheersThanks for the reply. I did find in the help file how to pass a switch to a compiled script but not how to set the passed switch to the compiled script. Il check again and make sure I didnt miss that section as some of it was a little greek to me.Thanks,MrChris Edited January 19, 2009 by MrChris
MrChris Posted January 19, 2009 Author Posted January 19, 2009 (edited) Any strings passed via the cmdline to your script or binary are automatically stored in the $Cmdline[] array. Check out the helpfile under: running scripts - Commandline parameters. For environment variables check out the EnvSet() , EnvGet() functions. IF $Cmdline[0] > 0 THEN FOR $i = 1 TO $Cmdline[0]; 0 stores the total amount of cmdline strings. ConsoleWrite($Cmdline[$i] & @LF) NEXT ENDIF Thanks. I think I might be able to work with that. At least after a 30sec quick test. Now if I can figure out how to not include the "/" in the var? Thanks again. Edited January 19, 2009 by MrChris
MrChris Posted January 19, 2009 Author Posted January 19, 2009 I guess it would be easier to just ref the below sample which produces the same end result. Thanks again. $Cmdline[1] ; which is the first param passedoÝ÷ Ù«¢+ØÀÌØí µ±¥¹lÉtìÝ¡¥ ¥Ìѡͽ¹ÁÉ´ÁÍÍ MrChris
ChangMinYang Posted January 19, 2009 Posted January 19, 2009 I guess it would be easier to just ref the below sample which produces the same end result. Thanks again. $Cmdline[1] ; which is the first param passedoÝ÷ Ù«¢+ØÀÌØí µ±¥¹lÉtìÝ¡¥ ¥Ìѡͽ¹ÁÉ´ÁÍÍoÝ÷ ØÊ¸¬þ«¨µæ®¶sdb4FV6Æ&VBgV÷C´6ÖDÆæRgV÷C²ÒFVà¢WB¤VÇ6Tb6Ô4'&b33c´6ÖDÆæRÂ"ÒäBb33c´6ÖDÆæU³ÒÒ"õ"b33c´6ÖDÆæU³ÒÒBäB7G&ætÆVâb33c´6ÖDÆæU³ÒfwC³ÒäB7G&ætÆVâb33c´6ÖDÆæU³%ÒfwC³ÒFVà¢6VÆV7@¢66R6Ô4ÖF6æô66RgV÷C²ô4Å2gV÷C²Âb33c´6ÖDÆæU³Ò¢b33c·7eõBÒvävWE&ö6W72b33c´6ÖDÆæU³%ÒÂgV÷C²gV÷C²¢µvävWE&ö6W72gV÷C·FFÆRgV÷C²²ÂgV÷C·FWBgV÷CµÒ ¢6ÔWV4¶ÆÅ&ö2b33c·7eõBÂ67&DÆæTçVÖ&W"¢66R6Ô4ÖF6æô66RgV÷C²ôÔõbgV÷C²Âb33c´6ÖDÆæU³Ò¢b33c·7eõtæBÒvävWDæFÆRb33c´6ÖDÆæU³EÒÂgV÷C²gV÷C²¢µvävWDæFÆRgV÷C·FFÆRgV÷C²²ÂgV÷C·FWBgV÷CµÒ ¢b6Ô4æFÆRb33c·7eõtæBÒFVà¢väÖ÷fRb33c·7eõtæBÂgV÷C²gV÷C²Âb33c´6ÖDÆæU³%ÒÂb33c´6ÖDÆæU³5Ò¢µväÖ÷fRgV÷C·FFÆRgV÷C²ÂgV÷C·FWBgV÷C²Â²ÂvGF²ÂVvE²Â7VVEÕÕÒ¢VæD`¢66R6Ô4ÖF6æô66RgV÷C²ô5BgV÷C²Âb33c´6ÖDÆæU³Ò¢b33c·7eõtæBÒvävWDæFÆRb33c´6ÖDÆæU³EÒÂgV÷C²gV÷C²¢µvävWDæFÆRgV÷C·FFÆRgV÷C²²ÂgV÷C·FWBgV÷CµÒ ¢b6Ô4æFÆRb33c·7eõtæBÒFVà¢vä7FfRb33c·7eõtæBÂgV÷C²gV÷C²¢µvä7FfRgV÷C·FFÆRgV÷C²ÂgV÷C·FWBgV÷C²¢VæD`¢66R6Ô4ÖF6æô66RgV÷C²ô$$RgV÷C²Âb33c´6ÖDÆæU³Ò¢b33c·7eõDDÄRÒvävWEFFÆRb33c´6ÖDÆæU³EÒÂgV÷C²gV÷C²¢µvävWEFFÆRgV÷C·FFÆRgV÷C²²ÂgV÷C·FWBgV÷CµÒ ¢b7G&ætÆVâb33c·7eõDDÄRfwC³ÒFVà¢6öç6öÆUw&FRb33c·7eõDDÄR¢VæD`¢66R6Ô4ÖF6æô66RgV÷C²ôeTÄÂgV÷C²Âb33c´6ÖDÆæU³Ò¢b33c·7eõDDÄRÒvävWEFFÆRb33c´6ÖDÆæU³EÒÂgV÷C²gV÷C²¢µvävWEFFÆRgV÷C·FFÆRgV÷C²²ÂgV÷C·FWBgV÷CµÒ ¢b7G&ætÆVâb33c·7eõDDÄRfwC³ÒFVà¢6öç6öÆUw&FRb33c·7eõDDÄR¢VæD`¢66RVÇ6P¢6ÔWV4×6t&÷ÂgV÷C·6Õô4ÔDõrgV÷C²ÂgV÷C´&wVÖVçBÖ76ærb333²2gV÷C²fײ6ÔvWEGRb33c´6ÖDÆæRÂ2Â67&DÆæTçVÖ&W"¢·6ÔWV4×6t&÷&Ó÷Föâ7V6g¢²ô²'WGFö⢲ô²æB6æ6V¢²"&÷'BÂ&WG'ÂæBvæ÷&R ¢²2W2ÂæòÂæB6æ6VÂ0¢²BW2æBæò@¢²R&WG'æB6æ6VÂP¢²b¢¢6æ6VÂÂG'vâÂ6öçFçVP¢VæE6VÆV7@¤VÇ6P¢6ÔWV4×6t&÷ÂgV÷C·6Õô4ÔDõrgV÷C²ÂgV÷C´&wVÖVçBÖ76ærb333²2gV÷C²fײ6ÔvWEGRb33c´6ÖDÆæRÂ2Â67&DÆæTçVÖ&W"¢·6ÔWV4×6t&÷&Ó÷Föâ7V6g¢²ô²'WGFö⢲ô²æB6æ6V¢²"&÷'BÂ&WG'ÂæBvæ÷&R ¢²2W2ÂæòÂæB6æ6VÂ0¢²BW2æBæò@¢²R&WG'æB6æ6VÂP¢²b¢¢6æ6VÂÂG'vâÂ6öçFçVP¤VæD` ¤WB
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