PROGRAMPROGRAM Posted April 22, 2015 Share Posted April 22, 2015 Hi there! I am new to to programming (this is my first post on this forum). By searching for a program that can upload files on websites, I found AutoIt. I'm the type of person who searches and tries just about everything before asking questions, so, the fact that I'm writing this means I couldn't find the answer and it's worth asking so that someone like me can find the answer one day. My question is: can I turn a string of text into a variable? This might be a no-brainer for you professionals out there, but to me it's a puzzle. Here's what I'm trying to do: Global $counter = 0 Global $AMOUNT = 2 Global $A1 = ('"CAT.JPG" ') & ('"DOG.JPG" ') Global $A2 = ('"TURTLE.JPG" ') & ('"COW.JPG" ') Do Local $A = "$A" & $counter+1 ; <--- THIS CREATES A VARIABLE CALLED "$A" AND COMBINES "$A" + "LOOP NUMBER" Send($A) ; <--- THIS SENDS "$A1" LITERALLY (AS TEXT) BUT I WANT IT TO SEND "$A1" AS A VARIABLE WHICH IS: CAT.JPG AND DOG.JPG Send ("{ENTER}") ; <--- CLICKS ENTER TO UPLOAD IMAGES $counter = $counter + 1 Until $counter = $AMOUNT ; <--- THIS CAUSES IT TO LOOP, ONLY THIS TIME, IT SHOULD BE $A2 (TURLE.JPG AND COW.JPG) Basically, I'm trying to get $A to equal $A1 and $A2 (depending on the loop count). Right now, I'm getting $A to send $A1 as text instead of sending the variable $A1. Please help! Thank you! Link to comment Share on other sites More sharing options...
iamtheky Posted April 22, 2015 Share Posted April 22, 2015 Global $counter = 0 Global $AMOUNT = 2 Global $A1 = ('"CAT.JPG" ') & ('"DOG.JPG" ') Global $A2 = ('"TURTLE.JPG" ') & ('"COW.JPG" ') Do Local $A = "A" & $counter+1 ; <--- THIS CREATES A VARIABLE CALLED "$A" AND COMBINES "$A" + "LOOP NUMBER" send(eval(eval("A"))) ; <--- THIS SENDS "$A1" LITERALLY (AS TEXT) BUT I WANT IT TO SEND "$A1" AS A VARIABLE WHICH IS: CAT.JPG AND DOG.JPG Send ("{ENTER}"); <--- CLICKS ENTER TO UPLOAD IMAGES $counter = $counter + 1 Until $counter = $AMOUNT ,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-. |(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/ (_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_) | | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) ( | | | | |)| | \ / | | | | | |)| | `--. | |) \ | | `-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_| '-' '-' (__) (__) (_) (__) Link to comment Share on other sites More sharing options...
PROGRAMPROGRAM Posted April 22, 2015 Author Share Posted April 22, 2015 Hi "boththose", Thank you for your quick reply. I tried your code: send(eval(eval("A"))) but it doesn't work - it doesn't type anything at all... When I tried send(eval("A"))) - only 1 "eval", it gave me $A1 as text, but again, not the variable. What could be the problem? Thanks! Link to comment Share on other sites More sharing options...
Solution iamtheky Posted April 22, 2015 Solution Share Posted April 22, 2015 (edited) when i put my cursor below that text in scite and press F5, it writes the content of A1 and A2. I also changed the line where you set the variable, there is no $ sign in the quotes. use msgbox or consolewrite for debug. Global $counter = 0 Global $AMOUNT = 2 Global $A1 = ('"CAT.JPG" ') & ('"DOG.JPG" ') Global $A2 = ('"TURTLE.JPG" ') & ('"COW.JPG" ') Do Local $A = "A" & $counter+1 ; <--- THIS CREATES A VARIABLE CALLED "$A" AND COMBINES "$A" + "LOOP NUMBER" ;~ send(eval(eval("A"))) ; <--- THIS SENDS "$A1" LITERALLY (AS TEXT) BUT I WANT IT TO SEND "$A1" AS A VARIABLE WHICH IS: CAT.JPG AND DOG.JPG ;~ Send ("{ENTER}"); <--- CLICKS ENTER TO UPLOAD IMAGES msgbox(0, '' , eval(eval("A"))) $counter = $counter + 1 Until $counter = $AMOUNT Edited April 22, 2015 by boththose ,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-. |(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/ (_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_) | | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) ( | | | | |)| | \ / | | | | | |)| | `--. | |) \ | | `-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_| '-' '-' (__) (__) (_) (__) Link to comment Share on other sites More sharing options...
PROGRAMPROGRAM Posted April 22, 2015 Author Share Posted April 22, 2015 You're right "boththose", I missed that "$" symbol. Every single dot in programming must be noted! Thank you very much, you helped me big time, I spent 3 days trying to figure it out! 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