Bu sayfada, Apps Script ve Apps Script API'yi kullanarak aynı komut dosyalarının V8'e nasıl taşınacağı açıklanmaktadır.
Rhino çalışma zamanını kullanan tüm komut dosyalarını, Rhino'nun kullanımdan kaldırılmasından önce (31 Ocak 2026'da veya sonrasında) taşımanız gerekir. Rhino'da çalışan birden fazla aynı komut dosyanız varsa Apps Script API'yi kullanarak bunları V8'e birlikte taşıyabilirsiniz.
Ortamınızı ayarlama
- Apps Script kontrol paneli ayarlarından Apps Script API'yi etkinleştirin.
- Apps Script kontrol paneli ayarlarına gidin.
- API kapalıysa Google Apps Script API'yi tıklayın ve ardından Google Apps Script API açma/kapatma düğmesini etkinleştirin.
- Standart bir Google Cloud projesi oluşturun veya mevcut bir projeyi yeniden kullanın.
- Cloud projenizde OAuth kullanıcı rızası ekranını yapılandırın.
Cloud projenizde Apps Script API'yi etkinleştirin.
Bir Apps Komut Dosyası projesi oluşturun ve Apps Komut Dosyası projesini Cloud projenize atayın.
- Apps Komut Dosyası kontrol panelinden veya script.new adresine giderek bağımsız bir Apps Komut Dosyası projesi oluşturun.
- Proje Ayarları'nı
tıklayın.
- Google Cloud Platform (GCP) Projesi bölümünde Projeyi değiştir'i tıklayın.
- Cloud projenizin proje numarasını girin.
- Proje ayarla'yı tıklayın.
Komut dosyalarını taşıma
Aşağıdaki kod örneğinde, her Apps Komut Dosyası projesindeki dosyaları V8 uyumlu bir dosya grubuyla değiştirerek aynı komut dosyalarını Rhino'dan V8'e taşımak için Apps Komut Dosyası API'nin nasıl kullanılacağı gösterilmektedir.
Taşımak istediğiniz komut dosyası projelerine en azından düzenleyici erişiminizin olduğundan emin olun.
function updateRhinoScripts() {
// An array of script IDs of script projects to migrate.
// TODO(developer): Replace with your script IDs.
const scriptIds = ['abcdef12345678', 'abcdef12345678'];
// An array of file objects to replace the existing files in each script project.
// Remember to include all files for the script, excluded files are deleted.
// TODO(developer): Replace with your script files.
const filesToUpdate = {
"files": [
{
"name": "Code",
"type": "SERVER_JS",
"source": "// New updates\nfunction myFunction() {\n console.log('Hello, world!');\n}"
},
{
"name": "appsscript",
"type": "JSON",
"source": JSON.stringify({
"timeZone": "America/New_York",
"dependencies": {},
"exceptionLogging": "STACKDRIVER",
"runtimeVersion": "V8"
})
}
]
};
updateMultipleAppsScripts(scriptIds, filesToUpdate);
}
function updateMultipleAppsScripts(scriptIds, filesToUpdate) {
// 'scriptIds' should be an array of script IDs
// 'filesToUpdate' should be an array of objects, each with:
// name: The filename (For example, "Code", "Utilities")
// source: The source code for that file.
scriptIds.forEach(function (scriptId) {
// Makes the API request.
const response = UrlFetchApp.fetch(
`https://script.googleapis.com/v1/projects/${scriptId}/content`,
{
method: "PUT",
headers: {
Authorization: `Bearer ${ScriptApp.getOAuthToken()}`
},
contentType: "application/json",
payload: JSON.stringify(filesToUpdate),
muteHttpExceptions: true
}
);
if (response.getResponseCode() !== 200) {
console.log(`Error updating script ${scriptId}: ${response.getContentText()}`);
} else {
console.log(`Script ${scriptId} updated successfully!`);
}
});
}
Apps Script API'yi Apps Script projenizde kullanmak için manifest dosyanıza aşağıdaki OAuth kapsamlarını eklemeniz gerekir:
"https://www.googleapis.com/auth/script.projects"
"https://www.googleapis.com/auth/script.external_request"
Manifest dosyasını düzenleyicide göstermek için Proje Ayarları'nı tıklayın
ve "appsscript.json" manifest dosyasını düzenleyicide göster kutusunu işaretleyin. Aşağıda, uygun OAuth kapsamlarını içeren örnek bir manifest dosyası verilmiştir:
{
"timeZone": "America/Denver",
"dependencies": {
},
"oauthScopes": [
"https://www.googleapis.com/auth/script.projects",
"https://www.googleapis.com/auth/script.external_request"
],
"exceptionLogging": "STACKDRIVER",
"runtimeVersion": "V8"
}