demun Posted March 13, 2015 Share Posted March 13, 2015 Hi, I want to write a AutoIt script to translate the following strings format, can someone help me? Thanks. FROM: forloop param1 {2 3} param2 {9 10} { The result is output1=$param1 output2=$param2 } TO: The result is output1=2 output2=9 The result is output1=2 output2=10 The result is output1=3 output2=9 The result is output1=3 output2=10 Link to comment Share on other sites More sharing options...
TheSaint Posted March 13, 2015 Share Posted March 13, 2015 (edited) Welcome to the forum. I'm struggling with what you are actually asking here. How about instead of using param and output numbers, you tell us what they might be in the real world. In fact what you are dealing with and what the result is likely to be or desired (i.e. 2 apples) What you think needs to be done, and what actually needs to be done, might be two very different things. I also recommend you look in the Help file at the various Loops available i.e. While ... Wend For ... Next and so on. Oops! Just realized you are in the wrong forum. I will report it to be relocated to General Help & Support. Edited March 13, 2015 by TheSaint Make sure brain is in gear before opening mouth! Remember, what is not said, can be just as important as what is said. Spoiler What is the Secret Key? Life is like a Donut If I put effort into communication, I expect you to read properly & fully, or just not comment. Ignoring those who try to divert conversation with irrelevancies. If I'm intent on insulting you or being rude, I will be obvious, not ambiguous about it. I'm only big and bad, to those who have an over-active imagination. I may have the Artistic Liesense to disagree with you. TheSaint's Toolbox (be advised many downloads are not working due to ISP screwup with my storage) Link to comment Share on other sites More sharing options...
demun Posted March 13, 2015 Author Share Posted March 13, 2015 Hi, I want to write a AutoIt script to translate the following command format, can someone help me? Thanks. Originate command format: forloop param1 {2 3} param2 {9 10} { "The result is output1=$param1 output2=$param2" } Want to translate from above commands to following: "The result is output1=2 output2=9" "The result is output1=2 output2=10" "The result is output1=3 output2=9" "The result is output1=3 output2=10" Link to comment Share on other sites More sharing options...
mpower Posted March 13, 2015 Share Posted March 13, 2015 double post also...'?do=embed' frameborder='0' data-embedContent>> Link to comment Share on other sites More sharing options...
guinness Posted March 13, 2015 Share Posted March 13, 2015 Help file is a good place to begin. UDF List: _AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples... Updated: 22/04/2018 Link to comment Share on other sites More sharing options...
TheSaint Posted March 13, 2015 Share Posted March 13, 2015 (edited) You really should have waited until your topic was relocated here, so I repeat again most of what I wrote there. Which you haven't seemingly taken on board. Welcome to the forum. I'm struggling with what you are actually asking here. How about instead of using param and output numbers, you tell us what they might be in the real world. In fact what you are dealing with and what the result is likely to be or desired (i.e. 2 apples) What you think needs to be done, and what actually needs to be done, might be two very different things. I also recommend you look in the Help file at the various Loops available i.e. While ... Wend For ... Next and so on. Edited March 13, 2015 by TheSaint Make sure brain is in gear before opening mouth! Remember, what is not said, can be just as important as what is said. Spoiler What is the Secret Key? Life is like a Donut If I put effort into communication, I expect you to read properly & fully, or just not comment. Ignoring those who try to divert conversation with irrelevancies. If I'm intent on insulting you or being rude, I will be obvious, not ambiguous about it. I'm only big and bad, to those who have an over-active imagination. I may have the Artistic Liesense to disagree with you. TheSaint's Toolbox (be advised many downloads are not working due to ISP screwup with my storage) Link to comment Share on other sites More sharing options...
demun Posted March 13, 2015 Author Share Posted March 13, 2015 Hi, My question is: Now i got many command script files in my hand, like this format: (where 'abc' and 'def' are the input for the string with {2, 3} and {9, 10} forloop abc {2 3} def {9 10} { "The result is hello=$abc seeyou=$def" } I would like to expand above script language to new command like this: "The result is hello=2 seeyou=9" "The result is hello=2 seeyou=10" "The result is hello=3 seeyou=9" "The result is hello=3 seeyou=10" ps. I updated some keywords as I found the originate keywords might cause some misunderstanding to anyone who reads my post Link to comment Share on other sites More sharing options...
mpower Posted March 13, 2015 Share Posted March 13, 2015 (edited) This still doesn't make much sense. Please provide a logical explanation of what you are trying to achieve: Input data -----------(Conditions)-----------> Output data So far all I gather if you're wanting for below: Input: {2,3}{9,10} Output1: 2,9 Output2: 2,10 Output3: 3,9 Output4, 3,10 If that's the case then you are just looking at a simple look that takes those two sets of numbers and outputs the four possible combinations according to your rule: e.g. Input: {x,y}{z,k} Output1: x,z Output2: x,k Output3: y,z Output4, y,k If I am not understanding correctly then please let me know. Otherwise this is what I came up with (there is probably a more elegant way but I don't know it ): #include <Array.au3> $abc = '{2, 3}' $def = '{9, 10}' $abc = StringRegExp($abc, "\{([^}]*)\}", 1) $abc = StringStripWS($abc[0], 8) $set1 = StringSplit($abc, ',', 2) $def = StringRegExp($def, "\{([^}]*)\}", 1) $def = StringStripWS($def[0], 8) $set2 = StringSplit($def, ',', 2) Local $i, $k = 0, $j = 1 For $i = 0 to 1 ConsoleWrite("The result is hello="&$set1[$i]&" seeyou="&$set2[$k]&@CRLF) ConsoleWrite("The result is hello="&$set1[$i]&" seeyou="&$set2[$j]&@CRLF) Next Edited March 13, 2015 by mpower Link to comment Share on other sites More sharing options...
LarsJ Posted March 13, 2015 Share Posted March 13, 2015 $aABC = StringSplit( "2, 3", ", ", 3 ) $aDEF = StringSplit( "9, 10", ", ", 3 ) For $i In $aABC For $j in $aDEF ConsoleWrite( "$i, $j = " & $i & ", " & $j & @CRLF ) Next Next$i, $j = 2, 9 $i, $j = 2, 10 $i, $j = 3, 9 $i, $j = 3, 10 Controls, File Explorer, ROT objects, UI Automation, Windows Message MonitorCompiled code: Accessing AutoIt variables, DotNet.au3 UDF, Using C# and VB codeShell menus: The Context menu, The Favorites menu. Shell related: Control Panel, System Image ListsGraphics related: Rubik's Cube, OpenGL without external libraries, Navigating in an image, Non-rectangular selectionsListView controls: Colors and fonts, Multi-line header, Multi-line items, Checkboxes and icons, Incremental searchListView controls: Virtual ListViews, Editing cells, Data display functions Link to comment Share on other sites More sharing options...
jdelaney Posted March 13, 2015 Share Posted March 13, 2015 (edited) Another similar route: For $i = 2 To 3 For $j = 9 To 10 ConsoleWrite("The result is hello=" & $i & " yousee=" & $j & @CRLF) Next Next output: The result is hello=2 yousee=9 The result is hello=2 yousee=10 The result is hello=3 yousee=9 The result is hello=3 yousee=10 Edited March 13, 2015 by jdelaney IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window. 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