Help with Variable Subtraction
Posted: 10 Jun 2019, 20:07
Okay, so...
Below is a snippet of code from my "Everyday use" script & is intended to be run with Paint.NET (image editing software) in focus.
I'm making custom .gif emoji's for a Discord server I own & it's a very tedious process, so I look for any "fasterizing" shortcuts I can!
The goal is to save the selected (visible) layer, name it "f<number>" change the File Type to .png, confirm the save location, confirm the save, confirm flattening all layers, then Undo the flatten command so I can do the same for the next layer (because part of the process in making each layer it's own independent .png file).
That said, once on the next layer, I'd like to be able to just tap the hotkey again & have the file name be "f<previous number> -1".
num1 := 3--
F8:: ;Save .pdn As .png File.
If WinActive ("ahk_exe PaintDotNet.exe")
{
Send ^+s ;"Save As"
Sleep 250
Send f ;Sends "f" Leading File Name.
Sleep 250
Send %num1% ;Sends Starting Variable, Then Subtracts 1 & Makes It The New Variable.
Sleep 250
Send {TAB} ;Shifts Focus To File Type Selection Box.
Sleep 250
Send p ;Chooses .png File Format.
Sleep 250
Send {ENTER} ;Confirms Save Name & Location.
Sleep 250
Send {ENTER} ;Confirms Save.
Sleep 250
Send {ENTER} ;Confirms "Flatten".
Sleep 1000
Send ^z ;Reverts "Flatten".
}
Else If WinNotActive ("ahk_exe PaintDotNet.exe")
{
Send {vk77sc042} ;Send F8.
}
Return
I'm not a coder by trade, I only dabble occasionally & I've been racking my head against this code & the AHK "Variables & Expressions" documentation for the better part of 4h & it's just not clear enough for me. If anyone needs clarification on my intent, please let me know.
Thanks in advance for all constructive feedback!
Below is a snippet of code from my "Everyday use" script & is intended to be run with Paint.NET (image editing software) in focus.
I'm making custom .gif emoji's for a Discord server I own & it's a very tedious process, so I look for any "fasterizing" shortcuts I can!
The goal is to save the selected (visible) layer, name it "f<number>" change the File Type to .png, confirm the save location, confirm the save, confirm flattening all layers, then Undo the flatten command so I can do the same for the next layer (because part of the process in making each layer it's own independent .png file).
That said, once on the next layer, I'd like to be able to just tap the hotkey again & have the file name be "f<previous number> -1".
num1 := 3--
F8:: ;Save .pdn As .png File.
If WinActive ("ahk_exe PaintDotNet.exe")
{
Send ^+s ;"Save As"
Sleep 250
Send f ;Sends "f" Leading File Name.
Sleep 250
Send %num1% ;Sends Starting Variable, Then Subtracts 1 & Makes It The New Variable.
Sleep 250
Send {TAB} ;Shifts Focus To File Type Selection Box.
Sleep 250
Send p ;Chooses .png File Format.
Sleep 250
Send {ENTER} ;Confirms Save Name & Location.
Sleep 250
Send {ENTER} ;Confirms Save.
Sleep 250
Send {ENTER} ;Confirms "Flatten".
Sleep 1000
Send ^z ;Reverts "Flatten".
}
Else If WinNotActive ("ahk_exe PaintDotNet.exe")
{
Send {vk77sc042} ;Send F8.
}
Return
I'm not a coder by trade, I only dabble occasionally & I've been racking my head against this code & the AHK "Variables & Expressions" documentation for the better part of 4h & it's just not clear enough for me. If anyone needs clarification on my intent, please let me know.
Thanks in advance for all constructive feedback!
