|   |   | 
| 
 | Установить свойство COMОбъекта "Shell.Application" | ☑ | ||
|---|---|---|---|---|
| 0
    
        Gross2023 10.07.23✎ 15:01 | 
        Получить свойства, как я понимаю, можно методом GetDetailsOf. А как установить(изменить) его?     | |||
| 1
    
        Gross2023 10.07.23✎ 15:13 | 
        Наверное, нужно использовать не Shell.Application, а другой объект. Только вот какой?     | |||
| 2
    
        lodger 10.07.23✎ 15:16 | 
        ну. э.
 GetDetailsOf в shell это свойства файлов и папок. косвенные. вот открой в Explorer папку, найди jpeg и предложи нам метод поменять ему размер? | |||
| 3
    
        Gross2023 10.07.23✎ 15:21 | 
        (2) Меня интересует свойство "Название"(не наименование, а название), которое во вкладке "Подробно". Его прямо там менять можно     | |||
| 4
    
        Gross2023 10.07.23✎ 15:28 | 
        Нашел нужное свойство, но вопрос теперь с кодировкой:
 Image = Новый COMОбъект("WIA.ImageFile"); Image.LoadFile(ПутьКФайлу); Если Image.Properties.Exists("ImageDescription") Тогда Image.Properties("ImageDescription").Value = "авркенк"; КонецЕсли; Проблема с кодировкой?? | |||
| 5
    
        Gross2023 10.07.23✎ 15:42 | 
        (4) Свойство ImageDescription появляется в коллекции только когда меняю вручную свойство "Название" в винде :(     | |||
| 6
    
        lodger 10.07.23✎ 15:56 | 
        а в лоб не пробовал без exist присвоить новое значение?
 Image.Properties("FormatID").Value = "твоя строка" | |||
| 7
    
        Gross2023 10.07.23✎ 16:01 | 
        (6) Exists, как я понял, это аналог 1С-овского "Свойство" для структуры (короче говоря проверка наличия свойства). Сейчас пробую, но, может, у кого-то уже есть опыт?     | |||
| 8
    
        Gross2023 10.07.23✎ 16:08 | 
        (6) Отказано в доступе     | |||
| 9
    
        lodger 10.07.23✎ 16:37 | 
        тогда надо использовать 2 объекта ИмейджФайл для наведения на конкретный экземпляр картинки в каталоге и ИмейджПроцесс для модификации
 '--------------------------------------------------------------------------------------- ' Procedure : WIA_SetExifPropety ' Author : Daniel Pineault, CARDA Consultants Inc. ' Website : http://www.cardaconsultants.com ' Purpose : Set an image's Exif metadata property value ' Currently only for Ascii properties ' Copyright : The following is release as Attribution-ShareAlike 4.0 International ' (CC BY-SA 4.0) - https://creativecommons.org/licenses/by-sa/4.0/ ' Req'd Refs: Late Binding version -> None required ' Early Binding version -> Microsoft Windows Image Acquisition Library vX.X ' ' Input Variables: ' ~~~~~~~~~~~~~~~~ ' sInitialImage : Fully qualified path and filename of the image file to set the Exif ' metadata property value ' lPropertyId : ID no of the Exif metadata property to set the value of ' vValue : Value to set ' sDestiationImage : Fully qualified path and filename if you wish to create a new image ' instead of overwriting the existing one ' ' Usage: ' ~~~~~~ ' Call WIA_SetExifPropety("C:\Temp\IMG01.jpg", 271, "CARDA Industries Inc.") ' Call WIA_SetExifPropety("C:\Temp\IMG01.jpg", 272, "cPhone V6.0", "C:\Temp\IMG01-modified.jpg") ' ' Revision History: ' Rev Date(yyyy-mm-dd) Description ' ************************************************************************************** ' 1 2022-02-10 Initial Public Release '--------------------------------------------------------------------------------------- Sub WIA_SetExifPropety(sInitialImage As String, lPropertyId As Long, vValue As Variant, Optional sDestiationImage As String) On Error GoTo Error_Handler #Const WIA_EarlyBind = False 'True => Early Binding / False => Late Binding #If WIA_EarlyBind = True Then 'Early Binding req: Microsoft Windows Image Acquisition Library vX.X Dim oIF As WIA.ImageFile Dim oIP As WIA.ImageProcess Set oIF = New WIA.ImageFile Set oIP = New WIA.ImageProcess #Else Dim oIF As Object Dim oIP As Object Const StringImagePropertyType = 1002 Set oIF = CreateObject("WIA.ImageFile") Set oIP = CreateObject("WIA.ImageProcess") #End If With oIP .Filters.Add (.FilterInfos("Exif").FilterID) .Filters(1).Properties("ID") = lPropertyId .Filters(1).Properties("Type") = StringImagePropertyType .Filters(1).Properties("Value") = vValue End With oIF.LoadFile sInitialImage Set oIF = oIP.Apply(oIF) If sDestiationImage <> "" Then 'New file specified If Len(Dir(sDestiationImage)) > 0 Then Kill sDestiationImage oIF.SaveFile sDestiationImage Else 'Overwrite original if no Dest. file specified Kill sInitialImage oIF.SaveFile sInitialImage End If Error_Handler_Exit: On Error Resume Next If Not oIP Is Nothing Then Set oIP = Nothing If Not oIF Is Nothing Then Set oIF = Nothing Exit Sub Error_Handler: MsgBox "The following error has occured" & vbCrLf & vbCrLf & _ "Error Number: " & Err.Number & vbCrLf & _ "Error Source: WIA_SetImageOrientation" & vbCrLf & _ "Error Description: " & Err.Description & _ Switch(Erl = 0, "", Erl <> 0, vbCrLf & "Line No: " & Erl) _ , vbOKOnly + vbCritical, "An Error has Occured!" Resume Error_Handler_Exit End Sub Examples Of Its Usage If you simply want to change a property and retain the same file name then you can do: Call WIA_SetExifPropety("C:\Temp\IMG01.jpg", 271, "CARDA Industries Inc.") If, on the other hand you wish to change a property value but save the modification as a different file, then you’d do: Call WIA_SetExifPropety("C:\Temp\IMG01.jpg", 272, "cPhone V6.0", "C:\Temp\IMG01-modified.jpg") | |||
| 10
    
        Gross2023 10.07.23✎ 16:48 | 
        (9) Попробую сейчас     | |||
| 11
    
        Gross2023 10.07.23✎ 16:55 | 
        (9) Тяжело читать. На языке 1с бы)     | |||
| 12
    
        Gross2023 10.07.23✎ 16:59 | 
        Кстати, в ImageProcess нет подходящих мне свойств. Жаль...     | |||
| 13
    
        Gross2023 10.07.23✎ 17:02 | 
        Может как-то через двоичные данные можно как-то поменять свойства картинки?     | |||
| 14
    
        lodger 10.07.23✎ 18:13 | 
        (13) если ты осилишь ковыряние в ДД
 https://its.1c.ru/db/metod8dev#content:5917:hdoc:jpeg то это превзойдет затраты на переваривание кода из (9) | |||
| 15
    
        Gross2023 11.07.23✎ 08:49 | 
        (14) Там опять описывается чтение при помощи ЧтениеДанных. Мне же нужно изменить свойства файла... может ЗаписьДанных?     | |||
| 16
    
        lodger 11.07.23✎ 10:15 | 
        (15) Запись, да.     | 
 
 | Форум | Правила | Описание | Объявления | Секции | Поиск | Книга знаний | Вики-миста |