Send script

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
gazmoz17
Posts: 72
Joined: 14 Mar 2018, 09:37

Send script

16 Jul 2018, 10:31

Have the below as part of my script:


^Up::WinMaximize, A ; Assign a hotkey to maximize the active window.

*This works...but doesnt work as part of the below script


F1::
Send !{y} ; Simulates the keypress alt+y
Sleep, 1000 ;wait 1 second
Send {ctrl down}Up{ctrl up}; sends the script to maximiz active window
Sleep, 1000 ;wait 1 second
Send {F4}
return ; Finished

For some reason doesnt maximise active window?...any help much appreciated

Many Thanks
User avatar
mshall
Posts: 35
Joined: 13 Jul 2018, 16:42
Contact:

Re: Send script

16 Jul 2018, 11:13

shimanov posted a good solution to this

https://autohotkey.com/board/topic/5444 ... er-hotkey/

use gosub

Code: Select all

!z::
	MsgBox, z
return

F10::
	Gosub, !z
return
gazmoz17
Posts: 72
Joined: 14 Mar 2018, 09:37

Re: Send script

17 Jul 2018, 04:04

Sorry mshall thats why over my head!

How do I send alt q & p press together.

So if I press the End button its sends the key press of alt, q & p- which is a shortcut already built into the software I'll be using?

Any help much appreciated.
gazmoz17
Posts: 72
Joined: 14 Mar 2018, 09:37

Re: Send script

17 Jul 2018, 04:20

End::
Send !{Q & P}
Return
User avatar
Frosti
Posts: 426
Joined: 27 Oct 2017, 14:30
Contact:

Re: Send script

17 Jul 2018, 04:50

And for your maximize problem try to use the handle of your window:
WinID:=WinExist("NameOfYourWindowPlaceHere")
WinMaximize, ahk_id %WinID%
gazmoz17
Posts: 72
Joined: 14 Mar 2018, 09:37

Re: Send script

17 Jul 2018, 08:44

Cheers frosti much appreciated! Tried the alt q p works perfect, not tried other yet
gazmoz17
Posts: 72
Joined: 14 Mar 2018, 09:37

Re: Send script

17 Jul 2018, 08:55

Hi Frosti, cant get the other one to work after the send alt y bit?

F1::
Send !{y} ; Simulates the keypress alt+y
Sleep, 1500 ;wait 1 second
WinID:=WinExist(Activity)
WinMaximize, ahk_id %WinID%
Sleep, 1000 ;wait 1 second
Send {F4}
return ; Finished

Dont know if ive put the correct '"NameOfYourWindowPlaceHere"

On my Active Window Spy...Window Title, Class and process
Activity
ahk_class#32770
ahk_exe SBDDesktop.exe

Any help much appreciated, thanks in advance
gazmoz17
Posts: 72
Joined: 14 Mar 2018, 09:37

Re: Send script

17 Jul 2018, 09:34

Hi,

The below will maximise the acive window but wont send F4>

F1::
Send, !{y} ; Simulates the keypress alt+y
Sleep, 1500
WinMaximize, A
Sleep, 3000
Send, {F4}
Return ; Finished

Thanks
Freire
Posts: 16
Joined: 10 Dec 2017, 11:30

Re: Send script

17 Jul 2018, 11:35

gazmoz17 wrote:F1::
Send !{y} ; Simulates the keypress alt+y
Sleep, 1500 ;wait 1 second
WinID:=WinExist(Activity)
WinMaximize, ahk_id %WinID%
Sleep, 1000 ;wait 1 second
Send {F4}
return ; Finished
Try this instead:

Code: Select all

WinID:=WinExist("Activity")
About the F4, I don't have any issues sending F4 on this script. With Explorer.exe and Notepad.exe at least.
gazmoz17
Posts: 72
Joined: 14 Mar 2018, 09:37

Re: Send script

18 Jul 2018, 09:49

Hi, that all works great thanks and ive read some articles and reverse engineered a few things but...

Program Im in has existing shortcut alt f x (to close a the software program) I dont want to assign a single key to replicate this as theres too many to remember and im familiar with existing shortcut sequence.

But dont know how to write beginning of the script, I get errors at first line (alt f x)

!fx:
Send, {LAlt Down}n{LAlt Up}
Return
The alt n press closes a window pop ub box which asks you to confirm if the program wants to be backed up. n being no

Thanks in advance
gazmoz17
Posts: 72
Joined: 14 Mar 2018, 09:37

Re: Send script

18 Jul 2018, 09:51

Similarilyexisting program short cut alt 01

I want to pres alt 01 and then get that to send tab 3 times?

Many Thanks
gazmoz17
Posts: 72
Joined: 14 Mar 2018, 09:37

Re: Send script

18 Jul 2018, 09:53

!01::
Send, {tab}
Sleep 250
Send, {tab}
Sleep 250
Send, {tab}
Return

Same error first line??

Thanks

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: OrangeCat and 162 guests