Reset an application window in OS X

As long as I have a Mac I came across this behaviour. With a bit of luck you can drag the window to another screen and hope for the best. But: there’s a way to reset a window with AppleScript (which I never used before). Open Script Editor and run this:

tell application "System Events" to tell process "FileZilla"
    set position of window 1 to {50, 50}
    set size of window 1 to {500, 500}
end tell

Nothing to explain, the syntax is pretty self-explanatory. Change FileZilla to the name of the application and you’re good to go. One annotation: Telling the application FileZilla (or which Application you want to address) won’t work every time. Because of that it’s better to use System Events to address FileZilla.

Update: The application, in my case FileZilla, needs to be opened. Otherwise it won’t work.