ericnail Posted March 9, 2010 Share Posted March 9, 2010 (edited) Okay, first off, I'm new here, and I appreciate you guys setting up a forum for users like me Anyway,Here is my issue:I am new and trying to make a script, however, I am having an issue I need help with. I want to have a full script, however based on the situation, you would need to run a different script for each, when I think that I could have the script auto-detect the situation and change itself accordingly.For Instancecould I, say, do this?:(Say I have 3 situations each needing their own script; "Script One", "Script Two", and "Script Three" -- "$Var" would be the situation parameter/id and would be numbered numerically. (Sorry for the OxyMoron ))If $Var = 1 Then <Copy&Paste of "Script One">EndIfIf $Var = 2 Then <Copy&Paste of "Script Two">EndIfIf $Var = 3 Then <Copy&Paste of "Script Three">EndIfBasically I would just be pasting my full 3 working scripts into a new script containing these three IF..Then statements in order to have the script recognize which (Sub)script to run??Sorry if this is a stupid/unworthy question, but I've done my best to look all over and I've done trial and error, yet still no luck. I'm very new, as in I just downloaded AutoIT less than 2 days ago As for what this is for (I read the rules): I don't want you to think I'm using this script for a malicious purpose, so I'll explain as best I can what it is. I would post it here, but my personal log in info is weaved inside in many many forms. Basically, it's a script to recognize which folder (on my Web-server) I am in (via File Manager) and retrieve my local changes to text and update the server-side version with my local text.. if that makes sense?? Anyhow, I am currently stuck using different working scripts for each folder/page which is 30+ scripts. So one self-servicing script would be a Godsend!Any help will be GREATLY appreciated!!Thanks Again,Eric Edited March 9, 2010 by ericnail Link to comment Share on other sites More sharing options...
gcue Posted March 9, 2010 Share Posted March 9, 2010 folks might help if your script was further developed... but from what you have i think this is what you want: if $var = 1 then function1() endif if $var = 2 then function2() endif if $var = 3 then function3() endif func function1() [do stuff] endfunc func function2() [do stuff] endfunc func function3() [do stuff] endfunc good luck and welcome to autoit =) Link to comment Share on other sites More sharing options...
ericnail Posted March 9, 2010 Author Share Posted March 9, 2010 (edited) Thanks for the Super-Fast Reply Well, basically what I am trying to do is take 3 working, full, scripts (which include IF,While, etc. statements) and place them all into the same script and have the script figure out which script to run?Or even just have a loader that would recognize, then run the appropriate script.-- I am using 3 as an example, i actually have roughly 34 scripts which will likely grow to an even larger number in time.Thanks,~Eric Edited March 9, 2010 by ericnail Link to comment Share on other sites More sharing options...
gcue Posted March 9, 2010 Share Posted March 9, 2010 (edited) lookup "case" help file index Edited March 9, 2010 by gcue Link to comment Share on other sites More sharing options...
ericnail Posted March 9, 2010 Author Share Posted March 9, 2010 lookup "case" help file indexWow! Thanks man, I looked at the select earlier and never thought of it again, but I believe this "Case" is exactly what I need You Rock,EricAlso, Is there a way to say for instance:If $Variable1 <> X ThenIgnore $Variable1 for the remainder of script or until restartedEndIf Link to comment Share on other sites More sharing options...
gcue Posted March 9, 2010 Share Posted March 9, 2010 if you're within a while loop you can exitloop while 1 if $x = "bleh" then exitloop wend Link to comment Share on other sites More sharing options...
ericnail Posted March 9, 2010 Author Share Posted March 9, 2010 (edited) if you're within a while loop you can exitloopwhile 1if $x = "bleh" then exitloopwendWhat does the "1" stand for?Also, I have it check lines of text, like:If <line1text> = <localtext> ThenexitloopElseIf cmd($replace text)EndIfIf <line2text> = <localtext> ThenexitloopElseIf cmd($replace text)EndIf^^ do that for each line, obviously "ReplaceText" is not the right command, but you get the idea.Would that work? Edited March 9, 2010 by ericnail 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