Page 1 of 1

Run Skype with AHK

Posted: 16 Nov 2020, 03:12
by RandomPersson
I've created a script that autostarts with Windows and runs some programs. The only one it has problems with is Skype - keeps throwing "access denied" error even when I run the script as administrator. Is there some way of starting windows apps that doesn't require godly permissions, since apparently administrator is not enough? The path to Skype app I'm using now is "C:\Program Files\WindowsApps\Microsoft.SkypeApp_15.65.78.0_x86__kzf8qxf38zg5c\Skype\Skype.exe".

Re: Run Skype with AHK

Posted: 16 Nov 2020, 07:08
by mikeyww
1. Does running that path from a Windows command line work?

2. If you make a Windows shortcut file to that path, does running the shortcut work?

3. If not, does it work if you set the privileges to admin?

If the answer is "No" to all three, then I'd try uninstalling Skype and then reinstalling it.

Are you sure that you have the right path? Are you executing a standard shortcut that Skype created upon installation?

Is your antivirus software blocking Skype?

To answer your question, I don't think that AHK will be able to circumvent the issues mentioned above, though in some cases, AHK itself needs to be run as admin. In Windows privileges, I don't think there's anything above Administrator, so if a program is not working under such conditions, the cause is likely something else. You can try rebooting, and also running Skype in safe mode. If it runs in safe mode, then it usually means that something else is interfering with the run.

Re: Run Skype with AHK

Posted: 16 Nov 2020, 08:22
by RandomPersson
The problem is that Skype is not installed as a separate app, but as part of Windows Apps.
I do not have access to its folder at all, even as an administrator.
I have messed with permissions and gained access, but seems like Windows updates those
permissions from time to time since I can no longer open the folder.

Even though I can't start the exec directly, I can still open up Skype if I click its icon in start menu.
Which is why I'm asking about other ways of starting Skype, not through the exec directly.

I have no idea how that magical Skype icon in menu start works; it cannot be a direct shortcut
since I wouldn't have permissions for it. I can right-click and "Pin to taskbar", but that pin does
not show up in the folder where all other pins are located.

Re: Run Skype with AHK

Posted: 16 Nov 2020, 08:49
by gregster
Since Skype is part of Windows, Windows should know where it can be found. For me, this works (on Win10):

Code: Select all

run Skype.exe

Re: Run Skype with AHK

Posted: 16 Nov 2020, 09:01
by mikeyww
It seems likely that the Skype listing exists as a .LNK file (Windows shortcut). In AHK, you can use Run to execute that shortcut file. You can usually find the shortcut file in one of the following directories.

c:\Users\[username]\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\

c:\ProgramData\Microsoft\Windows\Start Menu\Programs\

Edit after @gregster's post: if Run, Skype.exe does not work, you could try the options above. It would also generally work for any sort of program, Windows or not. Below is my example for Skype for Business.

Code: Select all

Run, c:\ProgramData\Microsoft\Windows\Start Menu\Programs\Skype for Business.lnk

Re: Run Skype with AHK  Topic is solved

Posted: 16 Nov 2020, 14:08
by malcev
UWP applications You need to run with shell

Code: Select all

Run, shell:Appsfolder\Microsoft.SkypeApp_kzf8qxf38zg5c!App
Or with IApplicationActivationManager interface

Code: Select all

IApplicationActivationManager := ComObjCreate("{45BA127D-10A8-46EA-8AB7-56EA9078943C}", "{2e941141-7f97-4756-ba1d-9decde894a3d}")
DllCall(NumGet(NumGet(IApplicationActivationManager+0)+3*A_PtrSize), "ptr", IApplicationActivationManager, "str", "Microsoft.SkypeApp_kzf8qxf38zg5c!App", "str", 0, "uint", 0, "int*", processId)
ObjRelease(IApplicationActivationManager)
return

Re: Run Skype with AHK

Posted: 16 Nov 2020, 22:30
by kczx3
@malcev dang nice!

Re: Run Skype with AHK

Posted: 17 Nov 2020, 06:45
by RandomPersson
@malcev Thank you, I'll be using the shell one.

@mikeyww Those folders are what I ment by "pin locations". Skype does not show up there.

