[AHK] Help with sending clipboard data to a website form menu

User Tag List

Results 1 to 3 of 3
  1. #1
    Unholyshaman's Avatar ★ Elder ★
    Reputation
    1517
    Join Date
    Jun 2007
    Posts
    2,827
    Thanks G/R
    20/20
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    [AHK] Help with sending clipboard data to a website form

    I'm new to AHK and basically live off reading tutorials I find on it haha.

    The simple idea behind what I want to do is when I have a URL on my clipboard and press "Windows Button + C" it then :
    1) runs Tiny URL Shortener | Create a Free Short URL Redirect in my browser
    2) Waits for that window to become open
    3) Activates that window
    4) Pastes that URL which is on my clipboard

    The problem is, tiny.cc doesn't auto-focus the cursor's insert point into their entry form.

    So my problem is therefore, how can I set AutoHotkey to autofocus the insert point in a specific form (the URL bar on Tiny URL Shortener | Create a Free Short URL Redirect) before pasting the data?

    #c::
    Run www.tiny.cc
    WinWait Tiny URL Shortener | Create a Free Short URL Redirect - Rockmelt
    WinActivate
    Send ^v
    return

    [AHK] Help with sending clipboard data to a website form
  2. #2
    Swum's Avatar Corporal
    Reputation
    8
    Join Date
    Aug 2011
    Posts
    21
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Did you ever figure out how to do this? I'm assuming you did, as there are multiple methods for performing that very useful concept.

    1) On the event of the website being completely loaded, you can register the pressing of the TAB key to cycle to the input URL box. This works on a Mac, in Safari, but I'm not sure about this on Windows or another web browser. I definitely recommend you give this method a try, as it is much more simple than the next two.

    2) Take a screenshot of the input field for the URL and then use the command 'ImageSearch' to find it and click on the returned value of the coordinates. I'm not sure if this will work, but it should if you read the documentation. I also recommend Sikuli for graphical automation as it looks nice, is deployable to multiple platforms through Java, and greatly simplifies method 2.

    3) Find the coordinates of a spot anywhere inside the input field and then tell the script to click there. I don't recommend this, as it might not work if the layout of your browser gets changed or if the website changes even the slightest bit.
    Note that all of these methods require updating if the website itself changes.

    I encourage people to post other methods that are plausible in this situation. In addition, I'd like to mention for all Mac users that Applescript can be used quite nicely for this by utilizing one of the above methods. If anyone wants, I can probably make the utility for everyone (open source). Finally, please correct me if I made a mistake, or if one my methods is impossible/too difficult/unnecessary/etc.

    EDIT v2: tiny.cc does not support web links without the 'http://'. It would be nice to append the http to the beginning of the link (and using the same process, append a www). First you can check the string for the 'http://' by utilizing the 'InStr' method. It would look like the code below. If you want, the CaseSensitive parameter might be nice, as the InStr function will look only for the exact 'http://'. In addition, the variable URL should equal the clipboard content.
    Code:
    if InStr(URL, "http://")
    Then, you'd need to add the 'http://' if the URL does not have it (this would be part of the 'else' conditional). The code below should do the trick.
    Code:
    newURL := "http://" . URL
    You can use the above process to append a 'www.' also, probably by adding some more conditionals (you'll need to check for the 'http://', check for the 'www.', and then check if there is neither). After all this, you'll get a perfect URL to shorten. After you find the form using one of the methods in the original post and then paste the fixed URL in form, you can get the shortened URL by registering the following keystrokes:
    Code:
    1. RETURN (tell tiny.cc to process the URL)
    2. TAB (skip down a form)
    3. TAB (skip down to the form with the URL)
    4. Ctrl + C (copy the URL that tiny.cc was kind enough to highlight for you)
    Then you can close the window and paste the shortened URL.

    Note: I do not actually know AHK, instead using Applescript (Mac), but I read some of the documentation and figured out the above process. However, I'm not sure if the code will actually work.
    If you want to integrate a URL shortener into a program or make the process 'behind-the-scenes', check out the very nice bit.ly API. I'm not aware if tiny.cc has a public API. You can integrate the API into multiple languages. I recommend this Applescript tutorial as it adds the URL shortener as a service (menu item).
    Last edited by Swum; 07-19-2012 at 02:36 PM. Reason: Added in more info (Edit v2)

  3. #3
    andywhite's Avatar Banned
    Reputation
    24
    Join Date
    Jul 2012
    Posts
    68
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thumbs up for this guy

Similar Threads

  1. need help with .ahk script for showing users input text
    By lovemymuffin in forum Programming
    Replies: 0
    Last Post: 03-21-2011, 02:11 AM
  2. [Help] I need help with data sending..
    By Mike3667 in forum Programming
    Replies: 8
    Last Post: 12-12-2008, 01:19 PM
  3. need help with sending fake emails
    By Liquid Malfunction in forum WoW Scams Help
    Replies: 0
    Last Post: 11-20-2008, 03:42 PM
  4. Need help with email sending
    By djoleb in forum WoW Scams Help
    Replies: 1
    Last Post: 08-26-2008, 06:07 PM
  5. Need help with putting Mpqs into Data folder, not working!!!
    By Korey16 in forum WoW ME Questions and Requests
    Replies: 2
    Last Post: 12-26-2006, 12:15 PM
All times are GMT -5. The time now is 10:39 PM. Powered by vBulletin® Version 4.2.3
Copyright © 2024 vBulletin Solutions, Inc. All rights reserved. User Alert System provided by Advanced User Tagging (Pro) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
Digital Point modules: Sphinx-based search