mooboo Posted March 7, 2004 Share Posted March 7, 2004 (this is such a funny sample script... )Ok... I'm trying to set variables to clipboard... but it will just copy over $1 as text... not a variable... look...if winexists("window") then $1 = InputBox("Question", "What is your name?", "Enter Name")$2 = InputBox("Question", "Who do you love?", "Who you love")$3 = InputBox("Question", "Do you love puppies?", "Yes or no")clipput (Hello. My name is $1. I absolutely love $2. And if you asked me if I love puppies, I would scream $3.)winactivate ("window")send ( "^v", 0)exitendifmsgbox, 0, "Error", "There was an error."exitand when the window is activated and CTRL+v is pressed... It just shows... Hello. My name is $1. I absolutely love $2. And if you asked me if I love puppies, I would scream $3.)That's just a sample code I made up just for this. Can someone tell me how I can put variables to clipboard? Link to comment Share on other sites More sharing options...
Developers Jos Posted March 7, 2004 Developers Share Posted March 7, 2004 If WinExists("window") Then $1 = InputBox("Question", "What is your name?", "Enter Name") $2 = InputBox("Question", "Who do you love?", "Who you love") $3 = InputBox("Question", "Do you love puppies?", "Yes or no") ClipPut("Hello. My name is " & $1 & ". I absolutely love " & $2 & _ ". And If you asked me If I love puppies, I would scream " & $3 & ".") WinActivate("window") Send("^v") Exit EndIf msgbox, 0, "Error", "There was an error." Exit SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
ben_josephs Posted March 7, 2004 Share Posted March 7, 2004 There is no variable substitution in strings (as there is in many shell and other script languages). You have to explicitly concatenate the fixed and variable text:clipput ( "Hello. My name is " & $1 & _ ". I absolutely love " & $2 & _ ". And if you asked me if I love puppies, " & _ "I would scream " & $3 & ".")Note the line continuations.Your example couldn't have worked, because the text parameter to ClipPut wasn't quoted. Link to comment Share on other sites More sharing options...
sykes Posted March 7, 2004 Share Posted March 7, 2004 The problem is in the formatting in the ClipPut line: if winexists("window") then $1 = InputBox("Question", "What is your name?", "Enter Name") $2 = InputBox("Question", "Who do you love?", "Who you love") $3 = InputBox("Question", "Do you love puppies?", "Yes or no") clipput ("Hello. My name is " & $1 & ". I absolutely love " & $2 & ". And if you asked me if I love puppies, I would scream " & $3 & ".") winactivate ("window") send ( "^v", 0) exit endif msgbox, 0, "Error", "There was an error." exit You have to use quotes for the Non variable stuff We have enough youth. How about a fountain of SMART? Link to comment Share on other sites More sharing options...
sykes Posted March 7, 2004 Share Posted March 7, 2004 Wow ... hows that for response LOL 3 answers in 5 minutes We have enough youth. How about a fountain of SMART? Link to comment Share on other sites More sharing options...
Wallfire Posted March 7, 2004 Share Posted March 7, 2004 lol, im still new with autoit so it took me longer to reply...i had to make a code that works so that i could understand why yours didnt. i think your answer has allready been announced, but here is my solution: you were making a one long string in the clipput funciton. you should instead be putting a bunch of small strings together. here is what i came up with: $Q1 = InputBox("Question", "What is your name?", "Enter Name") $Q2 = InputBox("Question", "Who do you love?", "Who you love") $Q3 = InputBox("Question", "Do you love puppies?", "Yes or no") $text=( "Hello. My name is " & $Q1 & ". I absolutely love" & $Q2 & ". And if you asked me if I love puppies, I would scream " & $Q3 & ".") clipput($text) the rest of your code i commented out, but you might want to go back and make sure you are using correct syntax for all the functions used. msgbox for example. hope your answer was sovled :cheer: awww...wheres the chick? 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