From 13683156269 at 163.com Fri Jan 1 23:59:26 2021 From: 13683156269 at 163.com (=?GBK?B?sL/P6LzGu64=?=) Date: Sat, 2 Jan 2021 12:59:26 +0800 (CST) Subject: [python-win32] Problem with makepy.py Message-ID: <12301839.bd9.176c176f26f.Coremail.13683156269@163.com> Hello everyone, I want to know what params I should pass to method Selection.ParagraphFormat.TabStops.Add. But after I used help, it showed: Add(Position=, Alignment= It seems like the problem that 'Microsoft Word 16.0 Library' not compiled by makepy.py. So I double clicked makepy.py and couldn't find 'Microsoft Word 16.0 Library'in the libraries list. But i-n VBA of word, I can indeed find 'Microsoft Word 16.0 Library'. So I'd like to ask what is the problem with makepy.py and what params I should pass into this method. Regards, Linghao -------------- next part -------------- An HTML attachment was scrubbed... URL: From technqvi_gangster at hotmail.com Wed Jan 13 23:07:17 2021 From: technqvi_gangster at hotmail.com (Pongthorn Sangkaphet) Date: Thu, 14 Jan 2021 04:07:17 +0000 Subject: [python-win32] how to code pywin32 run existing window task scheduler? Message-ID: I am interested in pywin32 . I am going to use it to run window task scheduler through Django web application ? Does pywin32 provide some features or method to run window task scheduler? I have tried already but error [cid:image003.png at 01D6EA65.65D06140] I would like you to guide sample code to do as the following requirement. 1. My job has been created on Window task scheduler already as the figure below My job is responsible for executing python file. [cid:image006.png at 01D6EA65.65D06140] 1. I would like you to guide code to run job of window task scheduler in view.py on Django web application I will code in def create_report(request) [cid:image009.png at 01D6EA65.65D06140] Sent from Mail for Windows 10 -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: AC12E8300B154CB59F56651FFC0EAC99.png Type: image/png Size: 343143 bytes Desc: AC12E8300B154CB59F56651FFC0EAC99.png URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: A1AA0C10F944457293FFF8044BC15EBE.png Type: image/png Size: 459556 bytes Desc: A1AA0C10F944457293FFF8044BC15EBE.png URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: 181B3EFE2CA24708AF95DB36FFA27D43.png Type: image/png Size: 445810 bytes Desc: 181B3EFE2CA24708AF95DB36FFA27D43.png URL: From timr at probo.com Thu Jan 14 02:34:12 2021 From: timr at probo.com (Tim Roberts) Date: Wed, 13 Jan 2021 23:34:12 -0800 Subject: [python-win32] how to code pywin32 run existing window task scheduler? In-Reply-To: References: Message-ID: On Jan 13, 2021, at 8:07 PM, Pongthorn Sangkaphet wrote: > I am interested in pywin32 . I am going to use it to run window task scheduler through Django web application ? > > Does pywin32 provide some features or method to run window task scheduler? > Obviously, since you?re already using them. ;) > I have tried already but error > That?s 0x80070005, which is ERROR_ACCESS_DENIED. Have you tried running this from an elevated process? ? Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. -------------- next part -------------- An HTML attachment was scrubbed... URL: From eryksun at gmail.com Thu Jan 14 11:10:42 2021 From: eryksun at gmail.com (Eryk Sun) Date: Thu, 14 Jan 2021 10:10:42 -0600 Subject: [python-win32] how to code pywin32 run existing window task scheduler? In-Reply-To: References: Message-ID: On 1/14/21, Tim Roberts wrote: > On Jan 13, 2021, at 8:07 PM, Pongthorn Sangkaphet > >> I have tried already but error >> > That?s 0x80070005, which is ERROR_ACCESS_DENIED. Have you tried running > this from an elevated process? The default security descriptor of a task grants all access to administrators, and the principal user of the task is granted read access. Implicitly, however, the principal can execute a task as long the task security grants read access. Because the principal user can execute a task, this allows an administrator to configure a task to run elevated (i.e. with highest privileges) as the administrator user, which bypasses UAC (e.g. when executed via schtasks /run from a restricted security context). If the principal user has the batch logon right, then the task can also run in the services session (i.e. the option to run whether or not the user is logged on), but that's not pertinent to the question of execute access. If you need to allow some other user to read and execute a task (e.g. to bypass UAC in the context of the principal user), then you'll need to grant that user file read (FR) and execute (FX) access. Begin by retrieving the task's DACL_SECURITY_INFORMATION (4) in SDDL form from GetSecurityDescriptor [1]. You can convert this string to an SD record to work with it programmatically, or simply append an allow ACE in SDDL form, such as "(A;;FRFX;;;)". Then write the new DACL via SetSecurityDescriptor. --- [1] https://docs.microsoft.com/en-us/windows/win32/taskschd/registeredtask From technqvi_gangster at hotmail.com Fri Jan 15 05:10:35 2021 From: technqvi_gangster at hotmail.com (Pongthorn Sangkaphet) Date: Fri, 15 Jan 2021 10:10:35 +0000 Subject: [python-win32] how to code pywin32 run existing window task scheduler? In-Reply-To: References: , Message-ID: I red https://docs.microsoft.com/en-us/windows/win32/taskschd/registeredtask But I have no idea what I will do the next step. As I understand, we must to add current user (who run python code ) to have right permission to this task to able to run completely. How to add permission in code using python-win32, perhaps everyone can run [cid:image003.png at 01D6EB61.535F06E0] Sent from Mail for Windows 10 From: Eryk Sun Sent: ?????????????? 14 ?????? 2021 23:11 To: python-win32 at python.org Subject: Re: [python-win32] how to code pywin32 run existing window task scheduler? On 1/14/21, Tim Roberts wrote: > On Jan 13, 2021, at 8:07 PM, Pongthorn Sangkaphet > >> I have tried already but error >> > That?s 0x80070005, which is ERROR_ACCESS_DENIED. Have you tried running > this from an elevated process? The default security descriptor of a task grants all access to administrators, and the principal user of the task is granted read access. Implicitly, however, the principal can execute a task as long the task security grants read access. Because the principal user can execute a task, this allows an administrator to configure a task to run elevated (i.e. with highest privileges) as the administrator user, which bypasses UAC (e.g. when executed via schtasks /run from a restricted security context). If the principal user has the batch logon right, then the task can also run in the services session (i.e. the option to run whether or not the user is logged on), but that's not pertinent to the question of execute access. If you need to allow some other user to read and execute a task (e.g. to bypass UAC in the context of the principal user), then you'll need to grant that user file read (FR) and execute (FX) access. Begin by retrieving the task's DACL_SECURITY_INFORMATION (4) in SDDL form from GetSecurityDescriptor [1]. You can convert this string to an SD record to work with it programmatically, or simply append an allow ACE in SDDL form, such as "(A;;FRFX;;;)". Then write the new DACL via SetSecurityDescriptor. --- [1] https://docs.microsoft.com/en-us/windows/win32/taskschd/registeredtask _______________________________________________ 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: -------------- next part -------------- A non-text attachment was scrubbed... Name: 840C82379E674BF093F9B193A68890D5.png Type: image/png Size: 126224 bytes Desc: 840C82379E674BF093F9B193A68890D5.png URL: From clamm at piscesinc.com Thu Jan 21 11:23:28 2021 From: clamm at piscesinc.com (Charlie Lamm) Date: Thu, 21 Jan 2021 16:23:28 +0000 Subject: [python-win32] Basic question about pywin32, does it work with 64 bit versions of O365? Message-ID: <03b5c10ea00f4303bb88dd1fcf9206b8@MBX083-W5-CO-6.EXCH083.serverpod.net> I am contemplating rolling out some pywin32 scripts but my office has a combination of 64 bit and 32 bit local office365 builds. Q: Will pywin32 scripts work w/ 64 bit office? Because of shelter in place I don't have a W10 machine running 64 bit office to test this on, but maybe someone knows? Thanks in advance. -------------- next part -------------- An HTML attachment was scrubbed... URL: From lufsen65 at gmail.com Thu Jan 21 06:00:40 2021 From: lufsen65 at gmail.com (=?UTF-8?B?T2xsZSBQb250w6lu?=) Date: Thu, 21 Jan 2021 12:00:40 +0100 Subject: [python-win32] Error: VARIANT Type is unknown Message-ID: Hello! I'm quite new to the pywin32 package (as in I have never interacted with it before). I'm currently trying to implement a python interface to a win32 bit program that I can connect to using the ordinary win32com.client.Dispatch method. This program controls an microscope camera and the only way to connect to it is via this COM connection. There is already an version of this software written in pascal by the manufacturers so I'm trying to create an expanded python version of this software. I've managed to get the connection working and I can send commands that do not require any inputs and access the attributes of the interface/program. The problem is that when I try to send commands to one of two exposed methods that require input I get the follow error: s = win32com.client.VARIANT(pythoncom.VT_LPWSTR, 'On\0') r = win32com.client.VARIANT(pythoncom.VT_LPWSTR, 'AL\0') Response = AIPam.scriptCmd(r,s) Traceback (most recent call last): File "", line 1, in Response = AIPam.scriptCmd(r,s) File "C:\Users\GWHLAB~2\AppData\Local\Temp\gen_py\3.8\E07C24C7-56CE-409F-AB60-DC7EDE9D9888x0x1x0.py", line 37, in scriptCmd return self._oleobj_.InvokeTypes(216, LCID, 1, (3, 0), ((31, 1), (31, 1)),cmd TypeError: The VARIANT type is unknown (0x0000001f) I've tried with s and r set to various combinations of either just a regular python string, VARIANT with VT_LPWSTR with either (\0 or 0) terminator or without terminator. They all give the same error. (As I understood that 31 VT code meant a VT_LPWSTR) The corresponding command in pascal looks like: IPam.scriptCmd('AL','On') and it works. Anyone who knows what might the issue/how to fix it? Kind Regards, Olle -------------- next part -------------- An HTML attachment was scrubbed... URL: From timr at probo.com Thu Jan 21 23:03:46 2021 From: timr at probo.com (Tim Roberts) Date: Thu, 21 Jan 2021 20:03:46 -0800 Subject: [python-win32] Basic question about pywin32, does it work with 64 bit versions of O365? In-Reply-To: <03b5c10ea00f4303bb88dd1fcf9206b8@MBX083-W5-CO-6.EXCH083.serverpod.net> References: <03b5c10ea00f4303bb88dd1fcf9206b8@MBX083-W5-CO-6.EXCH083.serverpod.net> Message-ID: <0647468A-4B5E-4F3E-8A8C-D5E5CB8E4DD0@probo.com> On Jan 21, 2021, at 8:23 AM, Charlie Lamm wrote: > > I am contemplating rolling out some pywin32 scripts but my office has a combination of 64 bit and 32 bit local office365 builds. > Q: Will pywin32 scripts work w/ 64 bit office? > Because of shelter in place I don?t have a W10 machine running 64 bit office to test this on, but maybe someone knows? Usually, with a COM server, the bit size of your Python must match the bit size of your COM server. So, you'd need to use 64-bit Python to call a 64-bit COM server. (Note thet pywin32 is available for both 32-bit and 64-bit Pythons.) However, the Office applications are out-of-process servers, so there?s a proxy in the middle, and that should let it work. ? Tim Roberts, timr at probo.com Providenza & Boekelheide, Inc. -------------- next part -------------- An HTML attachment was scrubbed... URL: From skippy.hammond at gmail.com Thu Jan 21 23:26:51 2021 From: skippy.hammond at gmail.com (Mark Hammond) Date: Fri, 22 Jan 2021 15:26:51 +1100 Subject: [python-win32] Error: VARIANT Type is unknown In-Reply-To: References: Message-ID: <427a13fb-58d2-a146-b37e-c660555f54ce@gmail.com> On 21/01/2021 10:00 pm, Olle Pont?n wrote: > Hello! > > I'm quite new to the pywin32 package (as in I have never interacted with > it before). > I'm currently trying to implement a python interface to a win32 bit program > that I can connect to using the ordinary win32com.client.Dispatch method. > This program controls an microscope camera and the only way to connect to > it is via this COM connection. > There is already an version of this software written in pascal by the > manufacturers > so I'm trying to create an expanded python version of this software. > > I've managed to get the connection working and I can send commands that > do not > require any inputs and access the attributes of the interface/program. > > The problem is that when I try to send commands to one of two exposed > methods that require input I get the > follow error: > > s = win32com.client.VARIANT(pythoncom.VT_LPWSTR, 'On\0') > > r = win32com.client.VARIANT(pythoncom.VT_LPWSTR, 'AL\0') > > Response = AIPam.scriptCmd(r,s) > Traceback (most recent call last): > > ? File "", line 1, in > ? ? Response = AIPam.scriptCmd(r,s) > > ? File > "C:\Users\GWHLAB~2\AppData\Local\Temp\gen_py\3.8\E07C24C7-56CE-409F-AB60-DC7EDE9D9888x0x1x0.py", > line 37, in scriptCmd > ? ? return self._oleobj_.InvokeTypes(216, LCID, 1, (3, 0), ((31, 1), > (31, 1)),cmd > > TypeError: The VARIANT type is unknown (0x0000001f) If you look at https://docs.microsoft.com/en-us/windows/win32/api/wtypes/ne-wtypes-varenum#remarks, VT_LPWSTR is not valid in a VARIANT, so pywin32 doesn't let you create them. Use VT_BSTR (or just pass a Python string) and see if that works - if it doesn't you probably need to contact the vendor of the package. HTH, Mark From olle.ponten at gmail.com Fri Jan 22 07:31:06 2021 From: olle.ponten at gmail.com (=?UTF-8?B?T2xsZSBQb250w6lu?=) Date: Fri, 22 Jan 2021 13:31:06 +0100 Subject: [python-win32] Error: VARIANT Type is unknown In-Reply-To: <427a13fb-58d2-a146-b37e-c660555f54ce@gmail.com> References: <427a13fb-58d2-a146-b37e-c660555f54ce@gmail.com> Message-ID: Thanks for the response! Hmm ok, I could find the following information using OLEView (se attachment). It states that the two in parameters are noted as VT_LPWSTR for the scriptCmd command. Would that mean that I have no way of interfacing with them at all? I would prefer exhausting what I can do using python before I contact the company, although if that is the only route available I will take it. Kind Regards, Olle On Fri, Jan 22, 2021 at 5:26 AM Mark Hammond wrote: > > On 21/01/2021 10:00 pm, Olle Pont?n wrote: > > Hello! > > > > I'm quite new to the pywin32 package (as in I have never interacted with > > it before). > > I'm currently trying to implement a python interface to a win32 bit > program > > that I can connect to using the ordinary win32com.client.Dispatch method. > > This program controls an microscope camera and the only way to connect to > > it is via this COM connection. > > There is already an version of this software written in pascal by the > > manufacturers > > so I'm trying to create an expanded python version of this software. > > > > I've managed to get the connection working and I can send commands that > > do not > > require any inputs and access the attributes of the interface/program. > > > > The problem is that when I try to send commands to one of two exposed > > methods that require input I get the > > follow error: > > > > s = win32com.client.VARIANT(pythoncom.VT_LPWSTR, 'On\0') > > > > r = win32com.client.VARIANT(pythoncom.VT_LPWSTR, 'AL\0') > > > > Response = AIPam.scriptCmd(r,s) > > Traceback (most recent call last): > > > > File "", line 1, in > > Response = AIPam.scriptCmd(r,s) > > > > File > > > "C:\Users\GWHLAB~2\AppData\Local\Temp\gen_py\3.8\E07C24C7-56CE-409F-AB60-DC7EDE9D9888x0x1x0.py", > > > line 37, in scriptCmd > > return self._oleobj_.InvokeTypes(216, LCID, 1, (3, 0), ((31, 1), > > (31, 1)),cmd > > > > TypeError: The VARIANT type is unknown (0x0000001f) > > If you look at > > https://docs.microsoft.com/en-us/windows/win32/api/wtypes/ne-wtypes-varenum#remarks, > > VT_LPWSTR is not valid in a VARIANT, so pywin32 doesn't let you create > them. Use VT_BSTR (or just pass a Python string) and see if that works - > if it doesn't you probably need to contact the vendor of the package. > > HTH, > > Mark > -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: TLBA012D.JPG Type: image/jpeg Size: 76221 bytes Desc: not available URL: From timr at probo.com Tue Jan 26 13:46:56 2021 From: timr at probo.com (Tim Roberts) Date: Tue, 26 Jan 2021 10:46:56 -0800 Subject: [python-win32] Error: VARIANT Type is unknown In-Reply-To: References: <427a13fb-58d2-a146-b37e-c660555f54ce@gmail.com> Message-ID: <03cc3710-535e-d436-53d7-9b6f375d59c7@probo.com> Olle Pont?n wrote: > > Hmm ok, I could find the following information using OLEView (se > attachment). > It states that the two in parameters are noted as VT_LPWSTR for the > scriptCmd command. > Would that mean that I have no way of interfacing with them at all? No, it doesn't mean that!? If it doesn't ask for a variant, then you don't deliver a variant.? Did you try just passing a string, as Mark suggested? -- 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: