Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Re: DsoFile and Adobe Acrobat files

48 views
Skip to first unread message

Paul Randall

unread,
Aug 20, 2007, 11:28:54 AM8/20/07
to

"Marceepoo" <36c53a08-...@news.postalias> wrote in message
news:9EADAD37-E963-4805...@microsoft.com...
> When I run the script below, I get the following error message:
> Line: 36
> char: 4
> Error: Permission denied
> Code: 800A0046
> Source: Microsoft VBScript runtime error
>
> But none of the files n the folder ("E:\Test01") are write-protected.
> Does anyone have any ideas why the script "thinks" the files are write
> protected, and/or how I acn make this script work?
>
> Thanks in advance for your Time, thought And energy. It's much
> appreciated.
>
> Marceepoo
>
> Here's the script....
>
> sFolder2Search = "E:\Test01"
>
> Dim fso, f, f1, fc, sFileNam
> Set fso = CreateObject("Scripting.FileSystemObject")
> Set oScriptFulNam = FSO.GetFile(WScript.ScriptFullName)
>
> Set f = fso.GetFolder(sFolder2Search)
> Set fc = f.Files
> For Each f1 in fc
> sFileNam = f1.Name
> iFileTriage = 0
> i = 0
> Do While i < 3
> i = i + 1
> If i = 1 Then
> If Lcase(Right(sFileNam, 3)) <> Lcase("pdf") Then
> Exit Do
> End If
> ElseIf i = 2 Then
> Set objFile = CreateObject("DSOFile.OleDocumentProperties")
> sFilWhozAttributsToAlter = f1.Path
> objFile.Open(sFilWhozAttributsToAlter)
>
> Set oFSO = CreateObject("Scripting.FileSystemObject")
> Set oFile = oFSO.GetFile(sFilWhozAttributsToAlter)
>
> sDateCreated = oFile.DateCreated
> sDateLastModified = oFile.DateLastModified
> sSumPropName = oFSO.GetFileName(sFilWhozAttributsToAlter)
>
> sSumPropCategory = sDateLastModified
> sSumPropTitle = sSumPropName
>
> objFile.SummaryProperties.Author = sSumPropTitle
> objFile.SummaryProperties.Comments = sDateLastModified
> objFile.Save
> End If
> Loop
> Next
> wscript.echo "All done"

Help us help you.
Posting the entire script is helpful. You tell us the line number, but
force us to count to line 36 while hoping we notice every line that might be
line-wrapped, thus changing the count. Why not tell us the text of the line
in which the error occurred?

In any case, you are using the Office DSOFile.OleDocumentProperties object's
Open method with no arguments. I can't find the object model for this
object, but I assume you have looked at it. When opened this way does the
object allow both read and write access to the file?

-Paul Randall


Marceepoo

unread,
Aug 20, 2007, 3:58:06 PM8/20/07
to
Thanks. I spent a couple of hours tracking down and downloading material
that might have the dso object model. Thanks for focusing my energy where I
should have been putting it.

Thanks also for letting me know that I should have included info (besides
the lne no) identifying the offending line. I'll do that in the future. It
seems so obvious in retrospect.

Oh well. Live & learn.
Marc

Reventlov

unread,
Aug 26, 2007, 5:26:30 AM8/26/07
to
Il giorno Mon, 20 Aug 2007 12:58:06 -0700, =?Utf-8?B?TWFyY2VlcG9v?=
<36c53a08-...@news.postalias> ha scritto:

>Thanks. I spent a couple of hours tracking down and downloading material
>that might have the dso object model. Thanks for focusing my energy where I
>should have been putting it.

Do you have good links about the dso object model?
Thank you.
Giovanni.
--
Giovanni Cenati (Aosta, Italy)
Write to user "Reventlov" and domain at katamail com
http://digilander.libero.it/Cenati (Esempi e programmi in VbScript)
--

Reventlov

unread,
Aug 26, 2007, 5:26:33 AM8/26/07
to
Il giorno Mon, 20 Aug 2007 12:52:04 -0700, =?Utf-8?B?TWFyY2VlcG9v?=
<36c53a08-...@news.postalias> ha scritto:
>2. I noticed that, if I right-click on the head of a Windows Explorer
>column (e.g., Name, date modified, size, etc.), WinXp gives the user the
>opportunity to add a bunch of columns/fields/attributes/details for files.
>But there's not a lot of overlap between the column names and the
>DSOFile.SummaryProperties.
> Do you have any idea where I can find tool(s) to programmatically read
>from and write to those fields?

objShellFolder.getdetailsof(oFile,i) returns the attribute numer "i" of the file oFile.
objShellFolder.getdetailsof(objShellFolder.items,i) returns the attribute name of the
column number "i".
Different OS's return different informations.
This shows a directory list in excel. Drop a folder on the icon of the script.
I never tried to write to those fields. If you do, please report it.
Thank you.


'************************************************
' File: Directory in XL.vbs (VBScript)
' Author: Giovanni Cenati
'
' Mostra in un foglio di excel l'elenco dei
' files della directory trascinata sopra l'icona
' dello script.
' Shows the directory list in an excel sheet.
' http://digilander.libero.it/Cenati Codice vbscript
' liberamente utilizzabile citando il sito.
'************************************************
Dim oXL, oFile, objArgs,path,objShell,objShellFolder,i
dim Riga ' as the excel row where to show data
Title = "Directory in Excel - Cenati Giovanni"

Set objArgs = WScript.Arguments 'Vedo se ci sono degli argomenti passati allo script
if objargs.count=0 then 'altrimenti mostro come si usa il programma
msgbox "Trascinare una directory sul programma per averne l'elenco dei
files",vbinformation+vbokonly, Title
'msgbox "Drag a folder on the script icon to have the directory list in an excel
sheet.",vbinformation+vbokonly, Title
wscript.quit
end if
path = objArgs(0) 'questa variabile contiene il nome della directory da leggere

'Prepara l'accesso ai dati forniti dalla shell. Non funziona in Win NT4 sp6
'Creates needed objects - In WinNT Shell.app can't be instanced.
Set objShell=WScript.CreateObject("Shell.application")
Set objShellFolder=objshell.namespace(path)

'EXCEL: crea oggetto, lo rende visibile, aggiunge un foglio di lavoro.
'Creates excel sheet, make it visible, adds a workbook.
Set oXL = WScript.CreateObject("Excel.Application")
oXL.Visible = TRUE
oXL.WorkBooks.Add

'Intestazione delle colonne - Column headers
oXL.cells(1,1)= "Directory: "
oXL.cells(1,2)= path
for i=0 to 50 'Intestazioni delle colonne - Columns headers
oXL.cells(2, 1+i) = objShellFolder.getdetailsof(objShellFolder.items,i)
next

Riga=3
For Each oFile In objShellFolder.items 'recupero le informazioni sui files
'Chiede a Windows alcune altre informazioni sul file.
'Attenzione: a seconda delle versioni di windows, le colonne
'riportano dati diversi. Con winME ho il nome + 16 attributi.
'Warning: different OS report different data in different columns.
'this retrieves 50 infos + the filename (in Win ME).
for i=0 to 50
oXL.cells(Riga, 1+i) = objShellFolder.getdetailsof(oFile,i)
next
Riga=riga+1
Next

wscript.quit
'*** End ***

0 new messages