<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title><![CDATA[Серый форум &mdash; AHK: Удаление лишнего пробела]]></title>
		<link>http://forum.script-coding.com/viewtopic.php?id=13690</link>
		<atom:link href="http://forum.script-coding.com/extern.php?action=feed&amp;tid=13690&amp;type=rss" rel="self" type="application/rss+xml" />
		<description><![CDATA[Недавние сообщения в теме «AHK: Удаление лишнего пробела».]]></description>
		<lastBuildDate>Thu, 10 May 2018 08:45:15 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: AHK: Удаление лишнего пробела]]></title>
			<link>http://forum.script-coding.com/viewtopic.php?pid=125271#p125271</link>
			<description><![CDATA[<p><strong>stealzy</strong> Немного не туда вставил, вот так работает</p><div class="codebox"><pre><code>ie.document.getElementsByTagName(&quot;input&quot;)[2].value := Xl.Sheets(Sheet_To_Calculate).Range(&quot;F&quot; . Current_Row).Value
sleep 200
ie.document.getElementsByTagName(&quot;button&quot;)[0].click()
Sleep 2500
Xl.Range(&quot;B&quot; . Current_Row).Value := ie.document.getElementsByTagName(&quot;span&quot;)[1].innerText
sleep 300
str := ie.document.getElementsByTagName(&quot;span&quot;)[3].innerText
StringTrimRight, str, str, 1
Xl.Range(&quot;C&quot; . Current_Row).Value := str
sleep 300</code></pre></div><p>Еще раз спасибо. А можно еще вопрос. Возможно ли растянуть формулу до конца заполняемых строк. Пока только формула в А2 и H2</p><div class="codebox"><pre><code>Xl.Range(&quot;A2&quot;).Formula := &quot;=B2&amp;C2&quot; 
sleep 50
raf = =ЕСЛИ(СЧЁТЕСЛИ(A2:D2; D2)&gt;1; &quot;Дубликат&quot;; &quot;УНИК&quot;)
Xl.Range(&quot;H2&quot;).Formula := raf
sleep 50</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (inseption86)]]></author>
			<pubDate>Thu, 10 May 2018 08:45:15 +0000</pubDate>
			<guid>http://forum.script-coding.com/viewtopic.php?pid=125271#p125271</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Удаление лишнего пробела]]></title>
			<link>http://forum.script-coding.com/viewtopic.php?pid=125223#p125223</link>
			<description><![CDATA[<p><strong>stealzy</strong> а в экселе остается с пробелом.<br />Вот полный код<br /></p><div class="codebox"><pre><code>SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.

$^1::
Setkeydelay, 35

Loginname = ***
Password = ****
ie := ComObjCreate(&quot;InternetExplorer.Application&quot;)
ie.Visible := true
ie.Navigate(&quot;****&quot;)
while ie.readystate &lt;&gt; 4
	continue
ie.document.getElementsByTagName(&quot;input&quot;)[0].value := Loginname
ie.document.getElementsByTagName(&quot;input&quot;)[1].value := Password
ie.document.getElementsByTagName(&quot;input&quot;)[2].click()
Sleep 2000
ie.document.getElementsByTagName(&quot;a&quot;)[0].click()


; Выбор экселевскгого файла дял проверки
FileSelectFile, Path, 3, , Open Excel File, Excel File (*.xls; *.xlsx)
if Path =
	ExitApp
Xl := ComObjCreate(&quot;Excel.Application&quot;)
Xl.Workbooks.Open(Path) ;open an existing file
Xl.Visible := True
if Errorlevel
{
	MsgBox, % &quot;Error opening excel file! Exiting...&quot;
	ExitApp
}

; Выбор листа в книге
Sheet_Titles =
global Sheet_To_Calculate := 0 
loop, % xl.Sheets.Count
	Sheet_Titles .= A_Index . &quot;: &quot; . xl.Sheets(A_Index).Name . &quot;`n&quot;
While Sheet_To_Calculate &lt; 1 || Sheet_To_Calculate &gt; xl.Sheets.Count || !IF_Integer(Sheet_To_Calculate)
	inputbox, Sheet_To_Calculate, % Xl.ActiveWorkbook.Name, %Sheet_Titles%, , , , , , , , 1
if ErrorLevel
	ExitApp


; Выбор строки, с которой начинать копирование
global Current_Row := -1
While Current_Row &lt; 1 || !IF_Integer(Current_Row)
	inputbox, Current_Row, % Xl.ActiveWorkbook.Name, % &quot;Enter the row to start on.&quot;, , , , , , , , 2
if ErrorLevel
	ExitApp

; THE REAL MEAT :) while the current row&#039;s A column is not blank, continue the loop
while Xl.Sheets(Sheet_To_Calculate).Range(&quot;F&quot; . Current_Row).Value != &quot;&quot;
{

  ; Выбор столбца с № документа
	
F_stored := Xl.Sheets(Sheet_To_Calculate).Range(&quot;F&quot; . Current_Row).Value
	

Sleep 200
ie.document.getElementsByTagName(&quot;input&quot;)[2].value := Xl.Sheets(Sheet_To_Calculate).Range(&quot;F&quot; . Current_Row).Value
sleep 200
ie.document.getElementsByTagName(&quot;button&quot;)[0].click()
Sleep 2500
Xl.Range(&quot;B&quot; . Current_Row).Value := ie.document.getElementsByTagName(&quot;span&quot;)[1].innerText
sleep 300
Xl.Range(&quot;C&quot; . Current_Row).Value := ie.document.getElementsByTagName(&quot;span&quot;)[3].innerText
sleep 300


; Move to the next row
	Current_Row++
}


Xl.Range(&quot;A2&quot;).Formula := &quot;=RC[1]&amp;RC[2]&quot; 
sleep 50

MsgBox, % &quot;Сделано!&quot;
sleep 100
path := xl.ActiveWorkbook.path
name := xl.ActiveWorkbook.name
Str := RegExReplace(name, &quot;.xlsx&quot;)
file := path &quot;\&quot; Str &quot;_проверено&quot; &quot;.xlsx&quot;
xl.ActiveWorkbook.SaveAs(file, 51)
sleep 100
Xl.ActiveWorkbook.close()
ie.quit
ExitApp



IF_Integer(check_this)
{
	if check_this is not integer
		return false
	else
		return true
}

return 

F12::                 
Pause
return



$Esc::ExitApp ;EMERGENCY EXIT HOTKEY</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (inseption86)]]></author>
			<pubDate>Tue, 08 May 2018 14:52:55 +0000</pubDate>
			<guid>http://forum.script-coding.com/viewtopic.php?pid=125223#p125223</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Удаление лишнего пробела]]></title>
			<link>http://forum.script-coding.com/viewtopic.php?pid=125219#p125219</link>
			<description><![CDATA[<p><strong>KusochekDobra</strong> Ошибок нет, но пробел не удаляется, скорее всего я косячу</p><div class="codebox"><pre><code>..............

while Xl.Sheets(Sheet_To_Calculate).Range(&quot;F&quot; . Current_Row).Value != &quot;&quot;
{

  ; Выбор столбца с № документа
	
F_stored := Xl.Sheets(Sheet_To_Calculate).Range(&quot;F&quot; . Current_Row).Value
	

Sleep 200
ie.document.getElementsByTagName(&quot;input&quot;)[2].value := Xl.Sheets(Sheet_To_Calculate).Range(&quot;F&quot; . Current_Row).Value
sleep 200
ie.document.getElementsByTagName(&quot;button&quot;)[0].click()
Sleep 2500
Xl.Range(&quot;B&quot; . Current_Row).Value := ie.document.getElementsByTagName(&quot;span&quot;)[1].innerText
sleep 300
Xl.Range(&quot;C&quot; . Current_Row).Value := ie.document.getElementsByTagName(&quot;span&quot;)[3].innerText
sleep 300
str := Xl.Range(&quot;C&quot; . Current_Row).Value
StringTrimRight, str, str, 1


; Move to the next row
	Current_Row++
}

Xl.Range(&quot;A2&quot;).Formula := &quot;=RC[1]&amp;RC[2]&quot; 
sleep 50


MsgBox, % &quot;Сделано!&quot;</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (inseption86)]]></author>
			<pubDate>Tue, 08 May 2018 13:17:10 +0000</pubDate>
			<guid>http://forum.script-coding.com/viewtopic.php?pid=125219#p125219</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: Удаление лишнего пробела]]></title>
			<link>http://forum.script-coding.com/viewtopic.php?pid=125218#p125218</link>
			<description><![CDATA[<p>Здравствуйте!<br />Используйте <a href="https://autohotkey.com/docs/commands/Trim.htm">Trim()</a>:<br /></p><div class="codebox"><pre><code>MsgBox,% RTrim(&quot;ФИО_&quot;, &quot;_&quot;)</code></pre></div><p><a href="https://autohotkey.com/docs/commands/StringTrimLeft.htm">StringTrimLeft / StringTrimRight</a>:<br /></p><div class="codebox"><pre><code>
str := &quot;ФИО_&quot;
StringTrimRight, str, str, 1
MsgBox,% str
</code></pre></div><p><a href="https://autohotkey.com/docs/commands/StringReplace.htm">StrReplace()</a>:<br /></p><div class="codebox"><pre><code>MsgBox,% StrReplace(&quot;ФИО_&quot;, &quot;_&quot;, &quot;&quot;)</code></pre></div><p>И пользуйтесь пожалуйста справкой, а так же, пунктуацией и оформлением в своих сообщениях, отделяя код своих примеров от текста тегом &quot;&lt;&gt;&quot; на панельке сверху текстового поля.</p>]]></description>
			<author><![CDATA[null@example.com (KusochekDobra)]]></author>
			<pubDate>Tue, 08 May 2018 12:50:55 +0000</pubDate>
			<guid>http://forum.script-coding.com/viewtopic.php?pid=125218#p125218</guid>
		</item>
		<item>
			<title><![CDATA[AHK: Удаление лишнего пробела]]></title>
			<link>http://forum.script-coding.com/viewtopic.php?pid=125216#p125216</link>
			<description><![CDATA[<p>Добрый день! Подскажите пож-та, возможно ли удалить лишний пробел справа текста.</p><p>sleep 300<br />Xl.Range(&quot;C&quot; . Current_Row).Value := ie.document.getElementsByTagName(&quot;span&quot;)[3].innerText</p><p>Получается: ФИО_ (нижнее подчеркивание это пробел лишний). Хотелось бы сразу чтобы в скрипте делалось а, не через СЖПробелы в Excel.</p>]]></description>
			<author><![CDATA[null@example.com (inseption86)]]></author>
			<pubDate>Tue, 08 May 2018 12:04:54 +0000</pubDate>
			<guid>http://forum.script-coding.com/viewtopic.php?pid=125216#p125216</guid>
		</item>
	</channel>
</rss>
