AÑADIR ULTIMO EPISODIO A MEDIA PLAYER CLASSIC CON AUTOHOTKEY

Necesito hacer una automatización de capítulos de video y regularmente lo hacia con BACH DOS, pero ya tope, bueno, Tengo un listado de archivos de video nombrados en este orden capítulos dentro de una carpeta, (A_WorkingDir) pero algunos pueden ser de diferentes extensiones: avi, mp4 o mkv, lo importante es que están numerados de la siguiente forma:

  • Cap_001.avi
  • Cap_002.mp4
  • Cap_003.avi
  • Cap_004.mkv
  • Etcétera…

Como referencia para no hacer o editar el código se me ocurrió usar el directorio actual:

  1. Al ejecutar el script dentro de la misma carpeta de los archivos: que el Cap_001 se mueva a una carpeta nueva llamada EMITIDOS dentro del directorio actual independientemente de su extensión

  2. Por ultimo lo desearia añadir a la lista de reproduccion de Media Player Classic

posible codigo no terminado, agradeceria cualquier sugerencia y corrección:

ext=avi,mp4,mkv

RegExMatch(A_LoopFileFullPath,"^D*d{>0}$", mayor)

Loop, %A_WorkingDir%*.*, D
{
if A_LoopFileExt in %ext%
    FileMove, %mayor%, %A_WorkingDir%emitidos
}

archivo=FileMove, %mayor%, %A_WorkingDir%emitidos

run mpc-hc64.exe / %archivo% /add


exit

How can i use Autohotkey to open google chrome paste a link and restore focus back to the original focus?

So I’m really new to ahk (any tips are well appreciated) I’ve never coded before too so this is really confusing me. What I’m trying to do is create a code that allows me to open the chrome app if not already open, paste a link change focus to the zoom application, click on the join with audio button. If you can, can you make it so it brings the focus back to the original window?

Yeah, I know that I shouldn’t join my zooms without being there but I leave to eat or just go downstairs a lot and my teachers don’t let anyone in after 5 minutes of the meeting starting. If you need any other information please ask and I will provide it.

One of my friends had a code to do something he said was similar so here

SetControlDelay -1

!PgDn::
    ActiveWindow := WinActive("A") ;store the hwnd of current active window
    Run, https://www.google.com
    WinWaitActive, ahk_exe chrome.exe ;wait for chrome to get focus
    WinActivate, % "ahk_id " ActiveWindow ;restore focus
    ControlClick, x1570 y600, Google - Google Chrome, , , , NA
Return

keyboard – Autohotkey – GetKeyState breaks if a new key is pressed

I’m trying to create a script that presses the space button, as long as it is physically pressed.
By example, if I hold down the space bar, the script would replicate spaces with Send. As soon as I release the spacebar, it stops sending space.
I’ve achieved this with this script

#NoEnv
#SingleInstance Force
SendMode Input
loop {
    if (GetKeyState("Space"))
    {
        Send {Space down}
        Random, r, 5, 15
        Sleep, %r%
        Send {Space up}
    }
    Random, r, 5, 10
    Sleep, %r%
}
Esc::
ExitApp
return

This works, however, if I press a new key while pressing the Space button, the GetKeyState("Space") would return false for some reason.
The script currently starts properly, but pressing any other key is the same as releasing the spacebar, which is not what I want.

So then I thought, maybe Input can help me. Well, again, it worked, but as soon as I pressed a different key, it would stop.

Here’s what I tried with Input that produced the same results, relatively (with offsets in timing) from the first sample I tried.

#NoEnv
#SingleInstance Force
SendMode Input
loop {
    Input, OutputVar, B I L4 T0.05 V ; Had to keep it a low timeout due to the nature of the script
    if (InStr(OutputVar, Chr(32)))
    {
        Send {Space down}
        Random, r, 5, 15
        Sleep, %r%
        Send {Space up}
    }
    Random, r, 5, 10
    Sleep, %r%
}
Esc::
ExitApp
return

This also fails because pressing a new key internally releases my spacebar from being pressed.

I’d try to do keybind events like Space::, but it would also be fired from the Send commands, creating an infinite loop. And I wouldn’t want to press any other key than space, as several of my keys are binded to something or another.

