For GTA 5 purchased on a disk (so only attached to your Rockstar Social club Account):
Note that you will have to have installed and registered the game license from the disks at least once before this process. Go to the Rockstar Social Club website:
Then sign in with your Rockstar Social Club credentials. If you attached a social media account to your RSSC account, you can also sign in using the relevant service, which could be easier if you are already logged into that service.
Once you're signed in, go to the top right icon that represents your RSSC avatar (default the Rockstar R), and click Game Downloads in that menu. you are presented a list of games, and the first game should be GTA V. you can click download to download the installer. then after you downloaded and ran the installer, you can start the launcher and download the rest of the game (about 70-80 GB last time I checked).
It is possible that GTA IV purchased on a disk can also be downloaded through this method, but I'm not entirely sure how that works because I own my copy on Steam and haven't had to do the disk install in years.