Hi, @alexcr. There is a free application named WhichSpace which displays the current Desktop Space in the Mac menubar. It can also provide that number via AppleScript:
try
tell application "System Events"
tell process "WhichSpace"
set temp to (title of menu bar items of menu bar 1)
end tell
end tell
return item 1 of temp
on error
return ""
end try
The following related information might be more than you need...
I use WhichSpace in a set of macros that I have shared: Desktop Spaces • Macros to Improve Navigation and Window Management. If you want to dig into the details, I suggest you check out two macros in that set:
sub—Get DesktopNo
Go to Previous Desktop