I'm after any help please with Python scripting advice. I've recorded my first script in PSP9 and have immediately hit a problem. The script is intended to open a .tif file, reduce the image size, and then to save as a .gif. The problem is that there are 255 files that I need to convert, and I don't want to record myself opening the 255 files and repeating the exact same steps. The constant is the image resize and saving as a .gif, the variable is the image file name. Is there some Python equivalent of the VBA code below (that opens all .xls files in a specific directory)?:
Sub LoopFiles()
Dim sDirectory As String
Dim sSpec As String
Dim sBook As String
Dim oBook As Workbook
sDirectory = "d:\files"
sSpec = "*.xls"
sBook = Dir(sDirectory & "\" & sSpec)
Do
Set oBook = Workbooks.Open(sDirectory & "\" & sBook)
''' Do your processing on oBook here (eg converting PSP9 files!)
oBook.Save
oBook.Close
sBook = Dir()
Loop Until sBook = ""
End Sub
Many thanks, Malachi
Sub LoopFiles()
Dim sDirectory As String
Dim sSpec As String
Dim sBook As String
Dim oBook As Workbook
sDirectory = "d:\files"
sSpec = "*.xls"
sBook = Dir(sDirectory & "\" & sSpec)
Do
Set oBook = Workbooks.Open(sDirectory & "\" & sBook)
''' Do your processing on oBook here (eg converting PSP9 files!)
oBook.Save
oBook.Close
sBook = Dir()
Loop Until sBook = ""
End Sub
Many thanks, Malachi