Welcome Guest.   Make a donation to an author on the site April 17, 2014, 04:28:30 PM  *

Please login or register.
Or did you miss your validation email?


Login with username and password (forgot your password?)
Why not become a lifetime supporting member of the site with a one-time donation of any amount? Your donation entitles you to a ton of additional benefits, including access to exclusive discounts and downloads, the ability to enter monthly free software drawings, and a single non-expiring license key for all of our programs.


You must sign up here before you can post and access some areas of the site. Registration is totally free and confidential.
 
The N.A.N.Y. Challenge 2011! Download 30+ custom programs!
   
   Forum Home   Thread Marks Chat! Downloads Search Login Register  
Pages: [1]   Go Down
  Reply  |  New Topic  |  Print  
Author Topic: DONE: ahk Find and Replace  (Read 3706 times)
DougleBug
Supporting Member
**
Posts: 4

View Profile Give some DonationCredits to this forum member
« on: April 10, 2012, 06:42:45 AM »

Hello All,

I need some help with ahk, I'm at the 'Hello World' stage and a bit lost with this.

Hoping to press a short-cut and ahk will find @1 and replace it with what is in my clip board.

I think the command is StringReplace but not sure on how to code it.

Any help would be greatly appreciated.

Thank you, Doug.
Logged
skwire
Moderator
*****
Posts: 3,897



Another Coding Snack request? Om nom nom...

see users location on a map View Profile WWW Give some DonationCredits to this forum member
« Reply #1 on: April 10, 2012, 07:53:02 AM »

Hello, DougleBug, and welcome to the site.

ahk will find @1

Can you explain this in more detail?  Find "@1" where/how, exactly?
Logged

DougleBug
Supporting Member
**
Posts: 4

View Profile Give some DonationCredits to this forum member
« Reply #2 on: April 10, 2012, 08:03:32 AM »

Hi skwire,

Working in Chrome find @1 (or something unique) within a text field, and replacing it with what is in your clip-board.

Thanks,
Logged
skwire
Moderator
*****
Posts: 3,897



Another Coding Snack request? Om nom nom...

see users location on a map View Profile WWW Give some DonationCredits to this forum member
« Reply #3 on: April 10, 2012, 08:10:41 AM »

Working in Chrome find @1 (or something unique) within a text field, and replacing it with what is in your clip-board.

Right, I understand that.  What I need to know is how are you determining the text to be searched through?  AHK doesn't just "know" which text you want searched through.  Do you have this text selected/highlighted or something like that?
Logged

DougleBug
Supporting Member
**
Posts: 4

View Profile Give some DonationCredits to this forum member
« Reply #4 on: April 10, 2012, 08:22:05 AM »

Just the web page really, but I could select the text.

A bit like this Quick Reply box, press one key to chance 'text' for example in to what you have copied.

Edit: before posting, while still editable.
« Last Edit: April 10, 2012, 08:27:21 AM by DougleBug » Logged
skwire
Moderator
*****
Posts: 3,897



Another Coding Snack request? Om nom nom...

see users location on a map View Profile WWW Give some DonationCredits to this forum member
« Reply #5 on: April 10, 2012, 09:04:52 AM »

Consider the following example:

Formatted for Autohotkey with the GeSHI Syntax Highlighter [copy or print]
  1. ^1:: ; Ctrl+1
  2. {
  3.    mySavedClip := Clipboard
  4.    Clipboard := "" ; Flush the clipboard
  5.    SendInput, ^c
  6.    ClipWait, 2
  7.    StringReplace, Clipboard, Clipboard, @1, % mySavedClip, All
  8. }

Because programmatically getting text from a browser is an exercise in frustration, you must first highlight the text you want searched through and then press the Ctrl+1 hotkey.  After doing that, any occurrences of @1 will be replaced with what was originally on your clipboard and then the new text is put back on the clipboard.
Logged

DougleBug
Supporting Member
**
Posts: 4

View Profile Give some DonationCredits to this forum member
« Reply #6 on: April 10, 2012, 09:19:07 AM »

Wow that works bob on, thank you very much for you help in this.

This is just what I was after, Doug.
Logged
skwire
Moderator
*****
Posts: 3,897



Another Coding Snack request? Om nom nom...

see users location on a map View Profile WWW Give some DonationCredits to this forum member
« Reply #7 on: April 10, 2012, 09:21:26 AM »

You're welcome.  I'm glad to hear it works for you.   Thmbsup
Logged

Pages: [1]   Go Up
  Reply  |  New Topic  |  Print  
 
Jump to:  
   Forum Home   Thread Marks Chat! Downloads Search Login Register  

DonationCoder.com | About Us
DonationCoder.com Forum | Powered by SMF
[ Page time: 0.045s | Server load: 0.14 ]