 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
iniuria
Joined: 22 Feb 2010 Posts: 1
|
Posted: Tue Feb 23, 2010 6:13 pm Post subject: HTML Coding helper script |
|
|
Hi all, i'm quite surprised i can't find a script to automatize the scripting itself. I'm not a pro-coder but i play with html and i would like a script helping me doing something like the following (i'll show some example).
I have this text (in Notepad++ or in the browser)
| Code: | | http://site.com/this/is/an/example |
I would like to highlight it, pressing a hotkey and having something like
| Code: | | <a href="http://site.com/this/is/an/example" target="_blank">http://site.com/this/is/an/example</a> |
or
| Code: | | <a href="http://site.com/this/is/an/example" target="_blank">CLICK HERE</a> |
I *guess* it can be done someway, but i don't have a clue
Any help would be really appreciated, as it could save me a lot of time. Thanks in advance |
|
| Back to top |
|
 |
Leef_me
Joined: 08 Apr 2009 Posts: 5333 Location: San Diego, California
|
Posted: Tue Feb 23, 2010 7:07 pm Post subject: |
|
|
>>I *guess* it can be done someway, but i don't have a clue
Have you read and performed the examples in the tutorial ?
http://www.autohotkey.com/docs/Tutorial.htm
>>Any help would be really appreciated, as it could save me a lot of time.
try this demo,
place this code in an Ahk file and run it, if you see the message you did that correctly.
Open an empty file in Notepad++ and hit F1, then watch.
study the links to make sense of the script and modify it for your needs
| Code: |
Msgbox ,,,Hotkey F1 installed,2
return
F1::
Send This is a test.`nThis is only a test.
sleep, 1000
send ^a ; select all text
send ^x ; cut the text
sleep, 1000
send ^v ; paste the text
sleep, 1000
send ^x ; cut the text
sleep, 1000
send ^v ; paste the text
msgbox End of demo. `nPress OK to exit.
exitapp ; <---- add a semicolon to this line to keep the script loaded
return
|
http://www.autohotkey.com/docs/Hotkeys.htm
http://www.autohotkey.com/docs/commands/Send.htm
http://www.autohotkey.com/docs/commands/Sleep.htm
http://www.autohotkey.com/docs/commands/Return.htm
http://www.autohotkey.com/docs/misc/Clipboard.htm
http://www.autohotkey.com/docs/Variables.htm (from the top until Built-in Variables) |
|
| Back to top |
|
 |
Guest
|
Posted: Wed Feb 24, 2010 1:24 am Post subject: |
|
|
Ok, thanks for your help, my first example just worked perfectly with
| Code: |
send ^x
send <a href="^v" TARGET="_blank">^v</a> |
But now i'm experiencing another trouble, because i wante to try to use it also for BBCODE.
Example
| Code: | send ^x
send [QUOTE][CENTER][b][URL="^v"]Check ~ here[/URL][/b][/CENTER][/QUOTE] |
Raturns me
| Code: | | 'QUOTEì'CENTERì'bì'URL+°return°ìcheck ç here'ùURLì'ùbì'ùCENTERì'ùQUOTEì |
How can i avoid this? |
|
| Back to top |
|
 |
rtcvb32
Joined: 17 Feb 2008 Posts: 289
|
Posted: Wed Feb 24, 2010 3:20 am Post subject: |
|
|
| Anonymous wrote: | Ok, thanks for your help, my first example just worked perfectly with
| Code: |
send ^x
send <a href="^v" TARGET="_blank">^v</a> |
But now i'm experiencing another trouble, because i wante to try to use it also for BBCODE.
Example
| Code: | send ^x
send [QUOTE][CENTER][b][URL="^v"]Check ~ here[/URL][/b][/CENTER][/QUOTE] |
Raturns me
| Code: | | 'QUOTEì'CENTERì'bì'URL+°return°ìcheck ç here'ùURLì'ùbì'ùCENTERì'ùQUOTEì |
How can i avoid this? |
I don't see the unwanted output on my test. It's possible a key is being held that shouldn't (Like control). However you can do a copy/replace formatting instead to make sure it works.
| Code: |
;just my selection for testing
#c::
txt = [QUOTE][CENTER][b][URL="replace"]Check ~ here[/URL][/b][/CENTER][/QUOTE]
;copy and wait till clipboard is ready
clipboard =
send ^x
clipwait
;replace the word 'replace' with the clipboard contents.
stringreplace, txt, txt, replace, %clipboard%, All
;clear clipboard again and wait til it's ready
clipboard =
clipboard := txt
clipwait
;paste final output.
send ^v
|
|
|
| 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
|