Stardew Valley autohotkey script - autohotkey

I have a problem with my autohotkey script for stardew. I for some reason can't get it to cast for me on button 4.I currently have this code which by all account should work:
#IfWinActive Stardew Valley
XButton1::
SendInput, {LButton Down}
KeyWait, LButton, T1.0248
SendInput, {LButton Up}
Return

If you have problems with #IfWinActive, then you probably haven't entered the window name that AutoHotkey is seeing. Use the WindowSpy utility from your AutoHotkey installation folder to find the correct window name.
Alternatively you could try using #IfWinActive ahk_exe proccessname.exe.
And if your game runs as admin, then you might have to run your script as admin too.

Related

Ctrl+Click to Simple Click on explorer - AHK

I'm trying to make Ctrl+Click just simple Click on explorer with AutoHotkey.
#IfWinActive ahk_exe explorer.exe
^LButton:: LButton
;
#IfWinActive ahk_exe explorer.exe
^LButton:: Send {Ctrl Up}{LButton}
I tried these two scripts, but they didn't work.
Still, with ^LButton, I could select multiple files.
Thanks for the help.
^LButton::LButton shouldn't work, because internally the easy remapping syntax expands to a send command with {Blind}. Or more clearly said, modifiers, that are held down, are left as is.
However, ^LButton::Send, {Ctrl Up}{LButton} should be fine.
And it does work on my system as expected.
{Ctrl Up} is redundant though, since the Send command automatically releases modifiers before sending (unless in blind mode).
Maybe try this just in case:
#IfWinActive, ahk_exe explorer.exe
^LButton::SendInput, {LButton}
#IfWinActive
Also switched over to SendInput(docs) due to it being the recommended faster and more reliable send mode.

AutoHotkey script to right click and save an image in Word

I am trying to make a script to allow me to right click on an image and use the context menu to save it as an image at the default location and with the default image name that Word selects. I am trying to reduce a (Right Click -> Button press -> Enter) sequence to just a Ctrl + RClick combo.
Context menu screenshot
Default location and image name
This is what I have right now, which does not work:
^RButton::
MouseClick, right
Sleep, 500
Send, s
Sleep, 500
Send, {Enter}
return
Apologies if I am doing something stupid, I just started using ahk today.
Try
#IfWinActive ahk_exe WINWORD.EXE ; only if MS Word is the active window
^RButton::
KeyWait, Ctrl, L ; wait for the Control key to be released
Click right
WinWait, ahk_class Net UI Tool Window ; Word's context menu
WinActivate, ahk_class Net UI Tool Window
WinWaitActive, ahk_class Net UI Tool Window
Send, s
WinWait, Save As Picture
WinActivate, Save As Picture
WinWaitActive, Save As Picture
Send, {Enter}
return
#IfWinActive
https://www.autohotkey.com/docs/commands/_IfWinActive.htm

AutoHotKey alt stays pressed

I have this script
+#^a::
SetTitleMatchMode 2
IfWinExist InterCounter
{
WinActivate
Send x
Send !{ESC}
}
return
after using it, alt stays pressed and I have to press alt on my keyboard to get to normal state (no key pressed). If I forget to do it and type something, a key shortcut is initiated. If I type SPACE for example, ALT+SPACE is pressed.
I tried various things. {Alt up} and other. They did not work. Where is the problem? Is there a fix for my script?
(would do that in a comment if I could)
try to Send , {ALT down}{ALT up} which should do the trick. If not something else is interfering, like a 3d party program. Try close everything on your system except notepad and the AHK-script and see if that helps.

How to activate a window after it has lost focus?

So i am using this great software called Website-Watcher, which is rss feed reader and web content tracker.
I have configured it to open external links in firefox, which is opening tabs in the background.
BUT the problem is that Website-Watcher looses focus after i hit some link, so is there a way to open a link, regain lost focus and send click to be able to scroll, i have found a script that activates window on mouse scroll BUT the scroll functionality of program is not regained.
Please, give me some ideas!
EDIT UPDATE::: I have finally made it work, the problem was with the Windows 8.1 Admin rights, because i run Website-Watcher elevated, script that i was using stopped working.
The scripts are here:
http://www.autohotkey.com/board/topic/6292-send-mouse-scrolls-to-window-under-mouse/
http://www.autohotkey.com/board/topic/99405-hoverscroll-verticalhorizontal-scroll-without-focus-scrollwheel-acceleration/?p=623967
With those scripts you can perform scroll without activating windows or if you use the former you can even activate windows with mouse scroll.
Use WinActivate
For example, WinActivate Untitled - Notepad would activate (bring focus to) the window "Untitled - Notepad". This title must be exact and is case-sensitive.
It might be easiest to do this in a low-tech way. I'm not familiar with Website-Watcher, so I'll share a script I use that you should be able to adapt.
I use Feedly in Chrome for RSS reading, and hitting "v" in Feedly opens the story in a new tab. I use my Media Play button to hit "v" and bring me back to Feedly:
Media_Play_Pause::
send v
sleep 50
send {Ctrl Down}{Shift Down}{Tab}{Shift Up}{Ctrl Up}
return
So, define your hotkey, have it trigger the link to open in Firefox, and then hit Alt-Tab to jump back:
X::
send y
sleep 50
send {Alt Down}{Tab}{Alt Up}
return
Obviously, replace "X" and "y" above.
I don't care about using my Media Play button for anything else, but if you want your hotkey to be context sensitive, use #IfWinActive.
Use "WinGet, variableName , List, yourWindowName" (without quote)
then call your variableName contate it with 1 in every ControlSend
for example :
WinGet, nexid, List, myHyperTerminal
ControlSend, , {shift down}at=cmgs{shift up}=303{ENTER}, ahk_id %nexid1%
sleep, 1000
ControlSend, , {shift down}sms{shift up}{space}10000, ahk_id %nexid1%
sleep, 1000
if you want to use control key such as shift, ctrl, alt, don't forget to add "SetKeyDelay, intDelay, intPressDuration" (without quote)
for example the script will be list this
#usehook on
SetKeyDelay, 50, 20
WinGet, nexid, List, zz1
$F6::
ControlSend, , {shift down}at=cmgs{shift up}=303{ENTER}, ahk_id %nexid1%
sleep, 1000
ControlSend, , {shift down}sms{shift up}{space}10000, ahk_id %nexid1%
sleep, 1000
return
$F7::pause
it will be sent to active/inactive window "zz1" as :
AT+CMGS=303
SMS 10000

Press a button with postmessage

There is a way to make a mouse click with postmessage, a solution without moving the mouse (no click x, y)?
For example:
loop{
hotkey,ctrl,pressb
}
pressb:
msgbox a button
PostMessage, 0x0201, , 9765141, ahk_class #32770
PostMessage, 0x0202, , 9765141, ahk_class #32770
; or ControlClick, x95 y115, ahk_class #32770
return
Functions PostMessage and ControlClick don't work, the button is not pressed.
Each of these should work
ControlClick, Button1, ahk_class #32770
ControlClick, OK, ahk_class #32770
I had the same problem (until just recently). Most of the AutoHotKey interactive commands (such as SendMessage, ControlClick, SendRawMessage and so on) does not work within a 32700 window (a dialog) as well as other windows.
Solution: If you're running Windows 7. You need to run your AHK script as an administrator. To do this, right click on your AutoHotKey Script and click on 'Run as administrator'.