Just combines code for quickswitching and quickscoping (I haven't seen a quickscope macro yet though)

Code:
#define WINVER 0x0500
#include <iostream>
#include <windows.h>
#include <winable.h>

using namespace std;

void quick_switch(){
    INPUT input;

    input.type = INPUT_KEYBOARD;
    input.ki.wScan = 0;
    input.ki.time = 0;
    input.ki.dwExtraInfo = 0;
    input.ki.wVk = 0x51;
    SendInput(1, &input, sizeof(INPUT));

    Sleep(10);

    input.ki.dwFlags = KEYEVENTF_KEYUP;
    SendInput(1, &input, sizeof(INPUT));
}

void unclick(bool left_or_right){
    INPUT input = {0};
    //input.mi.dwExtraInfo = 0x200;
    input.type = INPUT_MOUSE;
    if(left_or_right){ //"left" is middle
        input.mi.dwFlags = MOUSEEVENTF_MIDDLEUP;
        SendInput(1, &input, sizeof(INPUT));
    }
    else if(!left_or_right){
        input.mi.dwFlags = MOUSEEVENTF_RIGHTUP;
        SendInput(1, &input, sizeof(INPUT));
    }
}

void click(bool left_or_right){
    INPUT input = {0};
    input.mi.dwExtraInfo = 0x200;
    input.type = INPUT_MOUSE;
    if(left_or_right){ //"left" is middle
        input.mi.dwFlags = MOUSEEVENTF_MIDDLEDOWN;
        SendInput(1, &input, sizeof(INPUT));
    }
    else if(!left_or_right){
        input.mi.dwFlags = MOUSEEVENTF_RIGHTDOWN;
        SendInput(1, &input, sizeof(INPUT));
    }
}

int main(){
    bool active = true;
    float scope_speed_seconds;
    int scope_speed_milliseconds;
    cout << "Scope speeds:" << endl;
    cout << "0.12s: Mosin Nagant Basic Scope, AWM Precision Scope" << endl;
    cout << "0.14s: FR-F2 Sharpshooter Scope, ASW.338 Quick Scope II, AWM Basic Scope, DSR-1 Quick Scope 2, Blaser R93 Sharpshooter Scope" << endl;
    cout << "0.16s: ASW.338 Sharpshooter Scope II" << endl;
    cout << "0.18s: ASW.338 Basic Scope" << endl;
    cout << "0.20s: M24 Basic Scope, SV98 Precision Scope, FR-F2 Basic Scope, DSR-1 Basic Scope, PGM.338 Precision Scope, Blaser R93 Precison Scope" << endl;
    cout << "0.21s: SV98 Basic Scope" << endl;
    cout << "0.22s: Blaser R93 Basic Scope, FR-F2 Quick Scope, DSR-1 High Powered Scope 2" << endl;
    cout << "0.30s: TPG1 High Powered Scope, PGM.338 High Powered Scope" << endl;
    cout << "0.34s: TPG1 Basic Scope, PGM.338 Basic Scope" << endl << endl;

    cout << "Enter your scope speed in seconds: ";
    cin >> scope_speed_seconds;

    scope_speed_milliseconds = scope_speed_seconds * 1000;

    while(true){
        while(active){
            if((GetKeyState(VK_LBUTTON) & 0x80) != 0){
                click(false); //click right
                unclick(false); //un_click right
                Sleep(scope_speed_milliseconds - 20); //wait for the scope to zoom
                click(true); //click left
                unclick(true); //un_click left
                Sleep(5);
                quick_switch(); //quick switch using Q
                Sleep(15);
                quick_switch(); //switch back to main weapon
            }
            if((GetKeyState(VK_END) & 0x80) != 0){
                active = false;
            }
        }
        if((GetKeyState(VK_HOME) & 0x80) != 0){
            active = true;
        }
    }
    return 0;
}
Written in C++, under Windows 7. I got the table of scope speeds from http://www.aeriagames.com/forums/en/....php?t=1842561