suurjaak / InputScope

Mouse and keyboard input heatmap visualizer, with statistics.
MIT License
92 stars 13 forks source link

Start with windows feature not working #28

Closed Quake4Life closed 7 months ago

Quake4Life commented 8 months ago

Win10 x64 22H2 19045.4170

Traceback (most recent call last): File "inputscope\main.py", line 418, in OnToggleStartup File "inputscope\main.py", line 506, in start File "inputscope\main.py", line 534, in create_shortcut File "<COMObject >", line 2, in save pywintypes.com_error: (-2147352567, 'Exception occurred.', (0, 'WshShortcut.Save', 'Unable to save shortcut "C:\Users\vovan\Start Menu\Programs\Startup\InputScope.lnk".', None, 0, -2147024893), None) Traceback (most recent call last): File "inputscope\main.py", line 418, in OnToggleStartup File "inputscope\main.py", line 506, in start File "inputscope\main.py", line 534, in create_shortcut File "<COMObject >", line 2, in save pywintypes.com_error: (-2147352567, 'Exception occurred.', (0, 'WshShortcut.Save', 'Unable to save shortcut "C:\Users\vovan\Start Menu\Programs\Startup\InputScope.lnk".', None, 0, -2147024893), None) Traceback (most recent call last): File "inputscope\main.py", line 418, in OnToggleStartup File "inputscope\main.py", line 506, in start File "inputscope\main.py", line 534, in create_shortcut File "<COMObject >", line 2, in save pywintypes.com_error: (-2147352567, 'Exception occurred.', (0, 'WshShortcut.Save', 'Unable to save shortcut "C:\Users\vovan\Start Menu\Programs\Startup\InputScope.lnk".', None, 0, -2147024893), None)

suurjaak commented 8 months ago

Does the folder C:\Users\vovan\Start Menu\Programs\Startup itself exist?

If yes, is there already a shortcut named inputscope.lnk under it?

If no, what happens if you run the program with elevated permissions?

Quake4Life commented 8 months ago

Yes, the folder exists. No, there is no shortcuts. Yes, I start the program as an admin.

вт, 19 мар. 2024 г., 21:32 Erki Suurjaak @.***>:

Does the folder C:\Users\vovan\Start Menu\Programs\Startup itself exist?

If yes, is there already a shortcut named inputscope.lnk under it?

If no, what happens if you run the program with elevated permissions?

— Reply to this email directly, view it on GitHub https://github.com/suurjaak/InputScope/issues/28#issuecomment-2007870165, or unsubscribe https://github.com/notifications/unsubscribe-auth/A44HBPQOUQSMJ7AF4BOZPIDYZCAFJAVCNFSM6AAAAABE5D2BSCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAMBXHA3TAMJWGU . You are receiving this because you authored the thread.Message ID: @.***>

suurjaak commented 8 months ago

Interesting.. Can you try the following:

shell = win32com.client.Dispatch("WScript.Shell")

path = r"C:\Users\vovan\Start Menu\Programs\Startup\InputScope.lnk"

shortcut = shell.CreateShortCut(path)

shortcut.Targetpath = sys.argv[0]

shortcut.save()



What is the result?
Quake4Life commented 8 months ago

Traceback (most recent call last): File "", line 1, in File "<COMObject >", line 2, in save pywintypes.com_error: (-2147352567, 'Exception occurred.', (0, 'WshShortcut.Save', 'Unable to save shortcut "C:\Users\vovan\Start Menu\Programs\Startup\InputScope.lnk".', None, 0, -2147024893), None)

ср, 20 мар. 2024 г. в 19:43, Erki Suurjaak @.***>:

Interesting.. Can you try the following:

  • right-click on the InputScope icon in system tray and select "Show Python console"
  • in the opened console window, copy-paste the following lines, one by one, pressing Enter after each:

import win32com.client shell = win32com.client.Dispatch("WScript.Shell") path = r"C:\Users\vovan\Start Menu\Programs\Startup\InputScope.lnk" shortcut = shell.CreateShortCut(path) shortcut.Targetpath = sys.argv[0] shortcut.save()

What is the result?

— Reply to this email directly, view it on GitHub https://github.com/suurjaak/InputScope/issues/28#issuecomment-2010027874, or unsubscribe https://github.com/notifications/unsubscribe-auth/A44HBPUSYH3VA3JHRW5RHP3YZG4CTAVCNFSM6AAAAABE5D2BSCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAMJQGAZDOOBXGQ . You are receiving this because you authored the thread.Message ID: @.***>

