Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Start with windows feature not working #28

Closed
Quake4Life opened this issue Mar 19, 2024 · 13 comments
Closed

Start with windows feature not working #28

Quake4Life opened this issue Mar 19, 2024 · 13 comments

Comments

@Quake4Life
Copy link

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
Copy link
Owner

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
Copy link
Author

Quake4Life commented Mar 19, 2024 via email

@suurjaak
Copy link
Owner

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?

@Quake4Life
Copy link
Author

Quake4Life commented Mar 20, 2024 via email

@suurjaak
Copy link
Owner

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
Copy link
Author

Quake4Life commented Mar 20, 2024 via email

@suurjaak
Copy link
Owner

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
Copy link

shenef commented Mar 20, 2024

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
Copy link
Author

Quake4Life commented Mar 21, 2024 via email

@suurjaak
Copy link
Owner

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
Copy link
Author

Quake4Life commented Mar 21, 2024 via email

@suurjaak
Copy link
Owner

The newly released version 1.10 should fix this issue.

@Quake4Life
Copy link
Author

Quake4Life commented Mar 25, 2024 via email

@suurjaak suurjaak closed this as completed Apr 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants