In an editor script, is there a way to access the Animation editor window's current frame value when in animation mode?

I would like to create some editor extensions for improving animation workflow inside Unity. One thing that would be very useful is some way to access the current frame of the Animation window’s playhead - the vertical red line over the dope sheet or curve editor that shows where the user has scrubbed. The frame number is also displayed in a small text box at the top, between the next and previous keyframe buttons, and the add key button.

30847-currentframe.png

I’m looking for the same.

I was also wondering around about it and I found my own solution.

even it’s 7 year-old question, pretty sure someone would be looking for the answer of same question just like myself.