It feels like filter keys, or sticky keys, because even without autohotkey, the spacebar releases after pressing any other key. But both of those features are turned off. And it’s not just the spacebar. Any held key is released as soon as a new key is pressed. Filter keys does exactly what I’m trying to prevent, but there’s no ‘reverse filter keys’ so to speak. Is it possible to get by with this hardware limitation? How can I have autohotkey work in the sense where it see’s that I’m holding space, even after a new key has been pressed?

Autohotkey: Find and focus windows by name accross virtual desktops

I’d like an ahk script to find and focus running windows across virtual desktops on Windows 10.

I found one earlier but alas forgot where it’s from, maybe someone here knows. I think it was to help with special keys shortcuts not working in VNC sessions (Win key, alt-tab for example). Sadly, because it’s quite good but lacks a keyboard search feature, rather it works with keyboard or mouse selection and sorts by most recently used. So if I could find an updated version, or its source (to contact its dev) which has this search feature, perfect! Here’s the code I have:

#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn  ; Enable warnings to assist with detecting common errors.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.


$F1:: AltTab()
$F2:: AltTabMenu()
$F4:: LWin
!`::WinClose, A  ; Alt-` = close window

; AltTab-replacement for Windows 8:
AltTab(){
    list := ""
    WinGet, id, list
    Loop, %id%
    {
        this_ID := id%A_Index%
        IfWinActive, ahk_id %this_ID%
            continue    
        WinGetTitle, title, ahk_id %this_ID%
        If (title = "")
            continue
        If (!IsWindow(WinExist("ahk_id" . this_ID))) 
            continue
        WinActivate, ahk_id %this_ID%, ,2
            break
    }
}

; AltTabMenu-replacement for Windows 8:
AltTabMenu(){
    list := ""
    Menu, windows, Add
    Menu, windows, deleteAll
    WinGet, id, list
    Loop, %id%
    {
        this_ID := id%A_Index%
        WinGetTitle, title, ahk_id %this_ID%
        If (title = "")
            continue            
        If (!IsWindow(WinExist("ahk_id" . this_ID))) 
            continue
        Menu, windows, Add, %title%, ActivateTitle      
        WinGet, Path, ProcessPath, ahk_id %this_ID%
        Try 
            Menu, windows, Icon, %title%, %Path%,, 0
        Catch 
            Menu, windows, Icon, %title%, %A_WinDir%System32SHELL32.dll, 3, 0 
    }
    CoordMode, Mouse, Screen
    MouseMove, (0.4*A_ScreenWidth), (0.35*A_ScreenHeight)
    CoordMode, Menu, Screen
    Xm := (0.25*A_ScreenWidth)
    Ym := (0.25*A_ScreenHeight)
    Menu, windows, Show, %Xm%, %Ym%
}

ActivateTitle:
    SetTitleMatchMode 3
    WinActivate, %A_ThisMenuItem%
return

;-----------------------------------------------------------------
; Check whether the target window is activation target
;-----------------------------------------------------------------
IsWindow(hWnd){
    WinGet, dwStyle, Style, ahk_id %hWnd%
    if ((dwStyle&0x08000000) || !(dwStyle&0x10000000)) {
        return false
    }
    WinGet, dwExStyle, ExStyle, ahk_id %hWnd%
    if (dwExStyle & 0x00000080) {
        return false
    }
    WinGetClass, szClass, ahk_id %hWnd%
    if (szClass = "TApplication") {
        return false
    }
    return true
}

for a script named vnc special keys.ahk, but this might be a name I gave it. Sorry not much more details on this, I’ve looked around (Google, Github) but haven’t found it. And kids, remember to put a comment in your code with at least the author and source website 😛

Also found this old 2010 script

autohotkey – AHK code issue – Defining variables and getting mouse click at location?

I’m pretty new to AHK. I just started like a couple days ago, and I’ve hit a stump and need help debugging.

I would like this code to go to a specified mouse position and click the coordinate, and import my variables since I will have many AHK scripts referring to the same variables.

PROBLEM: The code currently does not move the mouse and click in the desired location. I am not even sure if it is clicking. It simply displays the ToolTip message as well as the msgbox message. (The messages that will display are marked in the code as working via (works)). I think this might be because the variables are somehow not defined… When the variable displayed in the msgbox was defined in the if/else statement, the msgbox would be empty. The Clicks aren’t working either, and I think it’s because the values aren’t existent. I have no idea why in the world this is happening.

