Monarch-LFV

|
Posted: Sat Oct 04, 2025 16:00 Post subject: |
|
|
Orion9
На самом деле я уже давно реализовал это через WinScriptADV, но думал, что есть стандартное решение через плагин.
 Exiftool_Geolocation.vbs Code: | ' Script for WinScriptAdv content plugin
' На основе EXIF-данных о координатах показывает
' название города, области, страны и расстояние от центра
' ВАЖНО! Для работы необходима утилита Exiftool
on error resume next
Set WshShell = CreateObject("WScript.Shell")
Set FSO = CreateObject("Scripting.FileSystemObject")
tmp = WshShell.ExpandEnvironmentStrings("%temp%")
tcp = WshShell.ExpandEnvironmentStrings("%commander_path%")
fn = FSO.GetfileName(filename) ' Имя файла
GetTheParent = FSO.GetParentFolderName(filename)
Set fold= FSO.GetFolder(GetTheParent)
Parname=fold.name
Parsize=fold.size
If not FSO.FolderExists(tmp & "\_TC_Exiftool\") Then
FSO.createfolder tmp & "\_TC_Exiftool\"
End if
txtfile = tmp & "\_TC_Exiftool\~$" & Parname & "-" & Parsize & ".txt"
if not FSO.FileExists(txtfile) then
WshShell.run "cmd /c """"" & tcp & "\Plugins\wdx\ExifTool\exiftool.exe"" -charset filename=Cyrillic -api geolocation ""-geolocation city*"" ""-geolocation region*"" ""-geolocation country*"" ""-geolocation Distance*"" """ & GetTheParent & """>""" & txtfile & """", 0, True
end if
Set objStream = CreateObject("ADODB.Stream")
objStream.CharSet = "UTF-8"
objStream.Open
objStream.LoadFromFile txtfile
strData = objStream.ReadText()
objStream.Close
For Each F In Split(strData, vbNewLine)
if Instr(F, "====") and curFile<>"" then exit for
if Instr(F, fn) then curFile = fn
if Instr(F, "Geolocation City") and curFile<>"" then content2 = right(F, len(F)-34)
if Instr(F, "Geolocation Region") and curFile<>"" then content1 = right(F, len(F)-34)
if Instr(F, "Geolocation Country") and curFile<>"" then content = right(F, len(F)-34)
if Instr(F, "Geolocation Distance") and curFile<>"" then content3 = right(F, len(F)-34)
Next
If curFile = "" then FSO.deletefile(txtfile) |
Для ускорения загрузки я использовал метод геотегирования всей папки с фотографиями, поэтому код немного нелеп с точки зрения создания временного файла (в папке %Temp%). В скрипте нужно подправить путь до утилиты, у всех он разный.
В "options.ini" плагина WinscriptADV:
Code: | ActiveScripts=...|Exiftool_Geolocation|...
[Exiftool_Geolocation]
Script=Exiftool_Geolocation.vbs
content=Exiftool_Country
content1=Exiftool_Region
content2=Exiftool_City
content3=Exiftool_Distance
extensions=jpg|jpeg|jpe|heic|mov
FoldersPaths=1 |
Это я, кстати, обсуждаю в настоящее время на оф.форуме Гислера. Имеются предлжения от Flasher'a, но пока не рабочие. Будем надеяться, что здесь или там найдется решение. |
|