Groups
Groups
Sign in
Groups
Groups
Google Apps API Japan
Conversations
Labels
About
Send feedback
Help
スクリプト分割時の変数の引き継ぎについて
1,064 views
Skip to first unread message
にんまりpapa
unread,
Nov 19, 2014, 8:44:49 PM
11/19/14
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to google-app...@googlegroups.com
こんにちは!
GASの初級者です。件名についてどなたか教えて頂けると助かります。
スクリプトの行数が100行を超える場合の対策や、プログラムの可読性を上げる目的等でスクリプトを分割したいことがあります。
スクリプトを分割した場合、スクリプト間で変数を引き継ぐことは可能でしょうか?
可能な場合、その記述例をご教示頂けないでしょうか?
dainnne
unread,
Nov 20, 2014, 2:03:43 AM
11/20/14
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to google-app...@googlegroups.com
1 プロジェクトをまたいで関数を共有するならライブラリ
http://www.bmoo.net/archives/2012/07/314396.html
2 gsファイル 問題なく参照できます
3 PropertiesService.getScriptProperties().setProperty("key", "value")
4 関数 に引数で渡す
function A(){
B();
}
function B(){
Logger.log("Hello") ;
var e= "hoge";
C(e);
}
function C(e){
Logger.log(e);
}
5 クラスにして格納
にんまりpapa
unread,
Nov 20, 2014, 5:14:15 PM
11/20/14
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to google-app...@googlegroups.com
dainnne 様
早速のご教示をありがとうございます。
スクリプト間で変数の引き継ぎが可能であると言うことがわかりました。
ご提示いただいたサンプルで、関数に引数で引き渡す方法についていろいろ試しています。
またサイトでスクリプトの「引数」に関する記事を探して学習してみます。
2014年11月20日木曜日 10時44分49秒 UTC+9 にんまりpapa:
Reply all
Reply to author
Forward
0 new messages