Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

Pin .ahk to Start screen


  • Please log in to reply
8 replies to this topic
AHKJeff
  • Members
  • 94 posts
  • Last active: May 01 2016 05:13 PM
  • Joined: 09 Feb 2014

I'm hoping this will prove to be a simple question.

 

How do you pin an .ahk script file to the Win 8.1 Start screen (the screen that has all the Metro apps)?

 

TIA!



GEV
  • Members
  • 1364 posts
  • Last active:
  • Joined: 23 Oct 2013

Create a shortcut to your script in

 

C:\ProgramData\Microsoft\Windows\Start Menu



AHKJeff
  • Members
  • 94 posts
  • Last active: May 01 2016 05:13 PM
  • Joined: 09 Feb 2014

Create a shortcut to your script in

 

C:\ProgramData\Microsoft\Windows\Start Menu

 

Thanks very much GEV. I now have hope to get this working.  :)

But I could still use a bit of help.

 

It's a very simple script, that when run from the desktop screen, sends Alt-F4,

then {UP}, then {Enter}.

 

These keystrokes shutdown my tablet (the fastest way to do it).

 

When I put the shortcut to the script in the Start Menu location you mentioned above, and ran it from the Metro Apps screen,

the tablet switched over to desktop view and the script stalled right there.

 

The only other thing I saw happen was an AutoHotKey green icon briefly showing up in the taskbar and then disappearing.

That was it. No shutdown.

 

I tried putting in Sleeps at the beginning of the script as well as doubling the Alt-F4 with a Sleep in between, but I still got the same results as above.

 

Any ideas on how to get the script to run properly from the Start Screen (Metro Apps screen)?



GEV
  • Members
  • 1364 posts
  • Last active:
  • Joined: 23 Oct 2013

Try

WinWait, 
WinActivate, 
WinWaitActive, 


AHKJeff
  • Members
  • 94 posts
  • Last active: May 01 2016 05:13 PM
  • Joined: 09 Feb 2014

 

Try

WinWait, 
WinActivate, 
WinWaitActive, 

 

Thanks GEV.

The problem with those commands is that you need to supply a Window title or Window text.

For the situation I'm in (either Start screen or Desktop), there is no Window that I need to wait for.



GEV
  • Members
  • 1364 posts
  • Last active:
  • Joined: 23 Oct 2013

You can use the simple command

ShutDown 8

in your script.



AHKJeff
  • Members
  • 94 posts
  • Last active: May 01 2016 05:13 PM
  • Joined: 09 Feb 2014

You can use the simple command

ShutDown 8

in your script.

 

Sorry, I need to give you more clarification.

The button I'm looking for would put the tablet into Sleep mode, not Shut it down.

 

I misled you a bit in my initial post.

The commands I gave are correct:

Alt F4

{Up}

{Enter}

 

When you are on the Desktop, (this is important, not the Start Screen)

and you press Alt F4, it brings up a shutdown menu.

If you then press the {Up} key you would select, 'Sleep mode'.

Then {Enter} would activate the Sleep selection and put the tablet to sleep.

 

These three keystrokes work nicely with a script running from the Desktop.

I would now like to run this script from the Start Screen.

But as you can see, there are a whole new set of difficulties when I try to run it there.

 

Any suggestions?

 

I have successfully created a Power Down button and a Hibernate button for the Start Screen.

Now I would like to create the most important one (the one I use the most), a Sleep button.



GEV
  • Members
  • 1364 posts
  • Last active:
  • Joined: 23 Oct 2013
WinActivate, ahk_class Progman     ; desktop
WinWaitActive, ahk_class Progman
Send, !{F4}
Sleep, 200
Send, {Up}{Enter}


AHKJeff
  • Members
  • 94 posts
  • Last active: May 01 2016 05:13 PM
  • Joined: 09 Feb 2014
WinActivate, ahk_class Progman     ; desktop
WinWaitActive, ahk_class Progman
Send, !{F4}
Sleep, 200
Send, {Up}{Enter}

 Thanks again DEV.

I tried the code above but it just stalls at the desktop.

 

I tap the icon on the Start Screen, it opens the Desktop and the code stalls there.

When I look at what code ran,  by pressing F5, it shows the first two commands have run but nothing

after that.

 

I don't think this tablet's Win 8.1 is recognizing what

 

WinActivate, ahk_class Progman ; desktop
WinWaitActive, ahk_class Progman

 

means.