Run Skype with AHK Topic is solved

Get help with using AutoHotkey and its commands and hotkeys
RandomPersson
Posts: 3
Joined: 16 Nov 2020, 02:47

Run Skype with AHK

16 Nov 2020, 03:12

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".
User avatar
mikeyww
Posts: 5145
Joined: 09 Sep 2014, 18:38

Re: Run Skype with AHK

16 Nov 2020, 07:08

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.
RandomPersson
Posts: 3
Joined: 16 Nov 2020, 02:47

Re: Run Skype with AHK

16 Nov 2020, 08:22

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.
gregster
Posts: 5791
Joined: 30 Sep 2013, 06:48

Re: Run Skype with AHK

16 Nov 2020, 08:49

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
User avatar
mikeyww
Posts: 5145
Joined: 09 Sep 2014, 18:38

Re: Run Skype with AHK

16 Nov 2020, 09:01

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
malcev
Posts: 861
Joined: 12 Aug 2014, 12:37

Re: Run Skype with AHK  Topic is solved

16 Nov 2020, 14:08

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
User avatar
kczx3
Posts: 1250
Joined: 06 Oct 2015, 21:39

Re: Run Skype with AHK

16 Nov 2020, 22:30

@malcev dang nice!
RandomPersson
Posts: 3
Joined: 16 Nov 2020, 02:47

Re: Run Skype with AHK

17 Nov 2020, 06:45

@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
User avatar
mikeyww
Posts: 5145
Joined: 09 Sep 2014, 18:38

Re: Run Skype with AHK

17 Nov 2020, 07:52

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?
gregster
Posts: 5791
Joined: 30 Sep 2013, 06:48

Re: Run Skype with AHK

17 Nov 2020, 07:57

Like I said, for me, run Skype.exe works just fine on Win10. Don't know if anyone tried that..
User avatar
mikeyww
Posts: 5145
Joined: 09 Sep 2014, 18:38

Re: Run Skype with AHK

17 Nov 2020, 08:01

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?
gregster
Posts: 5791
Joined: 30 Sep 2013, 06:48

Re: Run Skype with AHK

17 Nov 2020, 08:12

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.)
User avatar
mikeyww
Posts: 5145
Joined: 09 Sep 2014, 18:38

Re: Run Skype with AHK

17 Nov 2020, 08:16

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.
malcev
Posts: 861
Joined: 12 Aug 2014, 12:37

Re: Run Skype with AHK

17 Nov 2020, 08:20

RandomPersson, You can create shortcut of any application like this
start->run->shell:Appsfolder
Choose Your application->right mouse button->create shortcut
gregster
Posts: 5791
Joined: 30 Sep 2013, 06:48

Re: Run Skype with AHK

17 Nov 2020, 08:21

@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).

Return to “Ask For Help”

Who is online

Users browsing this forum: Bing [Bot], blue83, Google [Bot], guivho, jacek678, Spawnova, viv and 30 guests