pythonpy-appscriptsourceforge-appscript

Python appscript error: OSERROR: -1700, Can't make some data into the expected type


from appscript import *
ps = app("Adobe Photoshop CS5")
s = ps.current_document.save
s._labelledargterms

Gives:

{'appending': 'DcXt',
 'as_': 'fltp',
 'copying': 'SaCp',
 'in_': 'kfil',
 'with_options': 'FmOp'}

I'm not exactly use what the kfil means. Can someone explain?

I was trying to do the following:

import mactypes
f = mactypes.File("foo.jpg")
s(as_=k.JPEG, in_=f)

This gives me:

CommandError: Command failed:
        OSERROR: -1700
        MESSAGE: Can't make some data into the expected type.
        COMMAND: app(u'/Applications/Adobe Photoshop CS5/Adobe Photoshop CS5.app').current_document.save(in_=mactypes.File(u'/Users/az/foo.jpg'), as_=k.JPEG)

Solution

  • Ok, seems I must avoid mactypes.File. Strangely, this works:

    s(in_="/Users/az/foo.jpg", as_=k.JPEG,
      with_options={k.class_:k.JPEG_save_options, k.quality:12},
      copying=True, appending=k.no_extension)
    

    I don't fully understand why that works (and not the other way as in the question), so if someone could explain further, that would be great.