AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

cRichEdit - Standard RichEdit control for AutoHotkey scripts
Goto page Previous  1, 2, 3, 4, 5, 6, 7, 8  Next
 
Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions
View previous topic :: View next topic  
Author Message
soggos



Joined: 27 Mar 2008
Posts: 129
Location: France

PostPosted: Sun Feb 01, 2009 6:41 pm    Post subject: Reply with quote

Smile Hello World,
Arrow cRichEdit - is very great, it's wonderfull Great Great Thank's

Q wrote:
once I have added this REDIT to my window I seem to be having difficulty resizing it.

How can you resize or move it once added to the window without destroying and recreating the window?




Exclamation me too !, i have tested with :
Code:

GuiControl , Move, ahk_id %REdit1%, X50 Y50 W400 H200   
; OR
GuiControl , Move, RichEdit20A,      X50 Y50 W400 H200   
; OR
GuiControl , Move, REdit1,          X50 Y50 W400 H200   
; OR
ControlMove , ahk_id %REdit1% , 50, 50, 400, 200,  ,

; OR>   DESTROY AND REMAKE BUT NO NO!
If (REdit1)
   {
  cRichEdit(ahk_id %REdit1%, "Destroy")
 
If A_OSVersion = WIN_95
  cGUI("1:Add:" . REparent1, REdit1, 50, 50, 400, 200, "RICHEDIT")
Else
  cGUI("1:Add:" . REparent1, REdit1, 50, 50, 400, 200, "RichEdit20A")
}

; don't Run!

But don't run!
Question ¿ AnyBody have a solution ?
_________________
with ahk, all is different!...<img>
Back to top
View user's profile Send private message Visit poster's website
_dmitry
Guest





PostPosted: Wed Feb 25, 2009 4:50 pm    Post subject: Reply with quote

Hello, soggos! It's your mistake:
Code:
ControlMove , ahk_id %REdit1% , 50, 50, 400, 200,  ,
That's right:
Code:
ControlMove,, 50, 50, 400, 200, ahk_id %REdit1%
Back to top
soggos



Joined: 27 Mar 2008
Posts: 129
Location: France

PostPosted: Sun Mar 01, 2009 12:46 am    Post subject: Reply with quote

Embarassed Arf...
Very Happy it's run now correctly !great thank's mister _dmitry

_________________
with ahk, all is different!...<img>
Back to top
View user's profile Send private message Visit poster's website
fatboy
Guest





PostPosted: Sun Apr 26, 2009 11:55 am    Post subject: corrupt! Reply with quote

thanks for the great script.

I've just seen this article.
http://www.delphidabbler.com/tips/57
It's about setrtf code to the richedit control.
I looked at your code-it was great- I was able to find getrtf funcion, but not setrtf function, and I'm pretty sure it's out of my league to make one.

So corrupt, please consider add the function.

Thanks
Back to top
Drugwash



Joined: 07 Sep 2008
Posts: 921
Location: Ploiesti, RO

PostPosted: Mon Apr 27, 2009 4:59 pm    Post subject: Reply with quote

Would've been better if it was C/C++ code, IMHO, but this one should do fine for whoever is into Delphi. Let's hope there will be an update - I personally am quite interested in manipulating rich text, especially the Unicode part.
Back to top
View user's profile Send private message Visit poster's website Yahoo Messenger
Possemaster



Joined: 18 Nov 2009
Posts: 20

PostPosted: Thu Nov 19, 2009 7:15 am    Post subject: GETTEXT or GetRTF Reply with quote

I have a Richtextfield in a AHK script, i open a rtf file into it... Works great.

But when i press GO in the GUI i want it to copy that RichText field into the clipboard with the fromatting.

And when i go to my external software with a richtext field i pres ctrl +v to paste it in.

If i use GetRTF it copies the rtf source code, and if i use GETTEXT it copies plain text.

And if i open the rtf file in wordpad and copy and paste into my external software it works OK.

How do i copy richtext into clipboard like windows.
Back to top
View user's profile Send private message
Joy2DWorld



Joined: 04 Dec 2006
Posts: 561
Location: Galil, Israel

PostPosted: Thu Nov 19, 2009 9:21 pm    Post subject: Reply with quote

search and find the setclipboard function [in these forums] and save the RTF to the clipboard as rtf...
_________________
Joyce Jamce
Back to top
View user's profile Send private message
samhnky



Joined: 29 Sep 2009
Posts: 75

PostPosted: Wed Nov 25, 2009 12:20 am    Post subject: Sorry to be a noob... Reply with quote

This script/function is going way over my head Embarassed Can someone give me an example code.

I'm working on a script that script that creates an email. The script copies data from Remedy and pastes it along with ready made text into the email. Presently I have to use send commands to turn the bold format on and off in Outlook as I paste the various parts of the email into it. I think this script might be able to allow me to simply paste the complete text in with one paste command and the propper places in the email already be bold... (like copying text from a webpage or from another word doc, into an email) Would it be possible to get some example code on how one would use this code with regular text and variables and only bold the variables, and then combine the bold variables and plain text into the clipboard...

Thanks in advance,
Sam
Back to top
View user's profile Send private message
rapidfox.rs



Joined: 20 Oct 2009
Posts: 9

PostPosted: Sat Nov 28, 2009 6:25 pm    Post subject: Thanks Reply with quote

really helpful release man - thanks
Back to top
View user's profile Send private message
#include!
Guest





