ozone Posted June 7, 2004 Share Posted June 7, 2004 (edited) Maybe I'm having one of those days (you know, when you look for the bread in the pantry, and it's right in front of your face but you never see it), well anyway, here is what I'm trying to do:; --------------------------- USER CONFIG --------------------------------- $id_1 = "01. selection 1" $data_1 = "c:\test1.txt" $id_2 = "02. selection 2" $data_2 = "c:\test2.txt" ; ------------------------------ BEGIN --------------------------------- $selection_number = InputBox("What to Update?", $id_01 & @CRLF & $id_02, "selection number", "") $chosen_id = $data_ & $selection_number ExitI know the $chosen_id part is incorrect, but do you see what I'm trying to do? I want a user to choose a selection, in this case either 1 or 2, then that selection will determine which $data_x will be used? Maybe I can't see the solution today, or maybe this is totally the incorrect method to approach the problem, but I can't figure out how to use a variable to help determine another variable.Help is more than welcome EDIT: Just to make what I want a little more clear, later in the program I want to open the text file the user chose, so my future send command will look like this:Run("notepad.exe")WinWaitActive("Untitled")Send("^O")WinWaitActive("Open")Send($chosen_id & "{ENTER}")So the question is, how do I write my above $chosen_id declaration so that is is equal to the correct $data_x value? Edited June 7, 2004 by ozone Link to comment Share on other sites More sharing options...
ozone Posted June 7, 2004 Author Share Posted June 7, 2004 (edited) Figured it out. I was just looking at the problem the wrong way. The simple solution is to array it: ; --------------------------- USER CONFIG --------------------------------- Dim $id[30], $data[30] $id[1] = "01. selection 1" $data[1] = "c:\test1.txt" $id[2] = "02. selection 2" $data[2] = "c:\test2.txt" ; ------------------------------ BEGIN --------------------------------- $selection_number = InputBox("What to Update?", $id[1] & @CRLF & $id[2], "selection number", "") .... Send($data[$selection_number]) .... Exit Edited June 7, 2004 by ozone Link to comment Share on other sites More sharing options...
Valik Posted June 7, 2004 Share Posted June 7, 2004 You could also use the Eval() function. 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