<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Серый форум &mdash; AHK: Скопировать свойства файла, название и содержимое файла]]></title>
	<link rel="self" href="https://forum.script-coding.com/extern.php?action=feed&amp;tid=15177&amp;type=atom" />
	<updated>2020-02-10T21:16:44Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.script-coding.com/viewtopic.php?id=15177</id>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Скопировать свойства файла, название и содержимое файла]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=137785#p137785" />
			<content type="html"><![CDATA[<p>Во-первых, содержимое файла - это не свойство этого файла. Есть небольшой скрипт, который получает дату модификации, названия, и много другой информации любого типа файла под курсором мыши. Думаю, можно переделать для выделенных файлов. Есть еще функции для склеивания файлов в один: &quot;<a href="https://www.autohotkey.com/boards/viewtopic.php?f=6&amp;t=36270&amp;hilit=Text+File+Modified+Date">https://www.autohotkey.com/boards/viewt … ified+Date</a>&quot;.<br /></p><div class="codebox"><pre><code>#NoEnv

CoordMode, Mouse, Screen  ; Required when the active window is not the desktop
SetTimer, Timer, 10
Return

Timer:
   if (Icon := GetDesktopIconUnderMouse())
      ToolTip, % &quot;Icon Coordinates`nX: &quot; Icon.left &quot;`tY: &quot; Icon.top &quot;`nW: &quot; Icon.right - Icon.left &quot;`tH: &quot; Icon.bottom - Icon.top
               . &quot;`nName: &quot; Icon.name &quot;`nSize: &quot; (Icon.type = &quot;File folder&quot; ? GetFolderSize(A_Desktop &quot;\&quot; Icon.name) : Icon.size)
               . &quot;`nType: &quot; Icon.type &quot;`nDate modified: &quot; Icon.date
   else
      ToolTip
Return

Esc::
   ExitApp

; ===============================================================================================================================
; GetDesktopIconUnderMouse()
; Function:       Gets the desktop icon under the mouse. See the &quot;Return values&quot; section below for more information about the
;                 icon and associated file data retrieved.
; Parameters:     None
; Return values:  If there is an icon under the mouse, an associative array with the following keys:
;                 - left: the left position of the icon in screen coordinates
;                 - top: the top position of the icon in screen coordinates
;                 - right: the right position of the icon in screen coordinates
;                 - bottom: the bottom position of the icon in screen coordinates
;                 - name: the name of the file represented by the icon, e.g. New Text Document.txt
;                 - size: the size of the file represented by the icon, e.g. 1.72 KB. Note: this value is blank for folders
;                 - type: the type of the file represented by the icon, e.g. TXT File, JPEG image, File folder
;                 - date: the modified date of the file represented by the icon, e.g. 9/9/2016 10:39 AM
;                 Otherwise, a blank value
; Global vars:    None
; Dependencies:   None
; Tested with:    AHK 1.1.30.01 (A32/U32/U64)
; Tested on:      Win 7 (x64)
; Written by:     iPhilip
; ===============================================================================================================================

GetDesktopIconUnderMouse() {
   static MEM_COMMIT := 0x1000, MEM_RELEASE := 0x8000, PAGE_READWRITE := 0x04
        , PROCESS_VM_OPERATION := 0x0008, PROCESS_VM_READ := 0x0010
        , LVM_GETITEMCOUNT := 0x1004, LVM_GETITEMRECT := 0x100E
   
   Icon := &quot;&quot;
   MouseGetPos, x, y, hwnd
   if not (hwnd = WinExist(&quot;ahk_class Progman&quot;) || hwnd = WinExist(&quot;ahk_class WorkerW&quot;))
      Return
   ControlGet, hwnd, HWND, , SysListView321
   if not WinExist(&quot;ahk_id&quot; hwnd)
      Return
   WinGet, pid, PID
   if (hProcess := DllCall(&quot;OpenProcess&quot; , &quot;UInt&quot;, PROCESS_VM_OPERATION|PROCESS_VM_READ, &quot;Int&quot;,  false, &quot;UInt&quot;, pid)) {
      VarSetCapacity(iCoord, 16)
      SendMessage, %LVM_GETITEMCOUNT%, 0, 0
      Loop, %ErrorLevel% {
         pItemCoord := DllCall(&quot;VirtualAllocEx&quot;, &quot;Ptr&quot;, hProcess, &quot;Ptr&quot;, 0, &quot;UInt&quot;, 16, &quot;UInt&quot;, MEM_COMMIT, &quot;UInt&quot;, PAGE_READWRITE)
         SendMessage, %LVM_GETITEMRECT%, % A_Index-1, %pItemCoord%
         DllCall(&quot;ReadProcessMemory&quot;, &quot;Ptr&quot;, hProcess, &quot;Ptr&quot;, pItemCoord, &quot;Ptr&quot;, &amp;iCoord, &quot;UInt&quot;, 16, &quot;UInt&quot;, 0)
         DllCall(&quot;VirtualFreeEx&quot;, &quot;Ptr&quot;, hProcess, &quot;Ptr&quot;, pItemCoord, &quot;UInt&quot;, 0, &quot;UInt&quot;, MEM_RELEASE)
         left   := NumGet(iCoord,  0, &quot;Int&quot;)
         top    := NumGet(iCoord,  4, &quot;Int&quot;)
         right  := NumGet(iCoord,  8, &quot;Int&quot;)
         bottom := NumGet(iCoord, 12, &quot;Int&quot;)
         if (left &lt; x and x &lt; right and top &lt; y and y &lt; bottom) {
            ControlGet, list, List
            RegExMatch(StrSplit(list, &quot;`n&quot;)[A_Index], &quot;O)(.*)\t(.*)\t(.*)\t(.*)&quot;, Match)
            Icon := {left:left, top:top, right:right, bottom:bottom
                   , name:Match[1], size:Match[2], type:Match[3]
                     ; Delete extraneous date characters (https://goo.gl/pMw6AM):
                     ; - Unicode LTR (Left-to-Right) mark (0x200E = 8206)
                     ; - Unicode RTL (Right-to-Left) mark (0x200F = 8207)
                   , date:RegExReplace(Match[4], A_IsUnicode ? &quot;[\x{200E}-\x{200F}]&quot; : &quot;\?&quot;)}
            Break
         }
      }
      DllCall(&quot;CloseHandle&quot;, &quot;Ptr&quot;, hProcess)
   }
   Return Icon
}

; This function returns the total size of the specified folder
; in the same format used when selecting an icon on the desktop,
; e.g. 438 bytes, 1022 bytes, 1.72 KB, 666 KB, 15.6 MB.

GetFolderSize(Folder) {
   static Units := [&quot;bytes&quot;,&quot;KB&quot;,&quot;MB&quot;,&quot;GB&quot;]
        , objFSO := ComObjCreate(&quot;Scripting.FileSystemObject&quot;)
   
   Size := objFSO.GetFolder(Folder).Size
   Index := 1
   while (Size &gt;= 1024) {
      Size /= 1024.
      Index++
   }
   N := StrLen(Round(Size))
   N := N &lt; 3 ? 4 : N
   Return SubStr(Size, 1, N) &quot; &quot; Units[Index]
}</code></pre></div>]]></content>
			<author>
				<name><![CDATA[svoboden]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=34280</uri>
			</author>
			<updated>2020-02-10T21:16:44Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=137785#p137785</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Скопировать свойства файла, название и содержимое файла]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=137782#p137782" />
			<content type="html"><![CDATA[<p>Разбейте задачу на составляющие. Ту часть, которая понятна, делаете сами, что непонятно — сначала ищете поиском на форуме, потом спрашиваете.</p>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2020-02-10T14:15:51Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=137782#p137782</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Скопировать свойства файла, название и содержимое файла]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=137781#p137781" />
			<content type="html"><![CDATA[<p>Спасибо за обратную связь. Не думал что это так выглядит. Наоборот хотел очень коротко написать, без воды.</p><p>Я хотел узнать у знающих людей, куда копать?<br />А может у кого-то уже была такая проблема и уже есть готовое решение по копированию свойств у выделенного файла.</p>]]></content>
			<author>
				<name><![CDATA[AHK_on]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=34680</uri>
			</author>
			<updated>2020-02-10T14:12:21Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=137781#p137781</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: Скопировать свойства файла, название и содержимое файла]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=137780#p137780" />
			<content type="html"><![CDATA[<p><strong>AHK_on</strong>, если пишете ТЗ, размещайте сразу в Коммерческий раздел. <img src="//forum.script-coding.com/img/smilies/smile.png" width="15" height="15" /></p>]]></content>
			<author>
				<name><![CDATA[teadrinker]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=24515</uri>
			</author>
			<updated>2020-02-10T14:07:43Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=137780#p137780</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[AHK: Скопировать свойства файла, название и содержимое файла]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=137771#p137771" />
			<content type="html"><![CDATA[<p>Доброго времени суток!<br />Нужна помощь!</p><p>Алгоритм действий который хочу автоматизировать:<br />Вручную выделяю мышкой текстовый файл (.txt .odt)<br />Копировать в буфер обмена:<br />- Дату изменения,<br />- Название файла,<br />- Содержимое файла.<br />Дальше я ставляю полученный массив данных в текстовое поле текстового редактора.</p><p>У меня есть текстовые файлы. Я хочу скопировать их в один единый текстовый файл с датой модификации с сортировкой от поздней к ранней.</p>]]></content>
			<author>
				<name><![CDATA[AHK_on]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=34680</uri>
			</author>
			<updated>2020-02-10T10:52:47Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=137771#p137771</id>
		</entry>
</feed>