suurjaak commented 8 months ago

Strange. Because error code -2147024893 means "The system cannot find the path specified.".

What happens if you open the console and execute

os.listdir(r"C:\Users\vovan\Start Menu\Programs\Startup")

?

Quake4Life commented 8 months ago

FileNotFoundError: [WinError 3] The system cannot find the path specified: 'C:\Users\vovan\Start Menu\Programs\Startup'

ср, 20 мар. 2024 г. в 20:56, Erki Suurjaak @.***>:

Strange. Because error code -2147024893 means "The system cannot find the path specified.".

What happens if you open the console and execute

os.listdir(r"C:\Users\vovan\Start Menu\Programs\Startup")

?

— Reply to this email directly, view it on GitHub https://github.com/suurjaak/InputScope/issues/28#issuecomment-2010265585, or unsubscribe https://github.com/notifications/unsubscribe-auth/A44HBPQSJVGL3KDVCQDOYGTYZHEWVAVCNFSM6AAAAABE5D2BSCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAMJQGI3DKNJYGU . You are receiving this because you authored the thread.Message ID: @.***>

suurjaak commented 8 months ago

Well, it looks like the folder C:\Users\vovan\Start Menu\Programs\Startup does not exist? What happens if you choose Run from start menu and paste this folder name there and click OK?

shenef commented 8 months ago

Checking on my end (on Win 11), i don't have that folder either, for me the startup folder is at C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Startup and, looking online, it should be at that same location in Win 10.

Quake4Life commented 8 months ago

Yep, there's no such folder. But as Shenef has mentioned, I surely have C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Startup

чт, 21 мар. 2024 г. в 01:07, shenef @.***>:

Checking on my end (on Win 11), i don't have that folder either, for me the startup folder is at C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Startup and, looking online, it should be at that same location in Win 10.

— Reply to this email directly, view it on GitHub https://github.com/suurjaak/InputScope/issues/28#issuecomment-2010728270, or unsubscribe https://github.com/notifications/unsubscribe-auth/A44HBPQJ3WLTCW3NWWLTB23YZICAJAVCNFSM6AAAAABE5D2BSCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAMJQG4ZDQMRXGA . You are receiving this because you authored the thread.Message ID: @.***>

suurjaak commented 8 months ago

Ok, thank you all, now the confusion is cleared up, InputScope uses the wrong path. Will issue a fix soon.

@Quake4Life just in case, can you try one more thing in the Python console:

import win32com.client

shell = win32com.client.Dispatch("WScript.Shell")

shell.SpecialFolders("Startup")

What does it print?

Quake4Life commented 8 months ago

'C:\Users\vovan\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup'

чт, 21 мар. 2024 г. в 12:50, Erki Suurjaak @.***>:

Ok, thank you all, now the confusion is cleared up, InputScope uses the wrong path. Will issue a fix soon.

@Quake4Life https://github.com/Quake4Life just in case, can you try one more thing in the Python console:

import win32com.client shell = win32com.client.Dispatch("WScript.Shell") shell.SpecialFolders("Startup")

What does it print?

— Reply to this email directly, view it on GitHub https://github.com/suurjaak/InputScope/issues/28#issuecomment-2011777671, or unsubscribe https://github.com/notifications/unsubscribe-auth/A44HBPUPIPEZNWAQUBDUINDYZKUPHAVCNFSM6AAAAABE5D2BSCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAMJRG43TONRXGE . You are receiving this because you were mentioned.Message ID: @.***>

suurjaak commented 7 months ago

The newly released version 1.10 should fix this issue.

Quake4Life commented 7 months ago

Thanks, I'll check it out.

вт, 26 мар. 2024 г., 00:33 Erki Suurjaak @.***>:

The newly released version 1.10 should fix this issue.

— Reply to this email directly, view it on GitHub https://github.com/suurjaak/InputScope/issues/28#issuecomment-2018957194, or unsubscribe https://github.com/notifications/unsubscribe-auth/A44HBPVXGY7MVHOCKSVGVLTY2CJ3TAVCNFSM6AAAAABE5D2BSCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAMJYHE2TOMJZGQ . You are receiving this because you were mentioned.Message ID: @.***>