From ckkart at gmail.com Wed Jul 10 13:33:53 2019 From: ckkart at gmail.com (Christian Takutsirk) Date: Wed, 10 Jul 2019 14:33:53 -0300 Subject: [python-win32] pythoncomloader27 manifest Message-ID: Hello, I am trying to track down a problem with a python based outlook addin. Due to some changes to the IT infrastructure of my client, the addin refuses to load. From what I heard, the security mechanisms were reinforced. Is there any possibility that the failure to load could be related to the manifest information in the pythoncomloader27 dll? This does not only happen to my addin but also to win32com/demos/outlookaddin.py. On the other hand I tried with some other third-party addins, and they work. Thank you in advance for any ideas. Regards, Christian -------------- next part -------------- An HTML attachment was scrubbed... URL: From Sylvain.Fejoz at ville-ge.ch Thu Jul 25 05:58:59 2019 From: Sylvain.Fejoz at ville-ge.ch (Sylvain.Fejoz at ville-ge.ch) Date: Thu, 25 Jul 2019 11:58:59 +0200 Subject: [python-win32] DoAction problem Message-ID: Hello. New in Python and coding. My goal : Apply recorded actions in Photoshop to many folders and subfolders containing images. My inspiration : Web page explaining a Python code using pywin32 : https://vsfxryan.com/portfolio/python-photoshop-action-scripts/, but I do not want to define functions, I am too much beginner for this. Problematic code : #run action script which opens the file, convert it to jpg, save and close it. psApp.DoAction( actionScript, 'jpg_q8') Error message : NameError: name 'actionScript' is not defined Could you please help me solve this? Thanks :) Sylvain -------------- next part -------------- An HTML attachment was scrubbed... URL: From timr at probo.com Thu Jul 25 12:41:45 2019 From: timr at probo.com (Tim Roberts) Date: Thu, 25 Jul 2019 09:41:45 -0700 Subject: [python-win32] DoAction problem In-Reply-To: References: Message-ID: Sylvain.Fejoz at ville-ge.ch wrote: > > New in Python and coding. > > My goal : > Apply recorded actions in Photoshop to many folders and subfolders > containing images. > > My inspiration : > Web page explaining a Python code using pywin32 : > https://vsfxryan.com/portfolio/python-photoshop-action-scripts/, but I > do not want to define functions, I am too much beginner for this. > > Problematic code : > #run action script which opens the file, convert it to jpg, save and > close it. > psApp.DoAction( actionScript, 'jpg_q8') > > Error message : > NameError: name 'actionScript' is not defined > > Could you please help me solve this? Functions are fundamental to programming in general and Python in particular.? You need to understand them if you're going to get anything done.? Otherwise, you'll end up typing the same code over and over and over. In this case, it looks like you are trying to run this code outside of the function it was defined in.? The error is pretty much self-explanatory; you're trying to pass the value of the variable "actionScript" to the DoAction function, but there is no variable called "actionScript".? Look at the code itself.? You'll see that "actionScript" was passed in to the function as a parameter, because he wanted to be able to trigger different actions with the same code. It should be clear that what you need to pass here is the action you want to take. However, if you really need to script common actions to images and folders, I strongly suggest you take a look at the ImageMagick package.? It is an incredible powerful photo manipulation tool that is all driven from the command line.? It can be a bit tricky to set up the command lines, but once you do, it works the same way, time after time. -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 3389 bytes Desc: S/MIME Cryptographic Signature URL: From Sylvain.Fejoz at ville-ge.ch Thu Jul 25 08:48:34 2019 From: Sylvain.Fejoz at ville-ge.ch (Sylvain.Fejoz at ville-ge.ch) Date: Thu, 25 Jul 2019 14:48:34 +0200 Subject: [python-win32] DoAction problem In-Reply-To: References: Message-ID: Some little progress : Problematic code modified : psApp.DoAction('jpg_q8','Default Actions') # where 'jpg_q8' is the recorded action and 'Default Actions' the folder where the action is saved. No more error message, but... no result : my tif files are not transformed to jpg files. Help required :) De : Sylvain.Fejoz at ville-ge.ch A : python-win32 at python.org Date : 25.07.2019 12:15 Objet : [python-win32] DoAction problem Envoy? par : "python-win32" Hello. New in Python and coding. My goal : Apply recorded actions in Photoshop to many folders and subfolders containing images. My inspiration : Web page explaining a Python code using pywin32 : https://vsfxryan.com/portfolio/python-photoshop-action-scripts/, but I do not want to define functions, I am too much beginner for this. Problematic code : #run action script which opens the file, convert it to jpg, save and close it. psApp.DoAction( actionScript, 'jpg_q8') Error message : NameError: name 'actionScript' is not defined Could you please help me solve this? Thanks :) Sylvain _______________________________________________ python-win32 mailing list python-win32 at python.org https://mail.python.org/mailman/listinfo/python-win32 -------------- next part -------------- An HTML attachment was scrubbed... URL: From timr at probo.com Thu Jul 25 18:53:30 2019 From: timr at probo.com (Tim Roberts) Date: Thu, 25 Jul 2019 15:53:30 -0700 Subject: [python-win32] DoAction problem In-Reply-To: References: Message-ID: <5a125cc7-c490-b8dd-4318-46e1e48f88f8@probo.com> Sylvain.Fejoz at ville-ge.ch wrote: > Some little progress : > Problematic code modified : > psApp.DoAction('jpg_q8','Default Actions') # where 'jpg_q8' is the > recorded action and 'Default Actions' the folder where the action is > saved. Right -- the "action set" in Photoshop terms. > No more error message, but... no result : my tif files are not > transformed to jpg files. The Python part is now working.? WE have no way of knowing what your Photoshop action is doing.? Is it actually doing the save, or do you need to call psApp.Export? And, by the way, if ALL you need to do is convert TIF to JPG, you certainly do not need to launch the Photoshop behemoth for that. Just use pip to install "pillow", the Python Imaging Library, and all you need is this: ??? from PIL import Image ??? Image.open('myfile.tif').save('myfile.jpg') -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 3389 bytes Desc: S/MIME Cryptographic Signature URL: From Sylvain.Fejoz at ville-ge.ch Fri Jul 26 11:05:26 2019 From: Sylvain.Fejoz at ville-ge.ch (Sylvain.Fejoz at ville-ge.ch) Date: Fri, 26 Jul 2019 17:05:26 +0200 Subject: [python-win32] DoAction problem In-Reply-To: <5a125cc7-c490-b8dd-4318-46e1e48f88f8@probo.com> References: <5a125cc7-c490-b8dd-4318-46e1e48f88f8@probo.com> Message-ID: My photoshop action is doing : - Open - Smart sharpen - Convert to Profile current document - Save - Close If Pillow is also able of "smart sharpening" and "converting to Profile current document", your suggestion is very promising. Is there any place on the Web where I can find reference to psApp tasks like "DoAction", "Export", the parameters they need, etc.? It seems that it is not so easy. Well, this is maybe again a very naive question. Thank you. De : "Tim Roberts" A : "Python-Win32 List" Date : 26.07.2019 00:54 Objet : Re: [python-win32] DoAction problem Envoy? par : "python-win32" Sylvain.Fejoz at ville-ge.ch wrote: > Some little progress : > Problematic code modified : > psApp.DoAction('jpg_q8','Default Actions') # where 'jpg_q8' is the > recorded action and 'Default Actions' the folder where the action is > saved. Right -- the "action set" in Photoshop terms. > No more error message, but... no result : my tif files are not > transformed to jpg files. The Python part is now working. WE have no way of knowing what your Photoshop action is doing. Is it actually doing the save, or do you need to call psApp.Export? And, by the way, if ALL you need to do is convert TIF to JPG, you certainly do not need to launch the Photoshop behemoth for that. Just use pip to install "pillow", the Python Imaging Library, and all you need is this: from PIL import Image Image.open('myfile.tif').save('myfile.jpg') -- Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. [pi?ce jointe "smime.p7s" supprim?e par Sylvain Fejoz/bge/ville-ge] _______________________________________________ python-win32 mailing list python-win32 at python.org https://mail.python.org/mailman/listinfo/python-win32 -------------- next part -------------- An HTML attachment was scrubbed... URL: From Sylvain.Fejoz at ville-ge.ch Fri Jul 26 12:01:04 2019 From: Sylvain.Fejoz at ville-ge.ch (Sylvain.Fejoz at ville-ge.ch) Date: Fri, 26 Jul 2019 18:01:04 +0200 Subject: [python-win32] DoAction problem In-Reply-To: References: Message-ID: Thanks to Mr Bieber too for the explanations and for the triathlon image, I agree with it. As already said, I would be grateful for any advice about getting any reference to the functions DoAction, Export, etc. I am also wondering how, in the following code (source again : https://vsfxryan.com/portfolio/python-photoshop-action-scripts/), the programer can know that code "13" refers to PNG, etc. : #png save options options = win32com.client.Dispatch('Photoshop.ExportOptionsSaveForWeb') options.Format = 13 # PNG options.PNG8 = True # Sets it to PNG-8 bit Again, if these questions are too basic or the needed answers too elaborated, just forget it ; I have a lot to learn :) De : "Dennis Lee Bieber" A : python-win32 at python.org Date : 25.07.2019 18:43 Objet : Re: [python-win32] DoAction problem Envoy? par : "python-win32" On Thu, 25 Jul 2019 11:58:59 +0200, Sylvain.Fejoz at ville-ge.ch declaimed the following: > >My inspiration : >Web page explaining a Python code using pywin32 : >https://vsfxryan.com/portfolio/python-photoshop-action-scripts/, but I do >not want to define functions, I am too much beginner for this. > For someone "new to Python and coding" you are asking to compete in a triathlon (invoking internal operations of an external program using pywin32), and without knowing how to shoot a gun (writing stand-alone programs using basic operations). Defining functions is basic to any programming language, along with looping and conditional branching. >Problematic code : >#run action script which opens the file, convert it to jpg, save and close >it. >psApp.DoAction( actionScript, 'jpg_q8') > >Error message : >NameError: name 'actionScript' is not defined > So did you really read the linked web page? "actionScript" is a parameter passed into the example function. -=-=-=- def edit_File( actionScript, imagePath, saveDir, psApp ): #run action script psApp.DoAction( actionScript, 'WaterMark') #save doc.Export(ExportIn=newSave, ExportAs=2, Options=options) return doc -=-=-=- See how it is the first parameter given to edit_File... Now, find where edit_File is used and you find... -=-=-=- def processFiles( files, saveDir, psApp ): for file in files: #determine what actionscript to run based off folder name (all lower case) if 'btmleft' in file.lower(): doc = edit_File( 'BtmLeft', file, saveDir, psApp ) elif 'btmcenter' in file.lower(): doc = edit_File( 'BtmCenter', file, saveDir, psApp ) elif 'btmright' in file.lower(): doc = edit_File( 'BtmRight', file, saveDir, psApp ) #close image without saving doc.Close(2) # Close PSD without saving psApp.Quit() -=-=-=- See how the first argument given to edit_File is a STRING with the name of the PS script to be invoked... Or as explained in the text of the web page: """Next, we run our action script, this is where the name of the action script comes in handy. psApp.DoAction(?ScriptName?, ?FolderName?) That is how you run your action script. """ -- Wulfraed Dennis Lee Bieber AF6VN wlfraed at ix.netcom.com http://wlfraed.microdiversity.freeddns.org/ _______________________________________________ python-win32 mailing list python-win32 at python.org https://mail.python.org/mailman/listinfo/python-win32 -------------- next part -------------- An HTML attachment was scrubbed... URL: From timr at probo.com Sun Jul 28 02:12:16 2019 From: timr at probo.com (Tim Roberts) Date: Sat, 27 Jul 2019 23:12:16 -0700 Subject: [python-win32] DoAction problem In-Reply-To: References: <5a125cc7-c490-b8dd-4318-46e1e48f88f8@probo.com> Message-ID: <22999A8C-0907-47E5-A774-6FA56932005B@probo.com> On Jul 26, 2019, at 8:05 AM, Sylvain.Fejoz at ville-ge.ch wrote: > > My photoshop action is doing : > - Open > - Smart sharpen > - Convert to Profile current document > - Save > - Close > > If Pillow is also able of "smart sharpening" and "converting to Profile current document", your suggestion is very promising. Did you even look? Pillow includes both a tunable ?sharpen? filter and an ?unsharp mask? filter, as will every competent graphics library. The color profile conversion isn?t really necessary. My guess is you?re not really sure what it does anyway. > Is there any place on the Web where I can find reference to psApp tasks like "DoAction", "Export", the parameters they need, etc.? It seems that it is not so easy. Well, this is maybe again a very naive question. Those are Photoshop questions. Adobe has documentation on the Photoshop APIs, and they have their own user forums. ? Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. -------------- next part -------------- An HTML attachment was scrubbed... URL: