Skip to content

Instantly share code, notes, and snippets.

@pc223
Last active February 27, 2021 03:54
Show Gist options
  • Save pc223/48e9a24ef595cec4465ed41bf880be5f to your computer and use it in GitHub Desktop.
Save pc223/48e9a24ef595cec4465ed41bf880be5f to your computer and use it in GitHub Desktop.
Print out control panel task links on MS Windows
@chrispleasegradethis
Copy link

chrispleasegradethis commented Feb 27, 2021

Here's a patch to work with both Python2 and Python3, using a try except.
This was tested on Windows 10.

--- print_cpanel_task_links_python2.py  2021-02-26 19:14:09.803384400 -0500
+++ print_cpanel_task_links.py  2021-02-26 21:18:35.897675300 -0500
@@ -6,6 +6,7 @@

 This script is modified from this: https://github.com/blackdaemon/enso-launcher-continued/blob/master/enso/contrib/open/platform/win32/control_panel_win7.py
 Need this to run: python27 + pip install pywin32
+              OR: python35 + pip install pywin32

 Output language will depends on current system's language, not only English

@@ -43,7 +44,10 @@
     m = re.match("@([^,]+),-([0-9]+)(;.*)?", id)
     if m:
         dll_filename = _expand_path_variables(m.group(1))
-        string_id = long(m.group(2))
+        try:
+            string_id = long(m.group(2)) # python 2 style
+        except NameError:
+            string_id = int(m.group(2)) # python 3 style
     else:
         raise Exception(
             "Error parsing dll-filename and string-resource-id from '%s'" % id)

@pc223
Copy link
Author

pc223 commented Feb 27, 2021

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment