 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
BradleyS
Joined: 20 Sep 2005 Posts: 100
|
Posted: Tue Apr 08, 2008 1:35 pm Post subject: Copy from Clipboard |
|
|
I wonder if somebody could help me here please.
I'm trying to get all of an address off of a web page that is currently written as follows:
The House Name
The Street
The Locality
The Town
The Postcode
Tel No: 12345 67890
Into windows notepad but written as:
The House Name, The Street, The Locality, The Town, The Postcode, Tel No: 12345 67890
i.e. all in a single line and removing any spaces, as is between the postcode and tel no.
I have tried using:
StringReplace, Clipboard, Clipboard, `r`n, `n, All
but it doesn't seem to work, it just copies it straight off the clipboard
Full code:
| Code: | Insert::
Clipboard =
SendInput ^c
ClipWait, 1 , 1
if ErrorLevel <> 0
{
MsgBox, 4160, Error Message, No text has been selected!
return
}
StringReplace, Clipboard, Clipboard, `r`n, `n, All
StringReplace, Clipboard, Clipboard, Show Map,, All
Loop, Parse, Clipboard, `n, `r
{
If !A_LoopField
Continue
Else
Clipboard2 .= A_LoopField . "`n"
}
WinActivate, Untitled - Notepad
ifWinExist, Untitled - Notepad
Sleep, 200
SendInput `r%Clipboard%
Sleep, 500
Clipboard =
return
|
|
|
| Back to top |
|
 |
Razlin
Joined: 05 Nov 2007 Posts: 434 Location: canada
|
Posted: Tue Apr 08, 2008 1:53 pm Post subject: |
|
|
| Code: | StringReplace, Clipboard, Clipboard, `r`n, `n, All
;should be
StringReplace, Clipboard, Clipboard, `r`n, %A_SPACE%, All |
Replace `r`n return and newline with A space.
hope this helps _________________ -=Raz=- |
|
| Back to top |
|
 |
BradleyS
Joined: 20 Sep 2005 Posts: 100
|
Posted: Tue Apr 08, 2008 9:08 pm Post subject: |
|
|
That did the trick thank you.
However, how difficult would it be to include a comma after each paragraph return? so that it looks like:
The House Name, The Street, The Locality, The Town, The Postcode, Tel No: 12345 67890
Instead of:
The House Name The Street The Locality The Town The Postcode Tel No: 12345 67890
...or am I asking to much of AHK?
I'm not really quite sure how to start to tackle it either. |
|
| Back to top |
|
 |
silveredge78
Joined: 25 Jul 2006 Posts: 387 Location: Midwest, USA
|
Posted: Tue Apr 08, 2008 9:48 pm Post subject: |
|
|
Instead of
| Code: | | StringReplace, Clipboard, Clipboard, `r`n, %A_SPACE%, All |
Try:
| Code: | | StringReplace, Clipboard, Clipboard, `r`n, `,%A_SPACE%, All |
Not tested. _________________ SilverEdge78 |
|
| Back to top |
|
 |
BradleyS
Joined: 20 Sep 2005 Posts: 100
|
Posted: Tue Apr 08, 2008 11:11 pm Post subject: |
|
|
That will do me.
Thank you both very much |
|
| Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|