SpotCheckBilly Posted November 16, 2013 Posted November 16, 2013 Hi all, I'm sure I'm missing something stupid here, but I'm at an impasse. I've been playing around with trying to learn how to program for quite some time that actually have very little experience. There are many concepts and is not aware of and I'm sure that one of them is the cause of my difficulty. Part of the program and working to create involves pursing specific information from line items from a listbox, then inputting them to the search box on Google. I tested the pursing code by using the following: Run("Notepad") WinWaitActive("Untitled - Notepad") Send(ClipGet()) but when I modify (or should I say attempted to modify) the code to paste into the search box on Google by using this: ShellExecute("http://www.Google.com") WinWaitActive("Google - Mozilla Firefox") Send(ClipGet()) the Firefox window opens and Google loads but nothing else happens. The contents from the clipboard are not pasted into the search box. I appreciate any pointers. Thanks in advance. – SCB [font="Tahoma"]"I was worried 'bout rich and skinny, 'til I wound up poor and fat."-- Delbert McClinton[/font]
MHz Posted November 16, 2013 Posted November 16, 2013 Hi SCB, The later is working for me with Firefox already open though I could imagine timing could be a problem if the page is not in a ready state to accept the input from Send. Perhaps try a Sleep(2000) before the Send so it waits 2 seconds before sending the text. See how that works for you.
mikell Posted November 16, 2013 Posted November 16, 2013 The latter works with my Firefox Though this works too ShellExecute("http://www.google.com/search?q=" & ClipGet() )
SpotCheckBilly Posted November 16, 2013 Author Posted November 16, 2013 Thank you so much for the input. @MHZ – I must have a very slow Internet connection (it's Wi-Fi), because even if I use the sleep function to add five seconds, I still don't get any input into the search box. @Mikell – your suggestion: 'ShellExecute("http://www.google.com/search?q=" & ClipGet()) works except for one minor flaw, I lose any formatting such as quotation marks, @TAB, etc. For example, one of the lines is formatted as such: ClipPut(Chr(34) & $CLSID & Chr(34) & @TAB & Chr(34) & $Filename & Chr(34)) when it inputs into the Google search box, the chr(34) (quotation mark) and the @TAB are missing. Is there some reason why the ClipGet() function would not carry over the formatting when coated as per your example? Thanks again for all your help. – SCB [font="Tahoma"]"I was worried 'bout rich and skinny, 'til I wound up poor and fat."-- Delbert McClinton[/font]
michaelslamet Posted November 17, 2013 Posted November 17, 2013 Hey SCB, It's not because ClipPut or ClipGet lose the "formating", we need to encode the URL. The HTML URL Encoding table is here: http://www.w3schools.com/tags/ref_urlencode.asp So Instead of pasting this to URL: http://www.google.com/search?q=try me We should use: http://www.google.com/search?q=try%20me Use StringReplace() to replace @TAB, space, etc to the correct URL-encoding
SpotCheckBilly Posted November 17, 2013 Author Posted November 17, 2013 @michaelslamet – that did the trick! Thank you so very much. I've never really looked at URLs very closely. They say that you learn something new every day, well, I definitely learned something every time I come here for help. You guys rock! – SCB [font="Tahoma"]"I was worried 'bout rich and skinny, 'til I wound up poor and fat."-- Delbert McClinton[/font]
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