Sorry for the first part I tried asking on the discord reddit page and got my post deleted and an angry DM from a moderator
Code: Select all
^Enter::
loop
{
send, {up}
send, ^a
send, {BS}
send, {Enter}
sleep, 100
}
^`::ExitApp
Code: Select all
^Enter::
loop
{
send, {up}
send, ^a
send, {BS}
send, {Enter}
sleep, 100
}
^`::ExitApp
Code: Select all
^Enter::
loop
{
send, {up}
send, ^a
send, {BS}
send, {Enter}
sleep, 100
; Missing send, {Enter} ??
}
^`::ExitApp
Code: Select all
WinGetActiveTitle, Window_name
Win_Discord := "DISCORD"
Found_Discord := InStr( Window_name, Win_Discord, false ) ;AHK builtin function
If !( Found_Discord >= 1 )
{
MsgBox, 1,!!WARNING!! ,The Client Window "%Win_Discord%" NOT Found. Found "%Window_name%"%lf_char%%lf_char%Press ENTER Key to Ignore Warning and Continue., 5 ; -seconds before timeout.
IfMsgBox, Cancel
exit ; User pressed the "Cancel" button.
;Tell the user what is happening if the script quits
IfMsgBox, Timeout
{
SplashTextOn,,, Script EXITING Now
Sleep 2000
SplashTextOff
exit ; i.e. Assume "Cancel" if it timed out.
}
}
WinActivate, Window_name ;Refocus in case user moved mouse to click
;
Code: Select all
if ( !( WinActive(Window_name) ) ) {
ExitApp ;user changed focus. Exit
}
Code: Select all
;Save as DiscordDM_Delete1.ahk
;
;Date 12/19/21 Version 0.01 Direct Message(DM) delete script for Win10 Stand Alone Discord Client, Brave, FireFox64
;
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
^Enter::
WinGetActiveTitle, Window_name
Win_Discord := "DISCORD"
Found_Discord := InStr( Window_name, Win_Discord, false ) ;AHK builtin function
If !( Found_Discord >= 1 )
{
MsgBox, 1,!!WARNING!! ,The Client Window "%Win_Discord%" NOT Found. Found "%Window_name%"%lf_char%%lf_char%Press ENTER Key to Ignore Warning and Continue., 5 ; -seconds before timeout.
IfMsgBox, Cancel
exit ; User pressed the "Cancel" button.
;Tell the user what is happening if the script quits
IfMsgBox, Timeout
{
SplashTextOn,,, Script EXITING Now
Sleep 2000
SplashTextOff
exit ; i.e. Assume "Cancel" if it timed out.
}
}
WinActivate, Window_name ;Refocus in case user moved mouse to click
loop
{
if ( !( WinActive(Window_name) ) ) {
ExitApp ;user changed focus. Exit
}
send, {up}
sleep, 100
send, ^a
sleep, 200
send, {BS}
sleep, 100
send, {Enter}
sleep, 100
send, {Enter}
sleep, 300
}
^`::ExitApp
Code: Select all
;Save as DiscordDM_Delete4.ahk
;Date 12/16/21 Version 0.14 Direct Message(DM) delete script for Win10 Stand Alone Discord Client, Brave, FireFox64
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
^j::
global lf_char := CHR(10) ;AKA ( newline char ) needed for posting to YouTube
; Check for Discord Message Window.
WinGetActiveTitle, Window_name
Win_Discord := "DISCORD"
Found_Discord := InStr( Window_name, Win_Discord, false ) ;AHK builtin function
If !( Found_Discord >= 1 )
{
MsgBox, 1,!!WARNING!! ,The Client Window "%Win_Discord%" NOT Found. Found "%Window_name%"%lf_char%%lf_char%Press ENTER Key to Ignore Warning and Continue., 5 ; -seconds before timeout.
IfMsgBox, Cancel
exit ; User pressed the "Cancel" button.
IfMsgBox, Timeout
{
SplashTextOn,,, Script EXITING Now
Sleep 2000
SplashTextOff
exit ; i.e. Assume "Cancel" if it timed out.
}
}
WinActivate, Window_name ;Refocus in case user moved mouse to click
;
; Set sleep wait times to allow Discord server to keep up.
waitTime := 100 ;Increase by 25 if delete is intermittent
2_waitTime := ( waitTime * 2 )
3_waitTime := ( waitTime * 3 )
4_waitTime := ( waitTime * 4 )
;
Loop_max := 300
;
ToolTip, Delete DM Script Running in %Window_name%. HOLD SHIFT Key to Stop.
send, {Escape}
;
Loop, %Loop_max%
{
GetKeyState, state, Shift ;Check if either SHIFT key is held DOWN to stop script
if ( !( WinActive(Window_name) ) or (state = "D") ) {
Break ;user changed focus or shift key down. Exit loop
}
send, {Up}
send, ^a
sleep, waitTime ;Needed to allow the server time to highlight text
send, {BS}
sleep, waitTime
send, {Enter}
sleep, 2_waitTime
send, {Enter}
sleep, 4_waitTime ;increase waitTime if intermittent highlighting
send, {Escape} ;exits edit mode
sleep, waitTime
send, {Escape} ;sends focus to chat input line
sleep, waitTime
}
ToolTip
send, {Escape} ;sends focus to chat input line
SplashTextOn,,, Script EXITING Now
Sleep 2000
SplashTextOff
exit
Users browsing this forum: filipemb, NinjoOnline and 292 guests