<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Серый форум &mdash; AHK: Извлечь текст из чата Skype]]></title>
	<link rel="self" href="https://forum.script-coding.com/extern.php?action=feed&amp;tid=9334&amp;type=atom" />
	<updated>2014-03-10T12:40:29Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.script-coding.com/viewtopic.php?id=9334</id>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Извлечь текст из чата Skype]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=80651#p80651" />
			<content type="html"><![CDATA[<p>Огромное спасибо, то что нужно!</p>]]></content>
			<author>
				<name><![CDATA[Zanoza]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=26155</uri>
			</author>
			<updated>2014-03-10T12:40:29Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=80651#p80651</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Извлечь текст из чата Skype]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=80640#p80640" />
			<content type="html"><![CDATA[<p>У меня так работает:<br /></p><div class="codebox"><pre><code>ChatArray := GetChatArray()
/*
; Сообщения просматривать так:
for k, v in ChatArray
   MsgBox, % v
*/

MsgBox, % ChatArray[ChatArray.MaxIndex()]  ; последнее сообщение чата
return

GetChatArray()
{
   if !(hwnd := WinExist(&quot;ahk_class TConversationForm&quot;))
      ErrorExit(&quot;Окно чата не найдено&quot;)

   if !IsObject(AccSkype := Acc_ObjectFromWindow(hwnd))
      ErrorExit(&quot;Не удалось получить IAccessible из окна чата&quot;)
      
   if !IsObject(AccChat := GetAccChat(AccSkype))
      ErrorExit(&quot;Не удалось получить сообщения&quot;)

   Array := []
   for k, v in Acc_Children(AccChat)
      Array[A_Index] := v.accName(0)
   Return Array
}

GetAccChat(AccObj)
{
   if (AccObj.accName(0) = &quot;Содержимое чата&quot;)
      Return AccObj
   
   for k, v in Acc_Children(AccObj)
      if IsObject(obj := GetAccChat(v))
         Return obj
}

ErrorExit(message)
{
   MsgBox, % message
   ExitApp
}

Acc_Init()
{
   Static   h
   If Not   h
      h:=DllCall(&quot;LoadLibrary&quot;,&quot;Str&quot;,&quot;oleacc&quot;,&quot;Ptr&quot;)
}

Acc_ObjectFromWindow(hWnd, idObject = 0)
{
   Acc_Init()
   If   DllCall(&quot;oleacc\AccessibleObjectFromWindow&quot;, &quot;Ptr&quot;, hWnd, &quot;UInt&quot;, idObject&amp;=0xFFFFFFFF, &quot;Ptr&quot;, -VarSetCapacity(IID,16)+NumPut(idObject==0xFFFFFFF0?0x46000000000000C0:0x719B3800AA000C81,NumPut(idObject==0xFFFFFFF0?0x0000000000020400:0x11CF3C3D618736E0,IID,&quot;Int64&quot;),&quot;Int64&quot;), &quot;Ptr*&quot;, pacc)=0
   Return   ComObjEnwrap(9,pacc,1)
}

Acc_WindowFromObject(pacc)
{
   If   DllCall(&quot;oleacc\WindowFromAccessibleObject&quot;, &quot;Ptr&quot;, IsObject(pacc)?ComObjValue(pacc):pacc, &quot;Ptr*&quot;, hWnd)=0
   Return   hWnd
}

Acc_GetRoleText(nRole)
{
   nSize := DllCall(&quot;oleacc\GetRoleText&quot;, &quot;Uint&quot;, nRole, &quot;Ptr&quot;, 0, &quot;Uint&quot;, 0)
   VarSetCapacity(sRole, (A_IsUnicode?2:1)*nSize)
   DllCall(&quot;oleacc\GetRoleText&quot;, &quot;Uint&quot;, nRole, &quot;str&quot;, sRole, &quot;Uint&quot;, nSize+1)
   Return   sRole
}

Acc_GetStateText(nState)
{
   nSize := DllCall(&quot;oleacc\GetStateText&quot;, &quot;Uint&quot;, nState, &quot;Ptr&quot;, 0, &quot;Uint&quot;, 0)
   VarSetCapacity(sState, (A_IsUnicode?2:1)*nSize)
   DllCall(&quot;oleacc\GetStateText&quot;, &quot;Uint&quot;, nState, &quot;str&quot;, sState, &quot;Uint&quot;, nSize+1)
   Return   sState
}

; Written by jethrow
Acc_Role(Acc, ChildId=0) {
   try return ComObjType(Acc,&quot;Name&quot;)=&quot;IAccessible&quot;?Acc_GetRoleText(Acc.accRole(ChildId)):&quot;invalid object&quot;
}
Acc_State(Acc, ChildId=0) {
   try return ComObjType(Acc,&quot;Name&quot;)=&quot;IAccessible&quot;?Acc_GetStateText(Acc.accState(ChildId)):&quot;invalid object&quot;
}
Acc_Location(Acc, ChildId=0, byref Position=&quot;&quot;) { ; adapted from Sean&#039;s code
   try Acc.accLocation(ComObj(0x4003,&amp;x:=0), ComObj(0x4003,&amp;y:=0), ComObj(0x4003,&amp;w:=0), ComObj(0x4003,&amp;h:=0), ChildId)
   catch
      return
   Position := &quot;x&quot; NumGet(x,0,&quot;int&quot;) &quot; y&quot; NumGet(y,0,&quot;int&quot;) &quot; w&quot; NumGet(w,0,&quot;int&quot;) &quot; h&quot; NumGet(h,0,&quot;int&quot;)
   return   {x:NumGet(x,0,&quot;int&quot;), y:NumGet(y,0,&quot;int&quot;), w:NumGet(w,0,&quot;int&quot;), h:NumGet(h,0,&quot;int&quot;)}
}
Acc_Parent(Acc) { 
   try parent:=Acc.accParent
   return parent?Acc_Query(parent):
}
Acc_Child(Acc, ChildId=0) {
   try child:=Acc.accChild(ChildId)
   return child?Acc_Query(child):
}
Acc_Query(Acc) { ; thanks Lexikos - www.autohotkey.com/forum/viewtopic.php?t=81731&amp;p=509530#509530
   try return ComObj(9, ComObjQuery(Acc,&quot;{618736e0-3c3d-11cf-810c-00aa00389b71}&quot;), 1)
}
Acc_Error(p=&quot;&quot;) {
   static setting:=0
   return p=&quot;&quot;?setting:setting:=p
}
Acc_Children(Acc) {
   if ComObjType(Acc,&quot;Name&quot;) != &quot;IAccessible&quot;
      ErrorLevel := &quot;Invalid IAccessible Object&quot;
   else {
      Acc_Init(), cChildren:=Acc.accChildCount, Children:=[]
      if DllCall(&quot;oleacc\AccessibleChildren&quot;, &quot;Ptr&quot;,ComObjValue(Acc), &quot;Int&quot;,0, &quot;Int&quot;,cChildren, &quot;Ptr&quot;,VarSetCapacity(varChildren,cChildren*(8+2*A_PtrSize),0)*0+&amp;varChildren, &quot;Int*&quot;,cChildren)=0 {
         Loop %cChildren%
            i:=(A_Index-1)*(A_PtrSize*2+8)+8, child:=NumGet(varChildren,i), Children.Insert(NumGet(varChildren,i-8)=9?Acc_Query(child):child), NumGet(varChildren,i-8)=9?ObjRelease(child):
         return Children.MaxIndex()?Children:
      } else
         ErrorLevel := &quot;AccessibleChildren DllCall Failed&quot;
   }
   if Acc_Error()
      throw Exception(ErrorLevel,-1)
}</code></pre></div>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2014-03-09T23:06:06Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=80640#p80640</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Извлечь текст из чата Skype]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=80636#p80636" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>teadrinker пишет:</cite><blockquote><p><strong>Zanoza</strong>, текст из чата скайпа теоретически получить можно, если надо ещё, могу посмотреть.</p></blockquote></div><p>Да надо, пожалуйста если не трудно подскажите!</p>]]></content>
			<author>
				<name><![CDATA[Zanoza]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=26155</uri>
			</author>
			<updated>2014-03-09T21:27:29Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=80636#p80636</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Извлечь текст из чата Skype]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=80620#p80620" />
			<content type="html"><![CDATA[<p><strong>Zanoza</strong>, текст из чата скайпа теоретически получить можно, если надо ещё, могу посмотреть.</p>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2014-03-09T14:33:40Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=80620#p80620</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Извлечь текст из чата Skype]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=80596#p80596" />
			<content type="html"><![CDATA[<p>Если я правильно понял то нужно что б новое сообщение открывалось в табличке? Идея хорошая, но в скайпе есть же функция на подобии tooltip уведомление в трей приходит.</p>]]></content>
			<author>
				<name><![CDATA[BashkaMen]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=30800</uri>
			</author>
			<updated>2014-03-07T22:21:07Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=80596#p80596</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[AHK: Извлечь текст из чата Skype]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=80588#p80588" />
			<content type="html"><![CDATA[<p>Помогите пожалуйста, никак не получается извлечь&nbsp; текст чата&nbsp; со скайпа.<br />Пробовал вариант с WinGetText в окне<br /><span class="postimg"><img src="http://s6.hostingkartinok.com/uploads/images/2014/03/4069d7f44c8c4ed4efb88bfa1708f4c5.png" alt="http://s6.hostingkartinok.com/uploads/images/2014/03/4069d7f44c8c4ed4efb88bfa1708f4c5.png" /></span><br />Но получил только<br /><span class="postimg"><img src="http://s6.hostingkartinok.com/uploads/images/2014/03/6ed9ab20a28b16a811b9963af3dfa14b.png" alt="http://s6.hostingkartinok.com/uploads/images/2014/03/6ed9ab20a28b16a811b9963af3dfa14b.png" /></span><br />Я хотел сделать OSD информацию после поступления нового сообщения&nbsp; в чате (когда появляются новые сообщения), но увы не получается.<br />Помогите пожалуйста !</p>]]></content>
			<author>
				<name><![CDATA[Zanoza]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=26155</uri>
			</author>
			<updated>2014-03-07T12:55:00Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=80588#p80588</id>
		</entry>
</feed>
