2017-08-30 56 views
0

應用程序腳本執行我有在應用腳本程序如下:如何終止條件

// get all email threads that match label from Sheet 
var threads = GmailApp.search ("label:" + label); 

因爲我移動處理線程到另一個標籤,有些時候我沒有未處理的線程。如果沒有線程可以處理,我該如何終止執行?

回答

1

這對你有用嗎?

if (!threads || threads.length < 1) { 

    return; 

} 
+0

謝謝,那是行不通的。 – user61629