Resize image by largest dimension in Photoshop
Solution 1:
In Photoshop, Files -> Scripts -> Image Processor.
Enter 500 for both Width and Height and check Resize to Fit. It will maintain the correct aspect ratio and resize the longest dimension to 500.
Solution 2:
If you want to make some custom batch process where you are dealing with multiple file types, Image Processor is not your best choice, it let you save in JPEG, PSD or TIFF only.
Here is the proper solution
File > Automate > Fit Image
It will just resize the image and you can continue making your batch process.