<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Серый форум &mdash; AHK:Поиск определенного слова в *.docx]]></title>
	<link rel="self" href="https://forum.script-coding.com/extern.php?action=feed&amp;tid=14818&amp;type=atom" />
	<updated>2019-06-05T19:49:22Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.script-coding.com/viewtopic.php?id=14818</id>
		<entry>
			<title type="html"><![CDATA[Re: AHK:Поиск определенного слова в *.docx]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=134629#p134629" />
			<content type="html"><![CDATA[<p><strong>sega.83</strong></p><br /><div class="codebox"><pre><code>#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.
#SingleInstance force   ; игнор уже запущенного скрипта, переоткрытие


Path = % A_Desktop &quot;\Документ Microsoft Word.docx&quot;

oWord := ComObjCreate(&quot;Word.Application&quot;)
oWord.Visible := true
oWord.Documents.Open(Path)


slovo := &quot;Диагноз&quot;
zamena := &quot;Неизлечим&quot;


FindAndReplace( oWord, slovo, zamena)

FindAndReplace( obj, search, replace )
{
	obj.Selection.Find.ClearFormatting
	obj.Selection.Find.Replacement.ClearFormatting
	obj.Selection.Find.Execute( search, 0, 0, 0, 0, 0, 1, 1, 0, replace, 2)
}


oWord.ActiveDocument.Save
oWord.ActiveDocument.close
oWord.quit</code></pre></div>]]></content>
			<author>
				<name><![CDATA[inseption86]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=38818</uri>
			</author>
			<updated>2019-06-05T19:49:22Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=134629#p134629</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK:Поиск определенного слова в *.docx]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=134628#p134628" />
			<content type="html"><![CDATA[<p>Читайте про объектную модель ворда.</p>]]></content>
			<author>
				<name><![CDATA[Malcev]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=26930</uri>
			</author>
			<updated>2019-06-05T16:52:38Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=134628#p134628</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[AHK:Поиск определенного слова в *.docx]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=134627#p134627" />
			<content type="html"><![CDATA[<p>Подскажите пожалуйста команду для поиска определенного слова в документе Word?<br />Имеется открытый документ Word, который подвергается редактированию.<br />Необходимо в тексте найти слово &quot;Диагноз&quot; и сделать по нему щелчок мышью.<br />Стандартный Word-овский поиск не подходит, так как таких слов в документе нужно найти множество.</p><p>Пока нашел только такой выход с поиском картинки, но это не самый лучший способ так как документ может масштабироваться и в этом случае поиск по картинке происходит не корректно.<br /></p><div class="codebox"><pre><code>F3::
Macro1:
CoordMode, Pixel, Window
ImageSearch, FoundX, FoundY, 520, 420, 800, 800, Диагноз.png
If ErrorLevel = 0
	Click, %FoundX%, %FoundY% Left, 1
If ErrorLevel
	Loop, 2
		SoundBeep
Return
</code></pre></div>]]></content>
			<author>
				<name><![CDATA[sega.83]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=40132</uri>
			</author>
			<updated>2019-06-05T16:32:17Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=134627#p134627</id>
		</entry>
</feed>
