Untitled

 avatar
unknown
plain_text
a year ago
42 kB
6
Indexable
SetWorkingDir, C:\AHK\2nd-keyboard\support_files

Menu, Tray, Icon, shell32.dll, 283


#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.

#SingleInstance force

!Numpad3:: InputBox, DirectoryName, Set Active Project Folder, Enter active project folder:,, 300, 130,,,,, %DirectoryName%
Numpad3:: run, %DirectoryName%
Numpad2:: run, C:\Users\Adin\Desktop
Numpad1:: run, C:\Users\Adin\Downloads

XButton1::
sleep 1
Send, {del}
sleep 1
return

NumpadAdd::
IfWinNotExist, ahk_exe Discord.exe
Run, C:\Users\Adin\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Discord Inc\Discord

if WinActive("ahk_exe Discord.exe")
{

} else {
	WinActivate ahk_exe Discord.exe
	return
}

;Asana Opening
Numpad7::
IfWinNotExist, ahk_exe Asana.exe
Run, C:\Users\Adin\AppData\Local\Asana\Asana.exe

if WinActive("ahk_exe Asana.exe")
{

} else {
	WinActivate ahk_exe Asana.exe
	return
}

;Open Chrome
Numpad9::
IfWinNotExist, ahk_exe chrome.exe
	Run, chrome.exe
if WinActive("ahk_exe chrome.exe")
	{
	Sendinput  ^{tab}
	} else {
	WinActivate ahk_exe chrome.exe
	return
	}

;Open Premiere Pro
Numpad8::
IfWinNotExist, ahk_class Premiere Pro
	Run, Adobe Premiere Pro (Beta).exe
WinActivate ahk_class Premiere Pro
Return


#ifwinactive ahk_class Notepad++
^r::
send ^s
sleep 10
Soundbeep, 1000, 500
Reload
Return

SetTitleMatchMode, 2
;Open Effect
#IfWinActive, ahk_class Premiere Pro
Numpad4::
send, ^+!7
sleep 15
Send, ^b
sleep 1
return

SetTitleMatchMode, 2
;Open Projects
#IfWinActive, ahk_class DroverLord - Window Class
Numpad4::
send, ^+!7
sleep 15
return

SetTitleMatchMode, 2
;Open Essential Graphics
#IfWinActive, ahk_class Premiere Pro
Numpad5::
send, ^+!-
sleep 15
return

SetTitleMatchMode, 2
;Open Essential Graphics
#IfWinActive, ahk_class DroverLord - Window Class
Numpad5::
send, ^+!-
sleep 15
return


SetTitleMatchMode, 2
;Open Effect control panel
#IfWinActive, Adobe Premiere Pro
Numpad6::
send, ^+!5
sleep 15
return

SetTitleMatchMode, 2
;Open Projects
#IfWinActive, ahk_class DroverLord - Window Class
Numpad6::
send, ^+!5
sleep 15
return

SetTitleMatchMode, 2
;Open Effect control panel
#IfWinActive, Adobe Premiere Pro
Numpad0::
send, ^+!0
sleep 15
return

SetTitleMatchMode, 2
;Open Projects
#IfWinActive, ahk_class DroverLord - Window Class
Numpad0::
send, ^+!0
sleep 15
return


;F1, F2 Used

;Send ^!s ;ctrl alt s is select clip at playhead
;MouseClick, left ;left mouseclick

SetTitleMatchMode, 2

#IfWinActive, Adobe Premiere Pro
XButton2::
;msgbox, Ripple delete at mouse! best hotkey ever
sleep 1
Send ^!+d ;ctrl alt shift d is ripple delete
sleep 1
return

SetTitleMatchMode, 2

#IfWinActive, Adobe Premiere Pro
^!p::
Send, ^!+5
Sleep, 15
Send, ^b
return

SetTitleMatchMode, 2

;MacroPad
#IfWinActive, Adobe Premiere Pro
#if (getKeyState("F23", "P"))
F23::return
q::preset("TT A Bit Up")
w::preset("TT Up Text")
2::textmaker("item")
4::emojimaker("F234")
e::warpstabilizer("item")
r::timeinterpolation("item")
f::reverseclip("item")
t::emojimaker("F23t")
g::emojimaker("F23g")
c::export("hey")
v::
global VFXkey = "F23v"
instantVFX("scale")
return
#if


reverseclip(item)
{
keywait, %A_PriorHotKey%
sleep 15
send, ^r
sleep 500
sendinput, {tab}
sleep 5
sendinput, {tab}
sleep 5
sendinput, {space}
sleep 5
sendinput, {enter}
}

SetTitleMatchMode, 2

#IfWinActive, Adobe Premiere Pro
;XButton2::
;msgbox, DELETE SINGLE CLIP AT CURSOR with F9
prFocus("timeline") ;This will bring focus to the timeline. ; you can't just send ^+!3 because it'll change the sequence if you alkready have the timeline in focus. You have to go to the effect controls first. That is what this function does.
send, ^!d ;ctrl alt d is my Premiere shortcut for DESELECT. This shortcut only works if the timeline is in focus, which is why we did that on the previous line!! And you need to deselect all the timeline clips becuase otherwise, those clips will also get deleted later. I think.
send, v ;This is my Premiere shortcut for the SELECTION tool.
send, {alt down}
send, {lbutton}
send, {alt up}
send, b ;I have C assigned to "CLEAR" in Premiere's shortcuts panel.
return

