Cara Membuat Crons Job di Google Drive
Tutor ini berguna untuk Auto Tweet twitter
Berikut Caranya, Cekibrot:
1. Buat Spreadsheet di Google Drive
2. Rubah Nama Spreadsheet Bebas
3. Catat ccc keynya (tempatnya berada dilink)
Contoh dibawah ini (catat yang berwarna merah):
https://docs.google.com/spreadsheet/ccc?key=0Ar7MxHL0tVx_dDlHSDMtTnFod0********&usp=drive_web#gid=0
4. Klik Tab alat lalu klik pengelola script
5. Lalu Paste kode dibawah di kode.gs
Spoiler: kode
function cronExecute() {
var url = "http://contoh.com/tweet.php";
var options = {
"method" : "get",
"headers" : {'User-Agent' : 'Mozilla Firefox 14.0',
'Accept-Charset' : 'ISO-8859-1,utf-8;q=0.7,*;q=0.7'
},
"payload" : "",
"contentType" : "application/xml; charset=utf-8"
};
var request_starttime = new Date();
// fetch the HTTP / HTTPS request and get the response
var response = UrlFetchApp.fetch(url,options);
var request_endtime = new Date();
// use any spreadsheet, use its key
// var ss = SpreadsheetApp.openById("Pastekan kode CCC disni");
// use this script's default spreadsheet
var ss = SpreadsheetApp.getActiveSpreadsheet();
// get the worksheet
var sheet = ss.getSheets()[0];
// inserting values into the sheet
sheet.insertRowBefore(1);
var colValues = [[ request_starttime, request_endtime,
response.getResponseCode(), response.getHeaders().toSource(),
url, response.getContentText() ]];
sheet.getRange(1, 1, 1, 6).setValues(colValues);
// if something is not working, use the Logger object/function (uncomment it and modify it)
// Logger.log(ss.getSpreadsheetTimeZone());
// view the log details from VIEW -> LOGS
// You can also RUN the script and view its Execution log
// try this VIEW -> EXECUTION TRANSCRIPTS
// Make sure you MODIFY and then RUN the script and
// verify its working OK by looking at the spreadsheet contents
// try this RUN -> CRONEXECUTE
// check the spreadsheet contents
// After its working OK, you should setup a TRIGGER to execute it as and when you want (frequency)
// try this TRIGGERS -> ALL YOUR TRIGGERS
}
var url = "http://contoh.com/tweet.php";
var options = {
"method" : "get",
"headers" : {'User-Agent' : 'Mozilla Firefox 14.0',
'Accept-Charset' : 'ISO-8859-1,utf-8;q=0.7,*;q=0.7'
},
"payload" : "",
"contentType" : "application/xml; charset=utf-8"
};
var request_starttime = new Date();
// fetch the HTTP / HTTPS request and get the response
var response = UrlFetchApp.fetch(url,options);
var request_endtime = new Date();
// use any spreadsheet, use its key
// var ss = SpreadsheetApp.openById("Pastekan kode CCC disni");
// use this script's default spreadsheet
var ss = SpreadsheetApp.getActiveSpreadsheet();
// get the worksheet
var sheet = ss.getSheets()[0];
// inserting values into the sheet
sheet.insertRowBefore(1);
var colValues = [[ request_starttime, request_endtime,
response.getResponseCode(), response.getHeaders().toSource(),
url, response.getContentText() ]];
sheet.getRange(1, 1, 1, 6).setValues(colValues);
// if something is not working, use the Logger object/function (uncomment it and modify it)
// Logger.log(ss.getSpreadsheetTimeZone());
// view the log details from VIEW -> LOGS
// You can also RUN the script and view its Execution log
// try this VIEW -> EXECUTION TRANSCRIPTS
// Make sure you MODIFY and then RUN the script and
// verify its working OK by looking at the spreadsheet contents
// try this RUN -> CRONEXECUTE
// check the spreadsheet contents
// After its working OK, you should setup a TRIGGER to execute it as and when you want (frequency)
// try this TRIGGERS -> ALL YOUR TRIGGERS
}
6. Liat text berwarna merah discript diatas ganti text tersebut dengan ccc dan text berwarna biru dengan url Auto Tweet anda
7. Klik sumber daya lalu klik Current project's trigges
8. Pada setting ubah menjadi Time Driven-Minutes Timer-Every Minutes/Sesua selera masing masing
9. Klik save lalu akan terbuka pop ads klik saja ijinkan jika pod ads sudah tertutup klik save lagi dan selesai
Sekian Dan Terima Kasih. Jangan Lupa Comment ya Gan :3
Sumber: Cyber IDs
Nice Tutor (h) sukses gan :d
BalasHapusTengkyu bro :D
Hapus