Note: the ideas I will be taking about here are in the context of computer related work, so I'm not sure if it generalizes to other situations.
Sometimes you have to do things that you don't want to do at the current moment in time, if you're like me then you might have a hard time switching gears and doing it. One way that I've found to be able to switch gears is to introduce an intermediate smoothing period so that there's not a hard-switch between the two events.
For me I turn on a youtube documentary that I don't really care about all too much, for you that might be some type of media which you don't like that much but don't mind watching, for example I just looked up "documentary" on youtube and found a documentary about drug use in ohio, which is something I wouldn't sit down and watch for a long time, but I would watch it for a while as it would capture my attenion freely, taking me from my current state into doing a different task.
While you have the other media playing which is going to help you transition to a new state, then at the same time if possible (by using another monitor) start working on the other task, while not fully committing, after a couple minutes as long as the media you selected as the transitory media is not too interesting you'll find yourself starting to focus on the real task you wanted to do. When that occurs you can either turn off the transition media or change it to something less stimulating.