Weird script error for BitsPerChannel setting

Discussion of Photoshop Scripting, Photoshop Actions and Photoshop Automation in General

Moderators: Tom, Kukurykus

tdotn

Weird script error for BitsPerChannel setting

Post by tdotn »

Hello

I hope some of the gurus here can help me with this strange problem.

I have this script which executes fine for certain files but an error on others, so im not sure if there is a specific requirement for a file.

Code: Select all'Save as JPG
Public Const psJPEGSave = 6
Public Const psPNGSave = 13
Public Const psSaveForWeb = 2
Public Const psDocument8Bits = 8


'exporting
Dim objExportForWeb, outFile
objFile.BitsPerChannel = psDocument8Bits
Set objExportForWeb = CreateObject("Photoshop.ExportOptionsSaveForWeb")

Thats mode code... the script will exit at line: objFile.BitsPerChannel = psDocument8Bits

is there certain requirements for the file for this line to execute properly?

Thanks in advance

Professional AI Audio Generation within Adobe Premiere Pro - Download Free Plugin here

Mike Hale

Weird script error for BitsPerChannel setting

Post by Mike Hale »

I don't use VB so I'm just guessing. The javascript version of BitsPerChannel is a document property. is 'objFile' a document or a file?
tdotn

Weird script error for BitsPerChannel setting

Post by tdotn »

Set objFile = objApp.Open(imageLocation&"folder\"&filename)

Its a file
tdotn

Weird script error for BitsPerChannel setting

Post by tdotn »

Mike,

Thanks to your comment, although it didnt directly solve my problem but it made me aware of the cause

Thanks again
Mike Hale

Weird script error for BitsPerChannel setting

Post by Mike Hale »

I glad you got it working. I wish we had more members that used VB or Applescript. Most of the active members use javascript.