Aberdeen will play Maribor of Slovenia or Bulgarian side Levski Sofia if they progress to the third qualifying round of the Europa League.
Derek McInnes's side are in a strong position ahead of Thursday's trip to Latvia after beating Ventspils 3-0 at Pittodrie last night.
Hearts, who drew 0-0 with Birkirkara in Malta, will face Krasnodar of Russia if they make it through while Hibernian, who trail Brondby 1-0, could meet Hertha Berlin.
Ties are due to be played on Thursday July 28 and Thursday August 4.