prFocus(panel)
{
;READ ALL THE COMMENTS BELOW OR SUFFER THE CONSEQUENCES.

;PrFocus() allows you to have ONE place where you define your personal shortcuts to "focus" panels in Premiere. It also ensures that panels actually get into focus, and don't rotate through the sequences or anything like that.

; THERE IS A FULL VIDEO TUTORIAL THAT TEACHES YOU HOW TO USE THIS, STEP BY STEP.
; [[[[[LINK TBD, IT'S NOT FINISHED JUST YET.]]]]]

;For this function to work, you MUST Go to Premiere's Keyboard Shortcuts panel, and add the following keyboard shortcuts to the following commands:

; KEYBOARD SHORTCUT     PREMIERE COMMAND
; ctrl alt shift 3 .....Application > Window > Timeline (The default is shift 3)
; ctrl alt shift 1 .....Application > Window > Project  (Sets the focus onto a BIN.) (the default is SHIFT 1)
; ctrl alt shift 4 .....Application > Window > Program Monitor (Default is SHIFT 4)
; ctrl alt shift 5 .....Application > Window > Effect Controls (Default is SHIFT 5)
; ctrl alt shift 7 .....Application > Window > Effects  (NOT the Effect Controls panel!) (Default is SHIFT 7)

;(Note that ALL_MULTIPLE_KEYBOARD_ASSIGNMENTS.ahk has the FULL list of keyboard shortcuts that you need to assign in order for my other functions to work.)


;EXPLANATION: In Premiere, panel focus is very important. Many shortucts will only work if a specific panel is in focus. That is why those panels must be put into focus FIRST, which is what I built PrFocus() to do. (It's not always as simple as sending just the one keyboard shortcut to activate that panel.)

;Right now, we do NOT know which panel is in focus, (or "active.") and AHK has no way to tell (that I know of.)
;If a panel is ALREADY in focus, and you send the shortcut to bring it into focus again, that panel might then switch to a different sequence in the case of the timeline or program monitor,, or a different item in the case of the Source panel. IT's a nightmare!

;Therefore, we must start with a clean slate. For that, I chose the EFFECTS panel. Sending its focus shortcut multiple times, has no ill effects.

Sendinput, ^!+7 ;bring focus to the effects panel... OR, if any panel had been maximized (using the `~ key by default) this will unmaximize that panel, but sadly, that panel will still be the one in focus.
;Note that if the effects panel is ALREADY maximized, then sending the shortcut to switch to it will NOT un-maximize it. This is OK, though, because I never maximize the Effects Panel. If you do, then you might want to switch to the Effect Controls panel first, and THEN the Effects panel after this line.
;note that sometimes I use ^+! instead... it makes no difference compared to ^!+

sleep 12 ;waiting for Premiere to actaully do the above.

Sendinput, ^!+7 ;Bring focus to the effects panel AGAIN. Just in case some panel somewhere was maximized, THIS will now guarantee that the Effects panel is ACTAULLY in focus.

sleep 5 ;waiting for Premiere to actaully do the above.

sendinput, {blind}{SC0EA} ;scan code of an unassigned key. Used for debugging. You do not need this.

if (panel = "effects")
	goto theEnd ;do nothing. The shortcut has already been sent.
else if (panel = "timeline")
	Sendinput, ^!+3 ;if focus had already been on the timeline, this would have switched to the "next" sequence (in some unpredictable order.)
else if (panel = "program") ;program monitor. If focus had already been here, this would have switched to the "next" sequence.
	Sendinput, ^!+4
else if (panel = "source") ;source monitor. If focus had already been here, this would have switched to the next loaded item.
{
	Sendinput, ^!+2
	;tippy("send ^!+2") ;tippy() was something I used for debugging. you don't need it.
}
else if (panel = "project") ;AKA a "bin" or "folder"
	Sendinput, ^!+1
else if (panel = "effect controls")
	Sendinput, ^!+5
else if (panel = "essential graphics")
	SendInput, ^!+{-}

theEnd:
sendinput, {blind}{SC0EB} ;more debugging - you don't need this.
}
;end of prFocus()

preset(item)
{
;******FUNCTION FOR DIRECTLY APPLYING A PRESET EFFECT TO A CLIP!******
; preset() is my most used, and most useful AHK function for Premiere Pro!

;===================================================================================
; NEW TO AHK? READ ALL THE BELOW INSTRUCTIONS BEFORE YOU TRY TO USE THIS.
; THIS WILL NOT WORK UNLESS YOU DO SOME SETUP FIRST!
; Fortunately,
; THERE IS A FULL VIDEO TUTORIAL THAT TEACHES YOU HOW TO USE THIS, STEP BY STEP.
; [[[[[LINK TBD, IT'S NOT FINISHED JUST YET.]]]]]
;
; Even if Adobe does one day add this feature to Premiere, this video tutorial will
; still be very useful to anyone who is learning how to use AHK with Premiere,
; especially if you're trying to use any of the other functions that I've created.
; 
; To call the function, use something like
; F4::preset("crop 50")
; Where "crop 50" is the exact, unique name of the preset you wish to apply.
; 
; For this function to work, you MUST go into Premiere's Keyboard Shortcuts panel,
; find the following commands, and add these keyboard shortcut assignments to them:
; 
; Select Find Box ------- CTRL B
; Shuttle Stop ---------- CTRL ALT SHIFT K
; Window > Effects  ----- CTRL ALT SHIFT 7
;
; (You can use different shortcuts if you like, as long
; as those are the ones you send with your AHK script.)
; 
;====================================================================================

;Keep in mind, I use 100% UI scaling on my primary monitor, so if you use 125% or 150% or anything else, your pixel distances for commands like Mousemove WILL be different. Therefore, you'll need to "comment in" the message boxes, change some numbers, and keep saving and refreshing and retrying the script until you've got it working!
;To find out what UI scaling your screen uses, hit the windows key, type in "display," hit Enter, and then scroll down to "Scale and layout." Under "Change the size of text, apps, and other items," there will be a selection menu thing. Mine is set to "100%." I have NOT done anything in the "Advanced scaling settings" blue link just below that.

;To use this script yourself, carefully go through  testing the script and changing the values, ensuring that the script works, one line at a time. use message boxes to check on variables and see where the cursor is. remove those message boxes later when you have it all working!

;NOTE: I built this under the assumption that your Effects Panel will be on the same monitor as your timeline. I can't guarantee that it'll work if the Effects Panel is on another monitor.

;NOTE: You also need to get the PrFocus() function.

;NOTE: To use the preset() function, your cursor must first be hovering over the clip that you wish to apply your preset to. It also works to select multiple clips, again, as long as your cursor is hovering over one of the selected clips.


keywait, %A_PriorHotKey% ;keywait is quite important.
;Let's pretend that you called this function using the following line:
;F4::preset("crop 50")
;In that case, F4 is the prior hotkey, and the script will WAIT until F4 has been physically RELEASED (up) before it will continue. 
;https://www.autohotkey.com/docs/commands/KeyWait.htm
;Using keywait is probably WAY cleaner than allowing the physical key UP event to just happen WHENEVER during the following function, which can disrupt commands like sendinput, and cause cross-talk with modifier keys.


;;---------You do not need the stuff BELOW this line.--------------

sendinput, {blind}{SC0EC} ;for debugging. YOU DO NOT NEED THIS.
;Keyshower(item,"preset") ;YOU DO NOT NEED THIS. -- it simply displays keystrokes on the screen for the sake of tutorials...
; if IsFunc("Keyshower")
	; {
	; Func := Func("Keyshower")
	; RetVal := Func.Call(item,"preset") 
	; }
SetTitleMatchMode, 2

IfWinNotActive, Adobe Premiere Pro ;the exe is more reliable than the class, since it will work even if you're not on the primary Premiere window.
	{
	goto theEnding ;and this line is here just in case the function is called while not inside premiere. In my case, this is because of my secondary keyboards, which aren't usually using #ifwinactive in addition to #if getKeyState(whatever). Don't worry about it.
	}
;;---------You do not need the stuff ABOVE this line.--------------


;Setting the coordinate mode is really important. This ensures that pixel distances are consistant for everything, everywhere.
; https://www.autohotkey.com/docs/commands/CoordMode.htm
coordmode, pixel, Window
coordmode, mouse, Window
coordmode, Caret, Window

;This (temporarily) blocks the mouse and keyboard from sending any information, which could interfere with the funcitoning of the script.
BlockInput, SendAndMouse
BlockInput, MouseMove
BlockInput, On
;The mouse will be unfrozen at the end of this function. Note that if you do get stuck while debugging this or any other function, CTRL SHIFT ESC will allow you to regain control of the mouse. You can then end the AHK script from the Task Manager.

SetKeyDelay, 0 ;NO DELAY BETWEEN STUFF sent using the "send"command! I thought it might actually be best to put this at "1," but using "0" seems to work perfectly fine.
; https://www.autohotkey.com/docs/commands/SetKeyDelay.htm


Sendinput, ^!+k ;in Premiere's shortcuts panel, ASSIGN "shuttle stop" to CTRL ALT SHIFT K.
sleep 10
Sendinput, ^!+k ; another shortcut for Shuttle Stop. Sometimes, just one is not enough.
;so if the video is playing, this will stop it. Othewise, it can mess up the script.
sleep 5

;msgbox, ahk_class =   %class% `nClassNN =     %classNN% `nTitle= %Window%
;;This was my debugging to check if there are lingering variables from last time the script was run. You do not need that line.

MouseGetPos, xposP, yposP ;------------------stores the cursor's current coordinates at X%xposP% Y%yposP%
;KEEP IN MIND that this function should only be called when your cursor is hovering over a clip, or a group of selected clips, on the timeline. That's because the cursor will be returned to that exact location, carrying the desired preset, which it will drop there. MEANING, that this function won't work if you select clips, but don't have the cursor hovering over them.

sendinput, {mButton} ;this will MIDDLE CLICK to bring focus to the panel underneath the cursor (which must be the timeline). I forget exactly why, but if you create a nest, and immediately try to apply a preset to it, it doesn't work, because the timeline wasn't in focus...? Or something. IDK.
sleep 5

prFocus("effects") ;Brings focus to the effects panel. You must find, then copy/paste the prFocus() function definition into your own .ahk script as well. ALTERNATIVELY, if you don't want to do that, you can delete this line, and "comment in" the 3 lines below:

;Sendinput, ^+!7 ;CTRL SHIFT ALT 7 --- In Premiere's Keyboard Shortcuts panel, you nust find the "Effects" panel and assign the shortcut CTRL SHIFT ALT 7 to it. (The default shortcut is SHIFT 7. Because Premiere does allow multiple shortcuts per command, you can keep SHIFT 7 as well, or you can delete it. I have deleted it.)
;sleep 12
;Sendinput, ^!+7 ;you must send this shortcut again, because there are some edge cases where it may not have worked the first time.

sendinput, {blind}{SC0EC} ;for debugging. YOU DO NOT NEED THIS LINE.

sleep 15 ;"sleep" means the script will wait for 15 milliseconds before the next command. This is done to give Premiere some time to load its own things.

Sendinput, ^b ;CTRL B ------- set in premiere's shortcuts panel to "select find box"
sleep 5
;Alternatively, it also works to click on the magnifying glass if you wish to select the find box... but this is unnecessary and sloppy.

;The Effects panel's find box should now be activated.
;If there is text contained inside, it has now been highlighted. There is also a blinking vertical line at the end of any text, which is called the "text insertion point", or "caret".

if (A_CaretX = "")
{
;No Caret (blinking vertical line) can be found.

;The following loop is waiting until it sees the caret. THIS IS SUPER IMPORTANT, because Premiere is sometimes quite slow to actually select the find box, and if the function tries to proceed before that has happened, it will fail. This would happen to me about 10% of the time.
;Using the loop is also way better than just ALWAYS waiting 60 milliseconds like I was before. With the loop, this function can continue as soon as Premiere is ready.

;sleep 60 ;<—Use this line if you don't want to use the loop below. But the loop should work perfectly fine as-is, without any modification from you.

waiting2 = 0
loop
	{
	waiting2 ++
	sleep 33
	tooltip, counter = (%waiting2% * 33)`nCaret = %A_CaretX%
	if (A_CaretX <> "")
		{
		tooltip, CARET WAS FOUND
		break
		}
	if (waiting2 > 40)
		{
		tooltip, FAIL - no caret found. `nIf your cursor will not move`, hit the button to call the preset() function again.`nTo remove this tooltip`, refresh the script using its icon in the taskbar.`n`nIt's possible Premiere tried to AUTOSAVE at just the wrong moment!
		;Note to self, need much better way to debug this than screwing the user. As it stands, that tooltip will stay there forever.
		;USER: Running the function again, or reloading the script, will remove that tooltip.
		;sleep 200
		;tooltip,
		sleep 20
		GOTO theEnding
		}
	}
sleep 1
tooltip,
}
;The loop has now ended.
;yeah, I've seen this go all the way up to "8," which is 264 milliseconds

MouseMove, %A_CaretX%, %A_CaretY%, 0 ;this moves the cursor, instantly, to the position of the caret.
sleep 5 ;waiting while Windows does this. Just in case it takes longer than 0 milliseconds.
;;;and fortunately, AHK knows the exact X and Y position of this caret. So therefore, we can find the effects panel find box, no matter what monitor it is on, with 100% consistency!

;tooltip, 1 - mouse should be on the caret X= %A_CaretX% Y= %A_CaretY% now ;;this debugging line was super helpful in me solving this one! Connent this line in if you want to use it, but comment it out after you've gotten the whole function working.

;;;msgbox, caret X Y is %A_CaretX%, %A_CaretY%

MouseGetPos, , , Window, classNN
WinGetClass, class, ahk_id %Window%

;tooltip, 2 - ahk_class =   %class% `nClassNN =     %classNN% `nTitle= %Window%

;;;note to self, I think ControlGetPos is not affected by coordmode??  Or at least, it gave me the wrong coordinates if premiere is not fullscreened... IDK. https://autohotkey.com/docs/commands/ControlGetPos.htm

ControlGetPos, XX, YY, Width, Height, %classNN%, ahk_class %class%, SubWindow, SubWindow 

;note to self, I tried to exclude subwindows but I don't think it works...?
;;my results:  59, 1229, 252, 21,     Edit1,     ahk_class Premiere Pro
;tooltip, classNN = %classNN%

;;Now we have found a lot of useful information about this find box. Turns out, we don't need most of it...
;;we just need the X and Y coordinates of the "upper left" corner...

;;Comment in the following line to get a message box of your current variable values. The script will not advance until you dismiss a message box. (Use the enter key.)
;MsgBox, xx=%XX% yy=%YY%

;; https://www.autohotkey.com/docs/commands/MouseMove.htm

;MouseMove, XX-25, YY+10, 0 ;--------------------for 150% UI scaling, this moves the cursor onto the magnifying glass
MouseMove, XX-15, YY+10, 0 ;--------------------for 100% UI scaling, this moves the cursor onto the magnifying glass

;msgbox, should be in the center of the magnifying glass now. ;;<--comment this in for help with debugging.

sleep 5

Sendinput, %item%
;This types in the text you wanted to search for, like "crop 50". We can do this because the entire find box (and any included text) was already selected.
;Premiere will now display your preset at the top of the list. There is no need to press "enter" to search.


sleep 5

;MouseMove, 62, 95, 0, R ;----------------------(for 150% UI.)
MouseMove, 51, 78, 0, R ;----------------------(for 100% UI)
;MouseMove, 41, 63, 0, R ;----------------------(for 100% UI)
;;relative to the position of the magnifying glass (established earlier,) this moves the cursor down and directly onto the preset's icon.

;;In my case, all of my presets are contained inside of folders, which themselves are inside the "presets" folder. Your preset's written name should be completely unique so that it is the first and only item.

;msgbox, The cursor should be directly on top of the preset's icon. `n If not, the script needs modification.

sleep 5


;;At this point in the function, I used to use the line "MouseClickDrag, Left, , , %xposP%, %yposP%, 0" to drag the preset back onto the clip on the timeline. HOWEVER, because of a Premiere bug (which may or may not still exist) involving the duplicated displaying of single presets (in the wrong positions) I have to click on the Effects panel AGAIN, which will "fix" it, bringing it back to normal.
;+++++++ If this bug is ever resolved, then the lines BELOW are no longer necessary.+++++
MouseGetPos, iconX, iconY, Window, classNN ;---now we have to figure out the ahk_class of the current panel we are on. It might be "DroverLord - Window Class14", but the number changes anytime you move panels around... so i must always obtain the information anew.
sleep 5
WinGetClass, class, ahk_id %Window% ;----------"ahk_id %Window%" is important for SOME REASON. if you delete it, this doesn't work.
;tooltip, ahk_class =   %class% `nClassNN =     %classNN% `nTitle= %Window%
;sleep 50
ControlGetPos, xxx, yyy, www, hhh, %classNN%, ahk_class %class%, SubWindow, SubWindow ;;-I tried to exclude subwindows but I don't think it works...?
MouseMove, www/4, hhh/2, 0, R ;-----------------moves to roughly the CENTER of the Effects panel. Clicking here will clear the displayed presets from any duplication errors. VERY important. Without this, the script fails 20% of the time. This is also where the script can go wrong, by trying to do this on the timeline, meaning it didn't get the Effects panel window information as it should have.
sleep 5
MouseClick, left, , , 1 ;-----------------------the actual click
sleep 5
MouseMove, iconX, iconY, 0 ;--------------------moves cursor BACK onto the preset's icon
;tooltip, should be back on the preset's icon
sleep 5
;;+++++If this bug is ever resolved, then the lines ABOVE are no longer necessary.++++++


MouseClickDrag, Left, , , %xposP%, %yposP%, 0 ;---clicks the left button down, drags this effect to the cursor's pervious coordinates and releases the left mouse button, which should be above a clip, on the TIMELINE panel.
sleep 5
MouseClick, middle, , , 1 ;this returns focus to the panel the cursor is hovering above, WITHOUT selecting anything. great! And now timeline shortcuts like JKL will work.

blockinput, MouseMoveOff ;returning mouse movement ability
BlockInput, off ;do not comment out or delete this line -- or you won't regain control of the keyboard!! However, CTRL ALT DELETE will still work if you get stuck!! Cool.

;;----remove the code below if it makes no sense to you.----
IfInString, item, CROP
	{
	if IsFunc("cropClick") ;This checks to see if you have a function named "cropClick"
		{
		Func := Func("cropClick")
		sleep 320 ;because it might take awhile to appear in Premiere,  and I'm not gonna do another loop think liek I did above...
		RetVal := Func.Call() 
		}
	;;If you don't have cropClick, then nothing happens. That's good!
	
	;;This code below is what I had used before, but it will complain that you haven't defined the function "cropClick", whereas, the code above will NOT!
	;sleep 320
	;cropClick()
	;;msgbox, that had "CROP" in it.
	}
;;----remove the code above if it makes no sense to you----

;The line below is where all those GOTOs are going to.
theEnding:
}
;END of preset(). The two lines above this one are super important.

textmaker(item)
{
keywait, %A_PriorHotKey%
sendinput, {blind}{SC0EC}

SetTitleMatchMode, 2

IfWinNotActive, Adobe Premiere Pro
{
    goto theEndingmt
}

BlockInput, SendAndMouse
BlockInput, MouseMove
BlockInput, On

SetKeyDelay, 0

Sendinput, ^!+k
sleep 10
Sendinput, ^!+k
sleep 5

MouseGetPos, xposP, yposP

if (A_PriorHotKey = "F23" and A_PriorKey = "2") {
    Send, ^t
	sleep 500
} else {
    ; Handle other cases or continue with your script
}

send, ^+!{-}
sleep 5

sendinput, {blind}{SC0EC}
sleep 15
		
;%UpperLeftX%, %UpperLeftY%, %LowerRightX%, %LowerRightY%,
; Example of using ImageSearch
ImageSearch, FoundX, FoundY, 1720, 0, 2560, 1000, *8 C:\AHK\support_files\essential_graphics_text_2.png

if ErrorLevel = 0
{
    ; Image found, do something
	SetMouseDelay, 0
    MouseMove, FoundX+50, FoundY+10
	sendinput, {lButton}
}
else
{
	ImageSearch, FoundX, FoundY, 1720, 0, 2560, 1000, *8 C:\AHK\support_files\essential_graphics_text.png

	if ErrorLevel = 0
	{
    ; Image found, do something
	SetMouseDelay, 0
    MouseMove, FoundX+50, FoundY+10
	sendinput, {lButton}
	}
	else 
		{
		; Image not found, handle accordingly
		goto theEndingmt
		}
}

sleep 30

ImageSearch, FoundX, FoundY, 1720, 0, 2560, 1000, *8 C:\AHK\support_files\center_text.png

	if ErrorLevel = 0
	{
		; Image found, do something
		SetMouseDelay, 0
		MouseMove, FoundX+7, FoundY+7
		sendinput, {lButton}
	}
	else
	{
		ImageSearch, FoundX, FoundY, 1720, 0, 2560, 1000, *8 C:\AHK\support_files\essential_graphics_text_2.png

		if ErrorLevel = 0
		{
			; Image found, do something
			SetMouseDelay, 0
			MouseMove, FoundX+50, FoundY+10
			sendinput, {lButton}
		}
		else
		{
			ImageSearch, FoundX, FoundY, 1720, 0, 2560, 1000, *8 C:\AHK\support_files\essential_graphics_text.png

			if ErrorLevel = 0
			{
			; Image found, do something
			SetMouseDelay, 0
			MouseMove, FoundX+50, FoundY+10
			sendinput, {lButton}
			}
			else 
				{
				msgbox, didnt click again
				; Image not found, handle accordingly
				goto theEndingmt
				}
		}
		
		ImageSearch, FoundX, FoundY, 1720, 0, 2560, 1000, *8 C:\AHK\support_files\center_text.png

		if ErrorLevel = 0
		{
			; Image found, do something
			SetMouseDelay, 0
			MouseMove, FoundX, FoundY
			sendinput, {lButton}
		} else {
		goto theEndingmt
		
		}
	}

sleep 100
	
if (A_PriorHotKey = "F23" and A_PriorKey = "2") {
	ImageSearch, FoundX, FoundY, 1720, 0, 2560, 1000, *8 C:\AHK\support_files\960_text.png

	if ErrorLevel = 0
	{
		; Image found, do something
		SetMouseDelay, 0
		MouseMove, FoundX+30, FoundY+15
		sendinput, {lButton}
		send, ^a
		sendinput, {backspace}
		sendinput, "1300"
		sendinput, {enter}
	}
	else
	{
		ImageSearch, FoundX, FoundY, 1720, 0, 2560, 1000, *8 C:\AHK\support_files\essential_graphics_text_2.png

		if ErrorLevel = 0
		{
			; Image found, do something
			SetMouseDelay, 0
			MouseMove, FoundX+50, FoundY+10
			sendinput, {lButton}
		}
		else
		{
			ImageSearch, FoundX, FoundY, 1720, 0, 2560, 1000, *8 C:\AHK\support_files\essential_graphics_text.png

			if ErrorLevel = 0
			{
			; Image found, do something
			SetMouseDelay, 0
			MouseMove, FoundX+50, FoundY+10
			sendinput, {lButton}
			}
			else 
				{
				; Image not found, handle accordingly
				goto theEndingmt
				}
				
			ImageSearch, FoundX, FoundY, 1720, 0, 2560, 1000, *8 C:\AHK\support_files\960_text.png

			if ErrorLevel = 0
			{
				; Image found, do something
				SetMouseDelay, 0
				MouseMove, FoundX+30, FoundY+15
				sendinput, {lButton}
				send, ^a
				sendinput, {backspace}
				sendinput, "1300"
				sendinput, {enter}
			} else {
			
			goto theEndingmt
			
			}
		}
		; Image not found, handle accordingly
		goto theEndingmt
	}
} else {
    ; Handle other cases or continue with your script
}



theEndingmt:
MouseMove, %xposP%, %yposP%
sleep 5
MouseClick, middle, , , 1

blockinput, MouseMoveOff
BlockInput, off
}







emojimaker(item)
{
keywait, %A_PriorHotKey%
sendinput, {blind}{SC0EC}

SetTitleMatchMode, 2

IfWinNotActive, Adobe Premiere Pro
{
    goto theEndingem
}

BlockInput, SendAndMouse
BlockInput, MouseMove
BlockInput, On

SetKeyDelay, 0

Sendinput, ^!+k
sleep 10
Sendinput, ^!+k
sleep 5

MouseGetPos, xposP, yposP

send, ^+!5
sleep 5

sendinput, {blind}{SC0EC}
sleep 15
		
; Example of using ImageSearch
ImageSearch, FoundX, FoundY, 1720, 0, 2560, 1000, *8 C:\AHK\support_files\emoji_position_effectcontrols.png

KeyMapping := Object()
KeyMapping["F234"] := "450"
KeyMapping["F23t"] := "540"
KeyMapping["F23g"] := "1365"


if ErrorLevel = 0
{
    ; Image found, do something
	SetMouseDelay, 0
    MouseMove, FoundX+200, FoundY+10
	sendinput, {lButton}
	sleep 5
	send, ^a
	sleep 5
	sendinput, {backspace}
	sendinput, % KeyMapping[item]
	sendinput, {enter}
}
	else
	{
	; Image not found, handle accordingly
	goto theEndingem
	}

sleep 15

theEndingem:
MouseMove, %xposP%, %yposP%
sleep 5
MouseClick, middle, , , 1

blockinput, MouseMoveOff
BlockInput, off
}

warpstabilizer(item)
{
keywait, %A_PriorHotKey%
sendinput, {blind}{SC0EC}

SetTitleMatchMode, 2

IfWinNotActive, Adobe Premiere Pro
{
    goto theEndingws
}

BlockInput, SendAndMouse
BlockInput, MouseMove
BlockInput, On

SetKeyDelay, 0

Sendinput, ^!+k
sleep 10
Sendinput, ^!+k
sleep 5

preset("Warp Stabilizer TT")
sleep 500

MouseGetPos, xposP, yposP

sendinput, ^+!5
sleep 15

sendinput, {blind}{SC0EC}
sleep 15

		
; Example of using ImageSearch
ImageSearch, FoundX, FoundY, 1720, 0, 2560, 1000, *8 C:\AHK\support_files\analyze_warp_stabilizer.png

if ErrorLevel = 0
{
    ; Image found, do something
	SetMouseDelay, 0
    MouseMove, FoundX+15, FoundY+10
	sendinput, {lButton}
}
	else
	{
	; Image not found, handle accordingly
	goto theEndingws
	}

sleep 15

theEndingws:
MouseMove, %xposP%, %yposP%
sleep 5
MouseClick, middle, , , 1

blockinput, MouseMoveOff
BlockInput, off
}





timeinterpolation(item)
{
keywait, %A_PriorHotKey%
sendinput, {blind}{SC0EC}

SetTitleMatchMode, 2

IfWinNotActive, Adobe Premiere Pro
{
    goto theEndingti
}

BlockInput, SendAndMouse
BlockInput, MouseMove
BlockInput, On

SetKeyDelay, 0

Sendinput, ^!+k
sleep 10
Sendinput, ^!+k
sleep 5

MouseGetPos, xposP, yposP

sendinput, ^r
sleep 15

sendinput, {blind}{SC0EC}
sleep 350

		
; Example of using ImageSearch
ImageSearch, FoundX, FoundY, 0, 0, A_ScreenWidth, A_ScreenHeight, *8 C:\AHK\support_files\frame_sampling.png

if ErrorLevel = 0
{
    ; Image found, do something
	SetMouseDelay, 0
    MouseMove, FoundX+200, FoundY+10
	sleep 5
	sendinput, {lButton}
	sleep 5
	MouseMove, FoundX, FoundY-180
	sleep 15
	sendinput, {lButton}
	sleep 15
	sendinput, {enter}
}
	else
	{
	msgbox, Image not found, handle accordingly
	goto theEndingti
	}

sleep 15

theEndingti:
MouseMove, %xposP%, %yposP%
sleep 5
MouseClick, middle, , , 1

blockinput, MouseMoveOff
BlockInput, off
}




export(item)
{
keywait, %A_PriorHotKey%
sendinput, {blind}{SC0EC}

SetTitleMatchMode, 2

IfWinNotActive, Adobe Premiere Pro
{
    goto theEndingex
}

BlockInput, SendAndMouse
BlockInput, MouseMove
BlockInput, On

SetKeyDelay, 0

Sendinput, ^!+k
sleep 10
Sendinput, ^!+k
sleep 5

MouseGetPos, xposP, yposP

sendinput, {blind}{SC0EC}
sleep 5

		
; Example of using ImageSearch
ImageSearch, FoundX, FoundY, 0, 950, 550, 1440, C:\AHK\support_files\margins_layer.png


if ErrorLevel = 0
{
    ; Image found, do something
	SetMouseDelay, 0
    MouseMove, FoundX+120, FoundY+10
	sleep 15
	sendinput, {lButton}
}
	else
	{
	msgbox, Image not found, handle accordingly
	goto theEndingex
	}

send, ^m
sleep 15

theEndingex:
MouseMove, %xposP%, %yposP%
sleep 5
MouseClick, middle, , , 1

blockinput, MouseMoveOff
BlockInput, off
}







instantVFX(foobar)
{
dontrestart = 0
restartPoint:
blockinput, sendandMouse
blockinput, MouseMove
blockinput, on
;-Sendinput ^!+5
Send, ^+!5 ;essentially just hits CTRL ALT SHIFT 5 to highlight the effect controls panel.
sleep 10

;ToolTip, A, , , 2
MouseGetPos Xbeginlol, Ybeginlol
global Xbegin = Xbeginlol
global Ybegin = Ybeginlol
; MsgBox, "please verify that the mouse cannot move"
; sleep 2000
ControlGetPos, Xcorner, Ycorner, Width, Height, DroverLord - Window Class56, ahk_class Premiere Pro ;This is HOPEFULLY the ClassNN of the effect controls panel. Use Window Spy to figure it out.
;I might need a far more robust way of ensuring the effect controls panel has been located, in the future.

;move mouse to expected triangle location. this is a VERY SPECIFIC PIXEL which will be right on the EDGE of the triangle when it is OPEN.
;This takes advantage of the anti-aliasing between the color of the triangle, and that of the background behind it.
;these pixel numbers will be DIFFERENT depending upon the RESOLUTION and UI SCALING of your monitor(s)
YY := Ycorner+83 ;143??
XX := Xcorner+15
MouseMove, XX, YY, 0
sleep 10

PixelGetColor, colorr, XX, YY

if (colorr = "0x707070")
{
	tooltip, color %colorr% means closed triangle. Will click and then SCALE SEARCH
	blockinput, Mouse
	Click XX, YY
	sleep 5
	clickTransformIcon()
	findVFX(foobar)
	Return
}
else if (colorr = "0x3B3B3B") ;again, this values will be different for everyone. check with window spy. This color simply needs to be different from the color when the triangle is closed
{
	;tooltip, %colorr% means OPENED triangle. SEARCHING FOR SCALE
	blockinput, Mouse
	sleep 5
	clickTransformIcon()
	findVFX(foobar)
	;untwirled = 1
	Return, untwirled
}
else if (colorr = "0x1D1D1D" || colorr = "0x232323")
	{
	tooltip, this is a normal panel color of 0x1d1d1d or %colorr%, which means NO CLIP has been selected ; assuming you didnt change your UI brightness. so we are going to select the top clip at playhead.
	;I should experiement with putting a "deselect all clips on the timeline" shortcut here...
	Send ^p ;--- i have CTRL P set up to toggle "selection follows playhead," which I never use otherwise. ;this makes it so that only the TOP clip is selected.
	sleep 10
	Send ^p ;this disables "selection follows playhead." I don't know if there is a way to CHECK if it is on or not. 
	resetFromAutoVFX()
	;play noise
	;now you need to do all that again, since the motion menu is now open. But only do it ONCE more! 
	If (dontrestart = 0)
		{
		dontrestart = 1
		goto, restartPoint ;this is stupid but it works. Feel free to improve any of my code.
		}
	Return reset
	}
else
	{
	tooltip, %colorr% not expected
	;play noise
	resetFromAutoVFX()
	Return reset
	}
}
Return ;from autoscaler part 1



findVFX(foobar) ; searches for text inside of the Motion effect. requires an actual image.
{
;tooltip, WTF
;msgbox, now we are in findVFX
sleep 5
MouseGetPos xPos, yPos
;CoordMode Pixel  ; Interprets the coordinates below as relative to the screen rather than the active window.

/*
if foobar = "scale"
	ImageSearch, FoundX, FoundY, xPos-90, yPos, xPos+800, yPos+500, %A_WorkingDir%\scale_D2017.png
else if foobar = "anchor_point"
	ImageSearch, FoundX, FoundY, xPos-90, yPos, xPos+800, yPos+500, %A_WorkingDir%\anchor_point_D2017.png
*/

ImageSearch, FoundX, FoundY, xPos-90, yPos, xPos+800, yPos+900, C:\AHK\support_files\%foobar%_D2017.png
;within 0 shades of variation (this is much faster)
;obviously, you need to take your own screenshot (look at mine to see what is needed) save as .png, and link to it from the line above.
;Again, your UI brightness might be different from mine! I now use the DEFAULT brightness.
if ErrorLevel = 1
	ImageSearch, FoundX, FoundY, xPos-30, yPos, xPos+1200, yPos+1200, *10 C:\AHK\support_files\%foobar%_D2017.png ;within 30 shades of variation (in case SCALE is fully extended with bezier handles, in which case, the other images are real hard to find because the horizontal seperating lines look a BIT different. But if you crop in really closely, you don't have to worry about this. so this part of the code is not really necessary execpt to expand the range to look.

if ErrorLevel = 2
	{
    msgbox,,, ERROR LEVEL 2`nCould not conduct the search,1
	resetFromAutoVFX()
	}
if ErrorLevel = 1
	{
	;msgbox, , , error level 1, .7
    msgbox,,, ERROR LEVEL 1`n%foobar% could not be found on the screeen,1
	resetFromAutoVFX()
	}
else
	{
	;tooltip, The %foobar% icon was found at %FoundX%x%FoundY%.
	;msgbox, The %foobar% icon was found at %FoundX%x%FoundY%.
	MouseMove, FoundX, FoundY, 0
	;msgbox,,,moved to located "scale",1
	sleep 5
	findHotText(foobar)
	}
}



findHotText(foobar)
{
tooltip, ; removes any tooltips that might be in the way of the searcher.
; https://www.autohotkey.com/docs/commands/PixelSearch.htm
;CoordMode Pixel
MouseGetPos, xxx, yyy

;msgbox, foobar is %foobar%
if (foobar = "scale" ||  foobar = "anchor_point" || foobar = "rotation")
{
	;msgbox,,,scale or the other 3,1
	PixelSearch, Px, Py, xxx+50, yyy+10, xxx+500, yyy+11, 0x3398EE, 30, Fast RGB ;this is searching to the RIGHT, looking the blueness of the scrubbable hot text
}
else if (foobar = "anchor_point_vertical")
{
	;msgbox, looking for 0.00
	ImageSearch, Px, Py, xxx+100, yyy, xxx+800, yyy+100, %A_WorkingDir%\anti-flicker-filter_000.png ;because i never change this value, and it is always the same distance from the hot text that i WANT, it is a reliable landmark.
}

; ImageSearch, FoundX, FoundY, xPos-70, yPos, xPos+800, yPos+500, %A_WorkingDir%\anchor_point_D2017.png
; ImageSearch, FoundX, FoundY, xPos-70, yPos, xPos+800, yPos+500, %A_WorkingDir%\anti-flicker-filter_000.png


if ErrorLevel
	{
    ;tooltip, thing not Found
	sleep 100
	resetFromAutoVFX()
	;return ;i am not sure if this is needed.
	}
else
	{
	;tooltip, A color within 30 shades of variation was found at X%Px% Y%Py%
	;sleep 1000
    ;MsgBox, A color within 30 shades of variation was found at X%Px% Y%Py%.
	if (foobar <> "anchor_point_vertical")
	{
		;msgbox, about to move
		MouseMove, Px+10, Py+5, 0 ;moves the cursor onto the scrubbable hot text
		;msgbox, anything but anchor point vertical
		;sleep 1000
	}
	else if (foobar = "anchor_point_vertical")
	{
		MouseMove, Px+80, Py-20, 0 ;relative to the unrelated 0.00 text (which I've never changed,) this moves the cursor onto the SECOND variable for the anchor point... the VERTICAL number, rather than horizontal.
		tooltip, where am I?
		;sleep 1000
	}

	Click down left
	
	GetKeyState, state, %VFXkey%
	
	if (state = "U")
		{
			;a bit of time has passed by now, so if the user is no longer holding the key down at this point, that means that they pressed it an immediately released it.
			;I am going to take this an an indicaiton that the user just wants to RESET the value, rather than changing it.
			Click up left
			Sleep 10
			if (foobar = "scale")
			{
				Send, 100
				sleep 50
				Send, {enter} ;"enter" can be a volatile and dangerous key, since it has so many other potential functions that might interfere somehow... in fact, I crashed the whole program once by using this and the anchor point script in rapid sucesssion.... but "ctrl enter" doesn't work... maybe numpad enter is a safer bet?
				sleep 20
			}
			if (foobar = "rotation")
			{
				Send, 0
				sleep 50
				Send, {enter} ;"enter" can be a volatile and dangerous key, since it has so many other potential functions that might interfere somehow... in fact, I crashed the whole program once by using this and the anchor point script in rapid sucesssion.... but "ctrl enter" doesn't work... maybe numpad enter is a safer bet?
				sleep 20
			}
			resetFromAutoVFX()
			;return
		}
	;Now we start the official loop, which will continue as long as the user holds down the VFXkey. They can now simply move the mouse to change the value of the hot text which has been automatically selected for them.
	Loop
		{
		blockinput, off
		blockinput, MouseMoveOff
		;tooltip, %VFXkey% Instant %foobar% mod
		tooltip, ;removes any tooltips that might exist.
		sleep 15
		GetKeyState, state, %VFXkey%, P
		if state = U
			{
			Click up left
			;tooltip, "%VFXkey% is now physically UP so we are exiting now"
			sleep 15
			resetFromAutoVFX()
			; MouseMove, Xbegin, Ybegin, 0
			; tooltip,
			; ToolTip, , , , 2
			; blockinput, off
			; blockinput, MouseMoveOff
			Return
			}
		}
	}
}

;;;--------------------------------------------------------------------------------------------

resetFromAutoVFX()
{
	;msgbox,,, is resetting working?,1
	global Xbegin
	global Ybegin
	MouseMove, Xbegin, Ybegin, 0
	;MouseMove, global Xbegin, global Ybegin, 0
	;MouseMove, Xbeginlol, Ybeginlol, 0
	blockinput, off
	blockinput, MouseMoveOff
	ToolTip, , , , 2
	SetTimer, noTip, 333
}


clickTransformIcon()
{
ControlGetPos, Xcorner, Ycorner, Width, Height, DroverLord - Window Class56, ahk_class Premiere Pro ;you will need to set this value to the window class of your own Effect Controls panel! Use window spy and hover over it to find that info.
MouseMove, Xcorner+83, Ycorner+98, 0 ;these numbers should move the cursor to the location of the transform icon. Use the message box below to debug this.
;msgbox, the cursor should now be positioned directly over the transform icon.
MouseClick, left
}


;;;;;;temporary tooltip maker;;;;;;
Tippy(tipsHere, wait:=333)
{
ToolTip, %tipsHere% TP,,,8
SetTimer, noTip, %wait% ;--in 1/3 seconds by default, remove the tooltip
}
noTip:
	ToolTip,,,,8
	;removes the tooltip
return
Editor is loading...
Leave a Comment