AutoHotkey Community

It is currently May 26th, 2012, 7:25 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 6 posts ] 
Author Message
PostPosted: May 1st, 2009, 9:25 pm 
Offline

Joined: April 20th, 2009, 11:42 pm
Posts: 5
Hi, I am trying to use a simple script of the form

Code:
f12::
{
clipboard= <html>
Send ^v
}


to paste some html I use repetitively. The problem is that the symbols in the html (equal signs, quotes, etc) are 'mistaken' by ahk for code rather than raw text.

How can I get it to put this kind of stuff in the clipboard without freaking out?
Thanks!


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 1st, 2009, 9:33 pm 
Offline
User avatar

Joined: November 2nd, 2008, 4:23 pm
Posts: 2906
Location: 127.0.0.1
Give an example of when it freaks out. Paste some example code. It shouldn't do that and I have never seen it do anything like that. Also there are better ways to do the paste. Maybe a function would be better:
Code:
F12 := Paste("<html>")

Paste(Text) {
ClipboardBack := Clipboard
ClipBoard =
Clipboard := Text
ClipWait, 1
Send, ^v
Clipboard := ClipboardBack
Return
}

_________________
aboutscriptappsscripts
Any code ⇈ above ⇈ requires AutoHotkey_L to run


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 1st, 2009, 9:46 pm 
Offline

Joined: April 20th, 2009, 11:42 pm
Posts: 5
Well, it thinks that the symbols in the html are part of the code. I just tested it with some source code from here and the error says that there is a missing ')' even though one is there.

I tried using your code as well, like this:

Code:
f12 := Paste("<link rel="prev" href="viewtopic.php?t=43831&amp;view=previous" title="View previous topic" /><link rel="next" href="viewtopic.php?t=43831&amp;view=next" title="View next topic" /><link rel="up" href="vi")

Paste(Text) {
ClipboardBack := Clipboard
ClipBoard =
Clipboard := Text
ClipWait, 1
Send, ^v
Clipboard := ClipboardBack
Return
}


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 1st, 2009, 10:01 pm 
Offline
User avatar

Joined: November 2nd, 2008, 4:23 pm
Posts: 2906
Location: 127.0.0.1
You just have to put two double quotes to make one literal quote:
Code:
Msgbox % "This is a ""Test"""

Displays: This is a "Test"

_________________
aboutscriptappsscripts
Any code ⇈ above ⇈ requires AutoHotkey_L to run


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 4th, 2009, 12:03 pm 
Offline

Joined: March 23rd, 2005, 7:53 am
Posts: 321
Location: Germany
Why not use SendRaw instad of send?

_________________
Hasso

Programmers don't die, they GOSUB without RETURN


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 4th, 2009, 8:09 pm 
Quote:
Why not use SendRaw instad of send?


sendraw doesn't help for a variable assignment like

Code:
clipboard := "this is some text that has quotation marks and stuff in it"
send, ^v


That's why Frankie's approach is the way to go.


Report this post
Top
  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: Google Feedfetcher, joetazz, krajan, over21, RaptorX, rbrtryn, SKAN and 73 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group