Text aus Outlook kopieren?

Stelle Fragen zur Programmierung mit Autohotkey

Moderator: jNizM

Lacky1982
Posts: 6
Joined: 11 Oct 2019, 01:24

Text aus Outlook kopieren?

17 Oct 2019, 09:04

Hallo, ist es Möglich aus einem MS Outlook Email Nachricht den Nachrichten Text zu kopieren?

Auszug aus Spy Window
xxx xxx - Nachricht (HTML)
ahk_class rctrl_renwnd32
ahk_exe OUTLOOK.EXE^

ClassNN: _WwG1
Text: Nachricht
Color: FFFFFF (Red=FF Green=FF Blue=FF)
x: 9 y: 448 w: 1442 h: 377
Client: x: 8 y: 447 w: 1442 h: 377
Kobaltauge
Posts: 264
Joined: 09 Mar 2019, 01:52
Location: Germany
Contact:

Re: Text aus Outlook kopieren?

17 Oct 2019, 15:19

Ich verstehe das nicht. Normalerweise sollte es so gehen.

Code: Select all

DetectHiddenWindows, On
ControlGetText, OutputVar, _WwG1, ahk_class rctrl_renwnd32
MsgBox % OutputVar
Aber ich bekomme bei mir auch nur "Nachricht" heraus. Bei der Betreffzeile funktioniert es.

Code: Select all

ControlGetText, OutputVar, RichEdit20WPT4, ahk_class rctrl_renwnd32
Ich tippe, es liegt an dem Editor, den Outlook im Hintergrund verwendet. Ich kann mir vorstellen, dass das Word ist. Aber das ist nur eine Vermutung.
Also den harten Weg. Wir kennen den Control. Aktivieren diesen und machen ein banales alles markieren und kopieren.

Code: Select all

ControlClick, _WwG1, ahk_class rctrl_renwnd32
Send, ^a
send, ^c

MsgBox % Clipboard
Lacky1982
Posts: 6
Joined: 11 Oct 2019, 01:24

Re: Text aus Outlook kopieren?

18 Oct 2019, 00:10

Danke es funktioniert nur die letzte Lösung!
Ahk_fan
Posts: 237
Joined: 31 Aug 2018, 14:34
Contact:

Re: Text aus Outlook kopieren?

18 Oct 2019, 05:25

noch ne möglichkeit
- Email vorher öffnen

Code: Select all

ComObjError(false)   ;disable COM error messages for some non available properties
m := ComObjActive("Outlook.Application")
try
		olItem := m.ActiveWindow.CurrentItem
	catch
		olItem := m.ActiveExplorer.Selection.Item(1)
	if (olItem.Class = 43)
		olMailItem := olItem
	else
	{
		MsgBox Es wurde keine Email gewählt
		return
	}
	MyTextBetreffAlt := olMailItem.Subject
	MyTextBodyAltHTML := olMailItem.HTMLBody
	MyTextBodyAlt := olMailItem.Body
	msgbox, HTML: `n%MyTextBodyAltHTML % 
	msgbox, Plantext: `n%MyTextBodyAlt% 
return
regards,
AHK_fan :)
https://hr-anwendungen.de
Kobaltauge
Posts: 264
Joined: 09 Mar 2019, 01:52
Location: Germany
Contact:

Re: Text aus Outlook kopieren?

18 Oct 2019, 11:06

Über Com anstatt controls. Nice. Gute Idee.
KHA
Posts: 403
Joined: 21 Aug 2018, 11:11

Re: Text aus Outlook kopieren?

18 Oct 2019, 11:17

@ahk_fan beim start bekomme ich ein Fehlermeldung: da ist ein Leerzeichen zu viel
msgbox, HTML: `n%MyTextBodyAltHTML%
Ahk_fan
Posts: 237
Joined: 31 Aug 2018, 14:34
Contact:

Re: Text aus Outlook kopieren?

19 Oct 2019, 06:43

:crazy: @KHA das Kopieren ist der Feind des Denkens!
Hab schnell ne einen Bereich aus meinem Prog kopiert, umgeschrieben und zack! Fehler!
so ist es richtig:

Code: Select all

ComObjError(false)   ;disable COM error messages for some non available properties
m := ComObjActive("Outlook.Application")
try
		olItem := m.ActiveWindow.CurrentItem
	catch
		olItem := m.ActiveExplorer.Selection.Item(1)
	if (olItem.Class = 43)
		olMailItem := olItem
	else
	{
		MsgBox Es wurde keine Email gewählt
		return
	}
	MyTextBetreffAlt := olMailItem.Subject
	MyTextBodyAltHTML := olMailItem.HTMLBody
	MyTextBodyAlt := olMailItem.Body
	msgbox, HTML: `n%MyTextBodyAltHTML% 
	msgbox, Plantext: `n%MyTextBodyAlt% 
return
regards,
AHK_fan :)
https://hr-anwendungen.de

Return to “Ich brauche Hilfe”

Who is online

Users browsing this forum: No registered users and 37 guests