Search code examples
windowsbatch-filecursor

Is there a way I can make a exe, bat or other file in Windows type to change the cursor to 'busy' after execution?


I am trying to simulate a busy window or even more simple, a busy cursor by executing a file that will change the cursor for a set amount of time. I would like to be able to control the amount of time the cursor is on 'busy'. Any ideas?


Solution

  • You could create an AutoHotkey script.

    Use this SetSystemCursor function and add the following at the top in the auto-execute section:

    #NoTrayIcon
    #Persistent
    
    DefaultBusyTime := 1000
    SetSystemCursor("IDC_WAIT")
    If %0% > 1
        SetTimer,RestoreSystemCursor,-%1%
    Else
        SetTimer,RestoreSystemCursor,-%DefaultBusyTime%
    Return
    
    RestoreSystemCursor:
        SetSystemCursor("Restore")
        ExitApp
    Return
    

    Complete script: busycursor.ahk

    Compile to a standalone executable:

    Ahk2Exe.exe /in busycursor.ahk /out busycursor.exe
    

    Pass the busy wait time in milliseconds as an argument:

    busycursor 2500