Cant run macro on schedule in Ubuntu?

I have a macro that requires XClick that i run from my windows 10 virtual machine. The win10 reboots for updates now and then so my macro stops working unless i login to Windows again. I tried setup auto login for Win 10 but it stops working now and then.

So i switched to a Ubuntu desktop virtual machine. I use the same macro there and it runs very nice. But how to schedule it to run every hour?
I have tried cron, but i cant seem to get it to start firefox. I guess that the limited run enviroment of cronjob could be the problem?
Is there some one else that run there macros with Ubuntu desktop, and how do you schedule them?

I tried all the ways i can think of to get it to run in Cron…

I can answer my self, i got it to work by placing a batch script in the autostart folder of Ubuntu desktop.
The script runs and Firefox every hour as intended.