What is wrong with my code and what is going on? Please help me!

#include C:UsersusernameDesktopvars.txt
CoordMode, Mouse, Screen
clickThing(whichThing) { ;START FUNCTION
    Sleep, 1000 ; sleep 1 sec
    Send ^h ; control h
    Sleep, 3000 ; sleep 3 sec
    if (whichThing = 1){
        goTox = %x1%
        goToy = %y1%
        ToolTip, option 1 ; display "option 1" @ cursor tip ; (works)
    } else if (person = 2) {
        goTox = %x2%
        goToy = %y2%
        ToolTip, option 2 ; display "option 2" @ cursor tip ; (works)
    } else if (person) = 3 {
        goTox = %x3%
        goToy = %y3%
        ToolTip, option 3; display "option 3" @ cursor tip ; (works)
    } else {
        msgbox that isn't a valid choice. ; (works)
        return
    }
    msgbox %goTox% %goToy% ; msgbox will be empty...
    ; I tried this
    Sleep 1000
    MouseMove, %goTox%, %goToy%, 30
    MouseClick, left, %goTox%, %goToy%
    Sleep 500
    MouseClick, left, %goTox%, %goToy%
    Sleep 1000
    ; I also tried this
    Click %goTox%, %goToy%
} ;END OF FUNCTION

;START MAIN CODE
IfWinActive, window_name {
    clickThing(1)}
else{
    msgbox, window not active ; (works)
}

msgbox, finished ; (works)
return

autohotkey – AHK script that loops up to RMB publication

I'm trying to create a script that, when you hold down the mouse button:
Also press the right mouse button and hold it down (aim)
Cycle between pressing "q" for 0.5 seconds (lean left), release and wait 0.5 seconds and press "e" for 0.5 seconds (lean right). And then, the loop returns to leaning left until the right mouse button is released.

That's what I've had so far and I do not know how to get there.

RButton::
Send {RButton down}
Loop
{
    If GetKeyState("RButton")
    {
    Send {q down}
    Sleep, 500
    Send {q up}
    Sleep, 500
    Send {e down}
    Sleep, 500
    Send {e up}
    Sleep, 500
    }
Else
Break
}
KeyWait, RButton
Send {RButton up}
return

Currently, it works but will not stop if you release the right mouse button. I've tried to set up an Else Break there, but that gives me a mistake by saying that there is no match for anyone else.

Can this script be programmed to stop immediately when the RMB is released instead of going through the entire loop to check if the RMB is released?

In addition, is there a way to randomize (50% chance) to start with an "e" instead of a "q"?

keyboard shortcuts – AutoHotKey: How to add special character chips with a string of letters?

I'm trying to add special characters (different types of points as seen on the last line.

Special characters in the Windows character map

It works but I would like to use a chain of letters

#+d::Send {U+25CF} ; dot solid

I've tried using this – but it does not work

:R*?:dot1::Send {U+25CF} ; dot solid

Does anyone know how to make it work?

Autohotkey for loot in the Tibia

I made the following command to grab an item and drag it into a bag, but that does not work, can anyone help?
~ NumpadDel :: SendInput {MouseClickDrag, 240, 345, 202, 515}

How to click on the v key by simply clicking on v without a mouse click but at 18 cps with autohotkey

Battery Exchange Network

The Stack Exchange network includes 175 question-and-answer communities, including Stack Overflow, the largest and most reliable online community on which developers can learn, share knowledge and build their careers.

Visit Stack Exchange

autohotkey – The activation of AHK Window does not work when launching the program

I am currently the following code to start the SpeedCrunch program by pressing Win + C

#c ::
IfWinExist, SpeedCrunch
{
WinActivate
}
IfWinNotExist, SpeedCrunch
{
Run, speedcrunch.exe, C:  Program Files (x86)  SpeedCrunch, UseErrorLevel
WinActivate
}
return

Enabling the window when the program is running works perfectly. However, when the program is not running, the program is started in reduced mode and not enabled, which means that it is necessary to press Win + twice. C to launch and activate the Speedcrunch focus, even if the launch command contains "WinActivate". Why it does not work?