PostPosted: Tue Jan 26, 2010 2:31 pm    Post subject: Reply with quote

flashkid wrote:
Is it possible to Highlight special words?

Example:
Code:
Var = 20 Minutes
cRichEdit(REdit1, "Highlight", Var, Red)
MsgBox, Highlighted!
Sleep 10000
cRichEdit(REdit1, "HighlightRemove", Var)
MsgBox, Removed!
Sleep 5000
cRichEdit(REdit1, "Highlight", Var, Red)
Var2 = Another Highlight
cRichEdit(REdit1, "Highlight", Var2, Green)


So that its shown as:
Code:
It's 20 Minutes past 18 o'clock.
This Line is Another Highlight in the text.


I have been wondering the same - anyone? :O
Back to top
majkinetor



Joined: 24 May 2006
Posts: 4511
Location: Belgrade

PostPosted: Tue Jan 26, 2010 3:35 pm    Post subject: Reply with quote

I think this module can't, but you could check RichEdit modules in Forms framework.


With FindText API you position cursor (or selection) on word you wont.

Then use SetCharFormat and its BackColor argument. When you find the word, you can select it and use WORD mode or SELECTION mode to color that word.

Then iterate to do so for each word you wont.
Also, if the scenario isn't dynamic, you can issue RTF data directly into the control. You can do that with corupts module also.

I might create sample that highlights search phrase for entire document when I find time.

You can also do that while control is scrolling so that words you supply are highlighted all the time (better to use HiEdit for that). Its not trivial programming tho.
_________________
Back to top
View user's profile Send private message
#include
Guest





PostPosted: Tue Jan 26, 2010 3:52 pm    Post subject: Reply with quote

majkinetor wrote:
I think this module can't, but you could check RichEdit modules in Forms framework.


With FindText API you position cursor (or selection) on word you wont.

Then use SetCharFormat and its BackColor argument. When you find the word, you can select it and use WORD mode or SELECTION mode to color that word.

Then iterate to do so for each word you wont.
Also, if the scenario isn't dynamic, you can issue RTF data directly into the control. You can do that with corupts module also.

I might create sample that highlights search phrase for entire document when I find time.

You can also do that while control is scrolling so that words you supply are highlighted all the time (better to use HiEdit for that). Its not trivial programming tho.


Can't that highlighting be automatic for known words - just like in editors =)
Back to top
dadepp



Joined: 12 Jun 2008
Posts: 25

PostPosted: Tue Jan 26, 2010 6:14 pm    Post subject: Reply with quote

#include wrote:
Can't that highlighting be automatic for known words - just like in editors =)

Well since I ventured down that road a while ago, maybe this is what you are looking for:
Problem with COM: Adapting a VB example to AHK

This works with any RichEdit, and works without needing to select a word to highlight it. I needed this for an error-log-console, and then I tried to implement syntax highlighting, like in editors: But even if the file is small, it takes way too long, since the keywords are numerous, and you have to check every word inside the richedit if it matches.
The next problem is, what to do if you change something (type a letter, which might complete a word to be matched, or move carret with mouse).
Better leave this to compiled dlls, like HiEdit or scite.
Back to top
View user's profile Send private message
majkinetor



Joined: 24 May 2006
Posts: 4511
Location: Belgrade

PostPosted: Wed Jan 27, 2010 7:48 pm    Post subject: Reply with quote

dadepp is right.

Your request is not easy to accomplish with acceptable speed even in compiled languages.

I recall some editor authors had to abandon RichEdit because it was very hard to achieve generally usable performance.
_________________
Back to top
View user's profile Send private message
Notice
Guest





PostPosted: Tue Nov 23, 2010 8:50 am    Post subject: I think this is necessary Reply with quote

I think that you forgot something here.
I was messing with this and it was missing a character, so I changed 1 small thing, only one of the variables _tmpSize was _tmpSize + 1, so I put the other as + 1 and it retrieved all of the text.

Code:
  Else If _action = GetText
  {
    VarSetCapacity(_tmp3, 20, 0)
    If (opt1)
      _tmp2 = 1200
    Else
      _tmp2 = 1252
    VarSetCapacity(_tmp1, 8, 0)
    NumPut(0, _tmp1, 0)
    NumPut(_tmp2, _tmp1, 4)
    _tmpSize := DllCall("user32.dll\SendMessage", "UInt", _ctrlID, "UInt", 0x45F, "UInt", &_tmp1, "UInt", "0")
    If (_tmpSize) {
      NumPut(_tmpSize, _tmp3, 0, "Int")   
      NumPut(_tmp2, _tmp3, 8, "Int")   
      VarSetCapacity(_tmp4, _tmpSize + 1, 0)
      DllCall("user32.dll\SendMessage", "UInt", _ctrlID, "UInt", 0x45E, "UInt", &_tmp3, "UInt", &_tmp4)
      VarSetCapacity(_tmp4, -1)
    }
  Return _tmp4
  }


Code:
      NumPut(_tmpSize + 1, _tmp3, 0, "Int")   
      NumPut(_tmp2, _tmp3, 8, "Int")   
      VarSetCapacity(_tmp4, _tmpSize + 1, 0)

cRichEdit.ahk
Version 0.09 beta
April 19, 2008
Back to top
Display posts from previous:   
Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions All times are GMT
Goto page Previous  1, 2, 3, 4, 5, 6, 7, 8  Next
Page 7 of 8

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group