For anyone curious, I'm leaving the current version of my script.
Sadly, Skype cannot be added through the "options" section with this solution.

Code: Select all

num_on := 0
caps_on := 0
scroll_on := 0
num_down := 0
caps_down := 0
scroll_down := 0



;                   ;
; ==== OPTIONS ==== ;
;                   ;

initial_sleep_time := 0

startup_path := "C:\Users\RandomPersson\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup\optional\"

school := ["Teams"]
browsers := ["Firefox", "Google Chrome"]
online := ["Mozilla Thunderbird", "Steam", "Discord"]
base := ["Core Temp", "GPU-Z", "MicMute", "Notepad++"]

start_school := &caps_on
start_browsers := &scroll_on
start_online := &num_on

stop_everything := &scroll_down

;                   ;
; ---- OPTIONS ---- ;
;                   ;



sleep, %initial_sleep_time%

num_on := GetKeyState("NumLock", "T")
caps_on := GetKeyState("CapsLock", "T")
scroll_on := GetKeyState("ScrollLock", "T")
num_down := GetKeyState("NumLock", "P")
caps_down := GetKeyState("CapsLock", "P")
scroll_down := GetKeyState("ScrollLock", "P")

if (strget(stop_everything)) {
  ExitApp
}

for index, element in base {
  run, %startup_path%%element%.lnk, %startup_path%
}

if (strget(start_online)) {
  for index, element in online {
    run, %startup_path%%element%.lnk, %startup_path%
  }
}

if (strget(start_browsers)) {
  for index, element in browsers {
    run, %startup_path%%element%.lnk, %startup_path%
  }
}

if (strget(start_school)) {
  for index, element in school {
    run, %startup_path%%element%.lnk, %startup_path%
  }
  run, shell:Appsfolder\Microsoft.SkypeApp_kzf8qxf38zg5c!App
}

ExitApp

Re: Run Skype with AHK

Posted: 17 Nov 2020, 07:52
by mikeyww
OK.

From reading this thread, one conclusion appears to be that, without knowing the magic shell line, there is no fast, easy, and convenient way-- short of AHK or a new customized shortcut, for example-- to run Skype from the command line or via an existing shortcut. Is that correct? It doesn't seem like Microsoft would do that. They did that?

Re: Run Skype with AHK

Posted: 17 Nov 2020, 07:57
by gregster
Like I said, for me, run Skype.exe works just fine on Win10. Don't know if anyone tried that..

Re: Run Skype with AHK

Posted: 17 Nov 2020, 08:01
by mikeyww
Thank you for the reminder! I'm encouraged (about moving to Win10). :D

For @RandomPersson: why use the shell command instead of this easier approach?

Re: Run Skype with AHK

Posted: 17 Nov 2020, 08:12
by gregster
Btw, run lync.exe works for me to start Skype for Business (but I have only Office 2013 or whatever on this computer - Lync seems to be the old name for this module):
https://en.wikipedia.org/wiki/Skype_for_Business wrote:In 2015, the software was rebranded from Lync to Skype for Business, co-branding it with the Microsoft-owned consumer messaging platform Skype (which had begun to integrate with Lync in 2013).
Not sure, if that exe-name is still up-to-date. (But the exe could be found in the office folder, so an absolute path would be possible as well.)

Re: Run Skype with AHK

Posted: 17 Nov 2020, 08:16
by mikeyww
Yes, I use Office 16.0.12527.21104, and Microsoft seems to have stuck with the lync.exe name while branding it as Skype for Business, at least in what I currently have. As far as I know, they are actually making a transition to Microsoft Teams, though I don't know whether they will disable access to Skype in either of its forms.

Re: Run Skype with AHK

Posted: 17 Nov 2020, 08:20
by malcev
RandomPersson, You can create shortcut of any application like this
start->run->shell:Appsfolder
Choose Your application->right mouse button->create shortcut

Re: Run Skype with AHK

Posted: 17 Nov 2020, 08:21
by gregster
@mikeyww: Good to know. Here, it must have silently updated itself after the rebranding - while I have Office 2013, it's clearly Skype for Business 2015 (and I have never used it before).