User:Boper911/autohotkey
i hate doing anything manually that i could potentially automate and you probably do too, so here are some instructions to use autohotkey on webkinz picture guide
toot oriole
1. download and install the current version of autohotkey
2. copy and paste one of the below scripts into a text document, and save with extension .ahk
3. the following are universal adjustment to consider before you run any script
sleep
times: if you have slow internet, are troubleshooting, or are running this script for the first time, increase the sleep time. i add an extra 0 at the end to be safeMouseClick
coordinates: ensure the mouseclick coordinates are correct. they likely are not and will need to be adjusted
- to get the correct mouse coordinates, run the displaymousecoordinates.ahk script, follow the instructions to get your mouse coordinates, and paste them into the relevant spot in the script. ensure your display scale is at 100%!
4. double-click the script to run, stand by until finished
scripts
WPG_downloading_uploading.ahk
variation: rotatable
before you run the script, the following need to be adjusted:
dirs:
and mass downloadurl:
these will need to be adjusted depending on what files you're downloadingrotatable.csv
andFiledirectory.csv
: create these files per the commented-out instructions, in the same folder as the rest of the files to be uploaded
- you may find a windows powershell script to export files to csv useful to create the latter
#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.
CoordMode, Mouse, Screen
; mass download
#1::
itemName := 1 ;column number of item name (should be "Itemname" no "File:" or ".png"
itemNo := 2 ;column number of item number
dirs := ["ne", "se", "sw", "nw"] ;cardinals
delimiter := ","
Loop, Read, rotatable.csv
{
Cell := StrSplit(A_LoopReadLine,delimiter)
Loop % dirs.Length()
{
url := "https://assets.webkinz.com/swf/item/" . Cell[itemNo] . "/" . dirs[A_index] . ".png?v=v327_255" ;url concatenation
MouseClick, L, 494, 74 ;click on address bar
sleep 200
send, %url% ;enter url
sleep 600
send, {enter}
sleep 1000
MouseClick, R, 864, 702 ;right click on image
sleep 500
MouseClick, L, 874, 712 ;save picture
sleep 500
imageName := Cell[itemName] . dirs[A_index] . ".png" ;item name string concatenation
send, %imageName%
sleep 900
send, {enter}
sleep 1000
}
sleep 1000
}
return
; mass upload
#2::
url:= "http://webkinzpictureguide.shoutwiki.com/wiki/Special:Upload"
itemName := 1
Loop, Read, Filedirectory.csv ;Filedirectory is a one-column .csv file of computer directory address to image files
{
Cell := A_LoopReadLine
MouseClick, L, 494, 74 ;click address bar
sleep 200
send, %url%
sleep 600
send, {enter}
sleep 1000
MouseClick, L, 233, 957 ;click ignore warnings
sleep 600
MouseClick, L, 372, 442 ;click upload file
sleep 1000
send, %Cell% ;enter image address
sleep 600
send, {enter}
sleep 1000
MouseClick, L, 246, 1176 ;click upload
sleep 3000
}
return
variation: wallpaper or flooring
before you run the script, the following need to be adjusted:
dirs:
and mass downloadurl:
these will need to be adjusted depending on what files you're downloading_flooring.csv
and_Filedirectory.csv
: create these files per the commented-out instructions, in the same folder as the rest of the files to be uploaded
- you may find a windows powershell script to export files to csv useful to create the latter
#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.
; mass download
#1:: ; windows key + 1 activates
itemName := 1 ;column number of item name (should be "Itemname" no "File:" or ".png"
itemNo := 2 ;column number of item number
dirs := ["small", "medium", "large"] ; room sizes
delimiter := ","
Loop, Read, _flooring.csv
{
Cell := StrSplit(A_LoopReadLine,delimiter)
Loop % dirs.Length()
{
url := "http://assets.webkinz.com/swf/item/" . Cell[itemNo] . "/" . dirs[A_index] . ".png" ;url concatenation
MouseClick, L, 358, 60 ; click address bar
sleep 200
send, %url% ;enter url
sleep 600
send, {enter}
sleep 1000
MouseClick, R, 864, 600 ;right click on image
sleep 500
MouseClick, L, 874, 630 ;save picture
sleep 500
imageName := Cell[itemName] . dirs[A_index] . ".png" ;item name string concatenation
send, %imageName%
sleep 900
send, {enter}
sleep 1000
}
sleep 1000
}
return
; mass upload
#2:: ; windows key + 2 activates
url:= "http://webkinzpictureguide.shoutwiki.com/wiki/Special:Upload"
itemName := 2
Loop, Read, _Filedirectory.csv ;_Filedirectory is a one-column .csv file of computer directory address to image files
{
Cell := A_LoopReadLine
MouseClick, L, 358, 60 ; click address bar
sleep 200
send, %url%
sleep 600
send, {enter}
sleep 1000
MouseClick, L, 152, 649 ; click ignore warnings, chrome needs to be zoomed out to 67%
sleep 600
MouseClick, L, 233, 331 ; click choose file
sleep 1000
send, %Cell% ; enter image address
sleep 600
send, {enter}
sleep 1000
MouseClick, L, 155, 800 ; click upload
sleep 3000
}
return
^+s::Pause,Toggle ; ctrl shift s pauses script
gimp mass crop to content.ahk
if you have lots of pictures with variable amounts of transparent space that needs to be cropped out and are too broke to pay for photoshop, here is a script to "crop to content" them all in gimp
before you run the script, the following need to be adjusted:
- open all pictures that require "crop to content" in gimp and ensure the rightmost tab is selected
- ensure a new folder for your cropped pictures is the alphabetical first subfolder; i usually name it "_cropped"
#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.
; open all pictures that require "crop to content" in gimp and ensure the rightmost tab is selected, then run this script to crop all to content and save copies in a subfolder
CoordMode, Mouse, Screen
Loop
{
MouseClick, L, 203, 46 ; click "image"
sleep 200
send, {down}{down}{down}{down}{down}{down}{down}{down}{down}{down}{enter} ; select "crop to content"
sleep 200
send, {ctrl down}{shift down}{e down}{ctrl up}{shift up}{e up} ; export image
sleep 1000
send, {down}{down}{enter} ; selects destination folder (ensure a new folder for your cropped pictures is the alphabetical first subfolder)
sleep 500
send, {enter} ; export
sleep 2000 ; export settings page is pretty slow
send, {enter} ; export again as (default settings)
sleep 500
send, {ctrl down}{pgup down}{ctrl up}{pgup up} ; previous tab
}
return
^+s::Pause,Toggle ; ctrl shift s pauses script
displaymousecoordinates.ahk
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
#Warn ; Recommended for catching common errors.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
; While CapsLock is toggled On
; Script will display Mouse Position (coordinates) as a tooltip at Top-Left corner of screen.
; Also allows to copy them (to clipboard) with a PrintScreen button.
#SingleInstance force ; only one instance of script can run
#Persistent ; to make it run indefinitely
settimer start1, 0 ; "0" to make it update position instantly
return
start1:
if !GetKeyState("capslock","T") ; whether capslock is on or off
{
tooltip ; if off, don't show tooltip at all.
}
else
{ ; if on
CoordMode, ToolTip, Screen ; makes tooltip to appear at position, relative to screen.
CoordMode, Mouse, Screen ; makes mouse coordinates to be relative to screen.
MouseGetPos xx, yy ; get mouse x and y position, store as %xx% and %yy%
tooltip %xx% %yy%, 0, 0 ; display tooltip of %xx% %yy% at coordinates x0 y0.
PrintScreen:: ; assign new function to PrintScreen. If pressed...
clipboard == %xx% %yy% ; ...store %xx% %yy% to clipboard.
return
}
return
mass rename.ahk
#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.
; mass-rename wiki pages. this one is for appending "icon" to the end of the filename for theme icons
; open all the pages that need to be renamed in different tabs
^+s:: ; ctrl shift s to activate
Loop
{
Send {alt down}{shift down}{m down}{alt up}{shift up}{m up} ; alt-shift-m is default mediawiki hotkey to move a page
sleep 3000 ; wait for it to load
MouseClick, L, 999, 482 ; click inside the "move page" box. you'll need to adjust it for your zoom/resolution settings
Send {tab}{tab}{end} ; select the box then move cursor to end
Send {left}{left}{left}{left}icon ; back up the cursor to just preceding ".png", then write "icon"
Send {tab}all theme icons end in "themeicon" for consistency ; add a reason
Send {tab}{space} ; uncheck redirect
Send {enter} ; move it
sleep 4000 ; wait for it to load (it's slow)
Send {ctrl down}{w down}{ctrl up}{w up} ; ctrl-w closes tab
sleep 500 ; wait for next tab to load
}
^+w::Pause,Toggle ; ctrl-shift-w to pause