The words you are searching are inside this book. To get more targeted content, please make full-text search by clicking here.
Discover the best professional documents and content resources in AnyFlip Document Base.
Search
Published by PSN Chanel, 2023-09-06 02:55:47

คู่มือ Line Hackathon27

คู่มือ Line Hackathon27

Line Hackathon27 รับขอความ แสดงผลผาน line Hackathon27 Code


var CHANNEL_ACCESS_TOKEN = 'jY2U6nGOITv1Vr10f9zSE32HyiDORUJKtn6YICXRP/CVIGhU7z4hrlwl4kAY/4PhG7VVYD6KOR2roO7ibW1VEY 7TBfWTeqr1DdTHXDU02Zo9Xm7Ib9ox7irndiJ8K5rOE1w409kSVJAWoQ6Y2sFYewdB04t89/1O/w1cDnyilFU=' ; var line_endpoint = 'https://api.line.me/v2/bot/message/reply'; function doGet(request) { return ContentService.createTextOutput(JSON.stringify({ post: "ok" })).setMimeType(ContentService.MimeType.JSON); } var ws = SpreadsheetApp.openById('1qkrn1OYo_-ZEfycCZQBfujJT5jF7X4VUDAw4sw8r_oE') //**********ID Sheet*******// var sheet = ws.getSheetByName("Line"); //*****************ชอแผ่น ื่ งาน*****************************// var data = sheet.getRange(2, 1, sheet.getLastRow(), sheet.getLastColumn()).getDisplayValues(); //Logger.log(data) function replyMsg(replyToken, mess, channelToken) { var url = 'https://api.line.me/v2/bot/message/reply'; var opt = { 'headers': { 'Content-Type': 'application/json; charset=UTF-8', 'Authorization': 'Bearer ' + channelToken, }, 'method': 'post', 'payload': JSON.stringify({ 'replyToken': replyToken, 'messages': mess }) }; UrlFetchApp.fetch(url, opt); } //************* ปรากฏเมนู หาก ไม่มีข ้อมูล***/ var result={ "type": "text", "text": "ไม่เข ้าใจคําถามหรือความต้องการของท่าน ขออภัยด้วยครับ", "quickReply": { "items": [ { "type": "action", "action": { "type": "uri", "label": "ลงทะเบียน", "uri": "https://vapidinformalpasswords.psn-chanelchane.repl.co" } }, { "type": "action", "action": { "type": "uri", "label": "สงงาน" ่ ,


"uri": "https://script.google.com/macros/s/AKfycbzg7WKij31AJk0iA8swIWsgbahMLRX2HsDmfsmjcbIb31gy52lxX1HS-Xb5xYruV0/exec" } } ] } } //*************End ปรากฏเมนู หาก ไม่มีข ้อมูล***/ function doPost(e) { var json = JSON.parse(e.postData.contents); var reply_token = json.events[0].replyToken; var message = json.events[0].message.text; //**********LINE FLEX MESSAGE กิจเฉพาะ ********* if (message=='กิจเฉพาะ'){ result={ "type": "flex", "altText": "Flex Message", "contents": { "type": "carousel", "contents": [ { "type": "bubble", "hero": { "type": "image", "url": "https://sv1.picz.in.th/images/2023/08/12/dWWxoU0.jpeg", "gravity": "center", "size": "full", "aspectMode": "cover" }, "body": { "type": "box", "layout": "vertical", "contents": [ { "type": "text", "text": "เรื่อง ป้อมสนาม", "weight": "regular", "wrap": true }, { "type": "text", "text": "เรื่อง การถอนตัวนอกความกดดัน", "margin": "md", "size": "md", "wrap": true }, { "type": "text", "text": "เรื่อง การถอนตัวภายใต้ความกดดัน", "size": "md", "margin": "md", "wrap": true


}, { "type": "text", "text": "เรื่อง เครื่องกีดขวาง", "margin": "md", "wrap": true }, { "type": "text", "text": "เรื่อง ตั้งรับ", "margin": "md", "wrap": true } ] }, "footer": { "type": "box", "layout": "vertical", "contents": [ { "type": "text", "text": "Click", "gravity": "center", "align": "center", "action": { "type": "uri", "label": "action", "uri": "https://script.google.com/macros/s/AKfycbzBfbQwpZPJNcKKe3QMv4YY7jBQ2ygpf7udU9wZV1AuNfS F3awkHx4cSbve27lOfFx5/exec" } } ], "backgroundColor": "#E18AAA" } }, { "type": "bubble", "hero": { "type": "image", "url": "https://sv1.picz.in.th/images/2023/08/12/dWWQS2b.jpeg", "gravity": "center", "size": "full", "aspectMode": "cover" }, "body": { "type": "box", "layout": "vertical", "contents": [ { "type": "text", "text": "เรื่อง เข ้าตีเวลากลางวัน", "weight": "regular", "wrap": true }, { "type": "text", "text": "เรื่อง เข ้าตีเวลากลางคืน",


"margin": "md", "size": "md", "wrap": true }, { "type": "text", "text": "เรื่อง ยิงปืนประกอบการเคลื่อนที่", "size": "md", "margin": "md", "wrap": true }, { "type": "text", "text": "เรื่อง การนําหน่วย / คําสงฯ" ั่ , "margin": "md", "wrap": true } ] }, "footer": { "type": "box", "layout": "vertical", "contents": [ { "type": "text", "text": "Click", "gravity": "center", "align": "center", "action": { "type": "uri", "label": "action", "uri": "https://script.google.com/macros/s/AKfycbx9jRqJcnsphLXRxkxOWOmqzffQ9jx3IXolEGhcGZ3BJgx ZiK8wcIi2SeeB_QpRHYk/exec" } } ], "backgroundColor": "#E18AAA" } }, { "type": "bubble", "hero": { "type": "image", "url": "https://sv1.picz.in.th/images/2023/08/12/dWWQCSD.jpeg", "gravity": "center", "size": "full", "aspectMode": "cover" }, "body": { "type": "box", "layout": "vertical", "contents": [ { "type": "text", "text": "เรื่อง เทคนิคการเคลื่อนที่", "weight": "regular", "wrap": true


}, { "type": "text", "text": "เรื่อง การเคลื่อนที่ รูปขบวน หม่◌ู ปล.", "margin": "md", "size": "md", "wrap": true }, { "type": "text", "text": "เรื่อง การรบในพื้นที่สงปลูกสร ้าง" ิ่ , "size": "md", "margin": "md", "wrap": true }, { "type": "text", "text": "เรื่อง การใชทัศนส ้ ญญาณ" ั , "margin": "md", "wrap": true }, { "type": "text", "text": "เรื่อง แบบฝึกทําการรบ", "wrap": true } ] }, "footer": { "type": "box", "layout": "vertical", "contents": [ { "type": "text", "text": "Click", "gravity": "center", "align": "center", "action": { "type": "uri", "label": "action", "uri": "https://script.google.com/macros/s/AKfycbz2k98eeVOesTlIZcDgNGMi6nmdHZCqDZCWRph7uPXkpOoV9rn8CY_He2EiK_Ux-sn/exec" } } ], "backgroundColor": "#E18AAA" } } ] } } } //******************** */ if (message=='สงงาน่ '){ result={ "type": "flex",


"altText": "Flex Message", "contents": { "type": "bubble", "hero": { "type": "image", "url": "https://sv1.picz.in.th/images/2023/08/29/dWRFoil.jpeg", "size": "full", "aspectRatio": "20:13", "aspectMode": "cover", "action": { "type": "uri", "label": "Line", "uri": "https://linecorp.com/" } }, "body": { "type": "box", "layout": "vertical", "contents": [ { "type": "text", "text": "ระบบสงงานออนไลน์" ่ , "weight": "bold", "size": "xl", "contents": [] } ] }, "footer": { "type": "box", "layout": "vertical", "flex": 0, "spacing": "sm", "contents": [ { "type": "button", "action": { "type": "uri", "label": "Click", "uri": "https://script.google.com/macros/s/AKfycbzg7WKij31AJk0iA8swIWsgbahMLRX2HsDmfsmjcbIb31gy52lxX1HS-Xb5xYruV0/exec" }, "height": "sm", "style": "link" } ] } } } } //********************ห ้องเรียน */ if (message=='ห ้องเรียน'){ result={ "type": "flex", "altText": "Flex Message", "contents": { "type": "bubble", "hero": {


"type": "image", "url": "https://sv1.picz.in.th/images/2023/08/29/dWRINEI.jpeg", "size": "full", "aspectRatio": "20:13", "aspectMode": "cover", "action": { "type": "uri", "label": "Line", "uri": "https://linecorp.com/" } }, "body": { "type": "box", "layout": "vertical", "contents": [ { "type": "text", "text": "ห ้องเรียนออนไลน์", "weight": "bold", "size": "xl", "contents": [] } ] }, "footer": { "type": "box", "layout": "vertical", "flex": 0, "spacing": "sm", "contents": [ { "type": "button", "action": { "type": "uri", "label": "Click", "uri": "https://script.google.com/macros/s/AKfycby7c22EkJBpWeLdy12xJvzAJvVe00ouAWi0hw_a2JVqmI8EV5i-9t9lCHBSseKgFHY/exec" }, "height": "sm", "style": "link" } ] } } } } //********************ลงทะเบียน */ if (message=='ลงทะเบียน'){ result= { "type": "flex", "altText": "Flex Message", "contents": { "type": "bubble", "hero": {


"type": "image", "url": "https://sv1.picz.in.th/images/2023/08/29/dWRLn0v.jpeg", "size": "full", "aspectRatio": "20:13", "aspectMode": "cover", "action": { "type": "uri", "label": "Action", "uri": "https://linecorp.com" } }, "body": { "type": "box", "layout": "vertical", "spacing": "md", "action": { "type": "uri", "label": "Action", "uri": "https://linecorp.com" }, "contents": [ { "type": "text", "text": "ลงทะเบียน", "weight": "bold", "size": "xl", "contents": [] }, { "type": "text", "text": "กรุณาลงทะเบียนก่อนใชงาน" ้ , "size": "xxs", "color": "#AAAAAA", "wrap": true, "contents": [] } ] }, "footer": { "type": "box", "layout": "vertical", "contents": [ { "type": "spacer", "size": "xxl" }, { "type": "button", "action": { "type": "uri", "label": "Click", "uri": "https://vapidinformalpasswords.psn-chanelchane.repl.co/" }, "color": "#905C44", "style": "primary" } ] }


} } } //**********LINE FLEX MESSAGE นิเทศผ้◌ูสอน ********* if (message=='นิเทศ'){ result={ "type": "flex", "altText": "Flex Message", "contents": { "type": "bubble", "hero": { "type": "box", "layout": "vertical", "contents": [ { "type": "image", "url": "https://sv1.picz.in.th/images/2023/08/13/dWWJuvb.png", "align": "center", "size": "full" } ] }, "body": { "type": "box", "layout": "vertical", "contents": [ { "type": "text", "text": "ระบบนิเทศผู้สอน", "weight": "bold", "size": "xl", "wrap": true }, { "type": "text", "text": "แผนกยุทธวิธี กองการศกษา" ึ , "margin": "md", "wrap": true }, { "type": "text", "text": "โรงเรียนนายสบทหารบก" ิ , "margin": "md", "wrap": true } ] }, "footer": { "type": "box", "layout": "vertical", "spacing": "sm", "contents": [ { "type": "text", "text": "Click", "weight": "bold",


"align": "center", "action": { "type": "uri", "label": "action", "uri": "http://linecorp.com/", "altUri": { "desktop": "https://script.google.com/macros/s/AKfycbyGMLqv7ZpB8PcsMSLvUlLRm8f9bZShqV1b_1xf3U8MrAWeH93kSNIDWi55Gpbq1jw/exec" } } } ], "flex": 0, "backgroundColor": "#bdbdbd" } } } //********** if (message=='123789'){ result={ "type": "flex", "altText": "Flex Message", "contents": { "type": "bubble", "hero": { "type": "image", "url": "https://sv1.picz.in.th/images/2023/08/29/dWRmAze.jpeg", "size": "full", "aspectRatio": "20:13", "aspectMode": "cover", "action": { "type": "uri", "label": "Action", "uri": "https://linecorp.com" } }, "body": { "type": "box", "layout": "vertical", "spacing": "md", "action": { "type": "uri", "label": "Action", "uri": "https://linecorp.com" }, "contents": [ { "type": "text", "text": "ห ้องเรียนออนไลน์", "weight": "bold", "size": "xl", "contents": [] }, { "type": "text",


"text": "การศกษาด้วยตนเอง" ึ , "size": "xxs", "color": "#AAAAAA", "wrap": true, "contents": [] } ] }, "footer": { "type": "box", "layout": "vertical", "contents": [ { "type": "spacer", "size": "xxl" }, { "type": "button", "action": { "type": "uri", "label": "Click", "uri": "https://script.google.com/macros/s/AKfycbzYr_Cz1jk665n04jEa8ETt8BJx126T8wtYSDiPT4myLxD DLuzTVQkF1R64PHk8tVqw/exec" }, "color": "#905C44", "style": "primary" } ] } } } } } //**********LINE FLEX MESSAGE แบบทดสอบ ********* if (message=='แบบทดสอบ'){ result={ "type": "flex", "altText": "Flex Message", "contents": { "type": "carousel", "contents": [ { "type": "bubble", "hero": { "type": "image", "url": "https://sv1.picz.in.th/images/2023/08/12/MMmqL9.png", "size": "full", "aspectMode": "cover" }, "body": { "type": "box", "layout": "vertical", "contents": [ {


"type": "text", "text": "แบบทดสอบก่อนเรียน", "weight": "bold", "size": "xl", "wrap": true }, { "type": "text", "text": "หลักสูตรนักเรียนนายสบทหารบก" ิ , "margin": "md", "wrap": true }, { "type": "text", "text": "แผนกยุทธวิธี" } ], "margin": "xxl", "backgroundColor": "#78909c" }, "footer": { "type": "box", "layout": "vertical", "contents": [ { "type": "text", "text": "Click", "gravity": "center", "align": "center", "wrap": true, "size": "xl", "weight": "bold" } ], "backgroundColor": "#e84e40", "action": { "type": "uri", "label": "action", "uri": "https://script.google.com/macros/s/AKfycbxEExTrfthUrUY_lHV4bBDK0BDOyVK9hX29Fjo8zmeeRGT0DzF9oUf04JhR1d_0AxB/exec" } } }, { "type": "bubble", "hero": { "type": "image", "url": "https://sv1.picz.in.th/images/2023/08/12/MMy439.png", "size": "full", "aspectMode": "cover" }, "body": { "type": "box", "layout": "vertical", "contents": [ { "type": "text", "text": "แบบทดสอบหลังเรียน",


"weight": "bold", "size": "xl", "wrap": true }, { "type": "text", "text": "หลักสูตรนักเรียนนายสบทหารบก" ิ , "margin": "md", "wrap": true }, { "type": "text", "text": "แผนกยุทธวิธี" } ], "margin": "xxl", "backgroundColor": "#9e9e9e" }, "footer": { "type": "box", "layout": "vertical", "contents": [ { "type": "text", "text": "Click", "gravity": "center", "align": "center", "wrap": true, "size": "xl", "weight": "bold", "action": { "type": "uri", "label": "action", "uri": "https://script.google.com/macros/s/AKfycbys8N98IpQonhmMHJK70RUTMRQGPft0QVshY3Y81323cQe lyABrt6CbOQx2WtL67D0/exec" } } ], "backgroundColor": "#fbc02d" } } ] } } } //********** END LINE FLEX MESSAGE แบบทดสอบ ********* //**********LINE FLEX MESSAGE ตํารา ********* if (message=='ตํารา'){ result={ "type": "flex",


"altText": "Flex Message", "contents": { "type": "carousel", "contents": [ { "type": "bubble", "hero": { "type": "image", "url": "https://sv1.picz.in.th/images/2023/08/12/MMQbKP.png", "size": "full", "aspectMode": "cover" }, "body": { "type": "box", "layout": "vertical", "contents": [ { "type": "text", "text": "คู่มือวิชายุทวิธี เล่ม 1", "weight": "bold", "size": "xl", "margin": "none" }, { "type": "text", "text": "หลักสูตรนักเรียนนายสบทหารบก" ิ , "margin": "md" } ], "backgroundColor": "#F0EEE6" }, "footer": { "type": "box", "layout": "vertical", "contents": [ { "type": "text", "text": "Download", "align": "center", "action": { "type": "uri", "label": "action", "uri": "https://drive.google.com/file/d/11JLcxCV3zZygm_GOtFLfIWiek_PkTtFt/view?usp=sharing" }, "weight": "bold" } ], "backgroundColor": "#F2DB4D", "margin": "xl" } }, { "type": "bubble", "hero": { "type": "image", "url": "https://sv1.picz.in.th/images/2023/08/12/MMQHmg.png", "size": "full",


"aspectMode": "cover" }, "body": { "type": "box", "layout": "vertical", "contents": [ { "type": "text", "text": "คู่มือวิชายุทวิธี เล่ม 2", "weight": "bold", "size": "xl", "margin": "none" }, { "type": "text", "text": "หลักสูตรนักเรียนนายสบทหารบก" ิ , "margin": "md" } ], "backgroundColor": "#F0EEE6" }, "footer": { "type": "box", "layout": "vertical", "contents": [ { "type": "text", "text": "Download", "align": "center", "action": { "type": "uri", "label": "action", "uri": "https://drive.google.com/file/d/1r4YOQdJFhc0V9Yg1- MDeZYQKuLQ4YTgy/view?usp=sharing" }, "weight": "bold" } ], "backgroundColor": "#f69988", "margin": "xl" } }, { "type": "bubble", "hero": { "type": "image", "url": "https://sv1.picz.in.th/images/2023/08/12/MMQG4y.png", "size": "full", "aspectMode": "cover" }, "body": { "type": "box", "layout": "vertical", "contents": [ { "type": "text", "text": "คู่มือวิชายุทวิธี เล่ม 3", "weight": "bold",


"size": "xl", "margin": "none" }, { "type": "text", "text": "หลักสูตรนักเรียนนายสบทหารบก" ิ , "margin": "md" } ], "backgroundColor": "#F0EEE6" }, "footer": { "type": "box", "layout": "vertical", "contents": [ { "type": "text", "text": "Download", "align": "center", "action": { "type": "uri", "label": "action", "uri": "https://drive.google.com/file/d/1dNg-430Uv6mEzfqI3RyWXfzXl_wUsRP/view?usp=sharing" }, "weight": "bold" } ], "backgroundColor": "#ce93d8", "margin": "xl" } }, { "type": "bubble", "hero": { "type": "image", "url": "https://sv1.picz.in.th/images/2023/08/12/MMQJQD.png", "size": "full", "aspectMode": "cover" }, "body": { "type": "box", "layout": "vertical", "contents": [ { "type": "text", "text": "คู่มือวิชายุทวิธี ", "weight": "bold", "size": "xl", "margin": "none" }, { "type": "text", "text": "หลักสูตรนักเรียนนายสบทหารบก" ิ , "margin": "md" } ], "backgroundColor": "#F0EEE6"


}, "footer": { "type": "box", "layout": "vertical", "contents": [ { "type": "text", "text": "Download", "align": "center", "action": { "type": "uri", "label": "action", "uri": "https://drive.google.com/file/d/1ZvZOxt5RrCd7kyt9TNtyBnu15EU3pAP/view?usp=sharing" }, "weight": "bold" } ], "backgroundColor": "#42bd41", "margin": "xl" } } ] } } } //********** END LINE FLEX MESSAGE ตํารา ********* //**********LINE FLEX MESSAGE วิธีใช ********* ้ if (message=='วิธีใช'้){ result={ "type": "flex", "altText": "Flex Message", "contents": { "type": "bubble", "size": "mega", "header": { "type": "box", "layout": "vertical", "contents": [ { "type": "box", "layout": "vertical", "contents": [ { "type": "text", "text": "การใชงาน" ้ , "color": "#ffffff66", "size": "sm" }, { "type": "text", "text": "Hackathon27", "color": "#ffffff", "size": "xl",


"flex": 4, "weight": "bold" } ] }, { "type": "box", "layout": "vertical", "contents": [ { "type": "text", "text": "TO", "color": "#ffffff66", "size": "sm" }, { "type": "text", "text": "NCO27", "color": "#ffffff", "size": "xl", "flex": 4, "weight": "bold" } ] } ], "paddingAll": "20px", "backgroundColor": "#0367D3", "spacing": "md", "height": "154px", "paddingTop": "22px" }, "body": { "type": "box", "layout": "vertical", "contents": [ { "type": "text", "text": "ขั้นตอนการใชงาน" ้ , "color": "#b7b7b7", "size": "xs" }, { "type": "box", "layout": "horizontal", "contents": [ { "type": "text", "text": "ขั้นที่ 1", "size": "sm", "gravity": "center" }, { "type": "box", "layout": "vertical", "contents": [ { "type": "filler"


}, { "type": "box", "layout": "vertical", "contents": [], "cornerRadius": "30px", "height": "12px", "width": "12px", "borderColor": "#EF454D", "borderWidth": "2px" }, { "type": "filler" } ], "flex": 0 }, { "type": "text", "text": "แอด Hackthon", "gravity": "center", "flex": 4, "size": "sm" } ], "spacing": "lg", "cornerRadius": "30px", "margin": "xl" }, { "type": "box", "layout": "horizontal", "contents": [ { "type": "box", "layout": "baseline", "contents": [ { "type": "filler" } ], "flex": 1 }, { "type": "box", "layout": "vertical", "contents": [ { "type": "box", "layout": "horizontal", "contents": [ { "type": "filler" }, { "type": "box", "layout": "vertical", "contents": [],


"width": "2px", "backgroundColor": "#B7B7B7" }, { "type": "filler" } ], "flex": 1 } ], "width": "12px" }, { "type": "text", "text": "เป็นเพื่อน", "gravity": "center", "flex": 4, "size": "xs", "color": "#8c8c8c" } ], "spacing": "lg", "height": "64px" }, { "type": "box", "layout": "horizontal", "contents": [ { "type": "box", "layout": "horizontal", "contents": [ { "type": "text", "text": "ขั้นที่ 2", "gravity": "center", "size": "sm" } ], "flex": 1 }, { "type": "box", "layout": "vertical", "contents": [ { "type": "filler" }, { "type": "box", "layout": "vertical", "contents": [], "cornerRadius": "30px", "width": "12px", "height": "12px", "borderWidth": "2px", "borderColor": "#6486E3" },


{ "type": "filler" } ], "flex": 0 }, { "type": "text", "text": "ลงทะเบียน", "gravity": "center", "flex": 4, "size": "sm" } ], "spacing": "lg", "cornerRadius": "30px" }, { "type": "box", "layout": "horizontal", "contents": [ { "type": "box", "layout": "baseline", "contents": [ { "type": "filler" } ], "flex": 1 }, { "type": "box", "layout": "vertical", "contents": [ { "type": "box", "layout": "horizontal", "contents": [ { "type": "filler" }, { "type": "box", "layout": "vertical", "contents": [], "width": "2px", "backgroundColor": "#6486E3" }, { "type": "filler" } ], "flex": 1 } ], "width": "12px" },


{ "type": "text", "text": "กรอกข ้อมูล", "gravity": "center", "flex": 4, "size": "xs", "color": "#8c8c8c" } ], "spacing": "lg", "height": "64px" }, { "type": "box", "layout": "horizontal", "contents": [ { "type": "text", "text": "ขั้นที่ 3", "gravity": "center", "size": "sm" }, { "type": "box", "layout": "vertical", "contents": [ { "type": "filler" }, { "type": "box", "layout": "vertical", "contents": [], "cornerRadius": "30px", "width": "12px", "height": "12px", "borderColor": "#6486E3", "borderWidth": "2px" }, { "type": "filler" } ], "flex": 0 }, { "type": "text", "text": "เข ้าใชงาน " ้ , "gravity": "center", "flex": 4, "size": "sm" } ], "spacing": "lg", "cornerRadius": "30px" } ] }


} } } //**********LINE FLEX MESSAGE จบวิธีใช ********* ้ //********** LINE FLEX แจ้งคะแนน แบบมีเงื่อนไข คะแนน,XXXXX ********* var msg = message.split(',') if(msg[0]=='คะแนน'){ var msg1 = msg[1] for (var i = 0; i < data.length; i++) { if (data[i][0] == msg1) { i = i + 2; var data1 = sheet.getRange(i, 1).getDisplayValue(); //รหัส var data2 = sheet.getRange(i, 2).getDisplayValue(); //รหัส var data3 = sheet.getRange(i, 3).getDisplayValue(); //รหัส var data4 = sheet.getRange(i, 4).getDisplayValue(); //รหัส var data5 = sheet.getRange(i, 5).getDisplayValue(); //รหัส var data6 = sheet.getRange(i, 6).getDisplayValue(); //รหัส var data7 = sheet.getRange(i, 7).getDisplayValue(); //รหัส var data8 = sheet.getRange(i, 8).getDisplayValue(); //รหัส var data9 = sheet.getRange(i, 9).getDisplayValue(); //รหัส var data10 = sheet.getRange(i, 10).getDisplayValue(); //รหัส var data11 = sheet.getRange(i, 11).getDisplayValue(); //รหัส var data12 = sheet.getRange(i, 12).getDisplayValue(); //รหัส var data13 = sheet.getRange(i, 13).getDisplayValue(); //รหัส var data14 = sheet.getRange(i, 14).getDisplayValue(); //รหัส var data15 = sheet.getRange(i, 15).getDisplayValue(); //รหัส var data16 = sheet.getRange(i, 16).getDisplayValue(); //รหัส var data17 = sheet.getRange(i, 17).getDisplayValue(); //รหัส var data18 = sheet.getRange(i, 18).getDisplayValue(); //รหัส var data19 = sheet.getRange(i, 19).getDisplayValue(); //รหัส var data20 = sheet.getRange(i, 20).getDisplayValue(); //รหัส var data21 = sheet.getRange(i, 21).getDisplayValue(); //รหัส var data22 = sheet.getRange(i, 22).getDisplayValue(); //รหัส // var data23 = sheet.getRange(i, 23).getDisplayValue(); //รหัส result = //------------------------------- LINE FLEX MESSAGE คะแนน------------------------------------------// { "type": "bubble", "body": { "type": "box", "layout": "vertical", "contents": [ { "type": "text", "text": "ข ้อมูลผู้เรียน", "weight": "bold", "color": "#1DB446", "size": "lg"


}, { "type": "text", "text": data2, "weight": "bold", "size": "xxl", "margin": "md" }, { "type": "text", "text": "โดยแผนกยุทธวิธี", "size": "lg", "color": "#1DB446", "size": "lg", "wrap": true }, { "type": "separator", "margin": "xxl" }, { "type": "box", "layout": "vertical", "margin": "xxl", "spacing": "sm", "contents": [ { "type": "box", "layout": "horizontal", "contents": [ { "type": "text", "text": "เลขประจําตัว", "size": "lg", "color": "#555555", "flex": 0 }, { "type": "text", "text": data1, "size": "lg", "color": "#111111", "align": "end" } ] }, { "type": "box", "layout": "horizontal", "contents": [ { "type": "text", "text": "สงกัด" ั , "size": "lg", "color": "#555555", "flex": 0


}, { "type": "text", "text": data3, "size": "lg", "color": "#111111", "align": "end" } ] }, { "type": "box", "layout": "horizontal", "contents": [ { "type": "text", "text": "E-mail", "size": "lg", "color": "#555555", "flex": 0 }, { "type": "text", "text": data4, "size": "lg", "color": "#111111", "align": "end" } ] }, { "type": "separator", "margin": "xxl" }, { "type": "box", "layout": "horizontal", "margin": "xxl", "contents": [ { "type": "text", "text": "ป้อมสนาม(4)", "size": "lg", "color": "#555555" }, { "type": "text", "text": data5, "size": "lg", "color": "#111111", "align": "end" } ] }, { "type": "box", "layout": "horizontal", "margin": "xxl",


"contents": [ { "type": "text", "text": "เครื่องกีดขวาง(4)", "size": "lg", "color": "#555555" }, { "type": "text", "text": data6, "size": "lg", "color": "#111111", "align": "end" } ] }, { "type": "box", "layout": "horizontal", "margin": "xxl", "contents": [ { "type": "text", "text": "รูปขบวนหมู่(4) ", "size": "lg", "color": "#555555" }, { "type": "text", "text": data7, "size": "lg", "color": "#111111", "align": "end" } ] }, { "type": "box", "layout": "horizontal", "margin": "xxl", "contents": [ { "type": "text", "text": "ทัศนสญญาน( ั 4)", "size": "lg", "color": "#555555" }, { "type": "text", "text": data8, "size": "lg", "color": "#111111", "align": "end" } ] }, { "type": "box",


"layout": "horizontal", "margin": "xxl", "contents": [ { "type": "text", "text": "การเคลื่อนที่(4)", "size": "lg", "color": "#555555" }, { "type": "text", "text": data9, "size": "lg", "color": "#111111", "align": "end" } ] }, { "type": "box", "layout": "horizontal", "margin": "xxl", "contents": [ { "type": "text", "text": "ระเบียบคําสงฯ( ั่ 6)", "size": "lg", "color": "#555555" }, { "type": "text", "text": data10, "size": "lg", "color": "#111111", "align": "end" } ] }, { "type": "box", "layout": "horizontal", "margin": "xxl", "contents": [ { "type": "text", "text": "ตีกลางวัน(6)", "size": "lg", "color": "#555555" }, { "type": "text", "text": data11, "size": "lg", "color": "#111111", "align": "end" } ] },


{ "type": "box", "layout": "horizontal", "margin": "xxl", "contents": [ { "type": "text", "text": "ตีกลางคืน(6)", "size": "lg", "color": "#555555" }, { "type": "text", "text": data12, "size": "lg", "color": "#111111", "align": "end" } ] }, { "type": "box", "layout": "horizontal", "margin": "xxl", "contents": [ { "type": "text", "text": "ตั้งรับ(8)", "size": "lg", "color": "#555555" }, { "type": "text", "text": data13, "size": "lg", "color": "#111111", "align": "end" } ] }, { "type": "box", "layout": "horizontal", "margin": "xxl", "contents": [ { "type": "text", "text": "ถอนตัว(8)", "size": "lg", "color": "#555555" }, { "type": "text", "text": data14, "size": "lg", "color": "#111111", "align": "end" }


] }, { "type": "box", "layout": "horizontal", "margin": "xxl", "contents": [ { "type": "text", "text": "ยิงปืนเคลื่อนที่(8)", "size": "lg", "color": "#555555" }, { "type": "text", "text": data15, "size": "lg", "color": "#111111", "align": "end" } ] }, { "type": "box", "layout": "horizontal", "margin": "xxl", "contents": [ { "type": "text", "text": "แบบฝึกการรบ(4)", "size": "lg", "color": "#555555" }, { "type": "text", "text": data16, "size": "lg", "color": "#111111", "align": "end" } ] }, { "type": "box", "layout": "horizontal", "margin": "xxl", "contents": [ { "type": "text", "text": "MOUT(8)", "size": "lg", "color": "#555555" }, { "type": "text", "text": data17, "size": "lg", "color": "#111111",


"align": "end" } ] }, { "type": "box", "layout": "horizontal", "margin": "xxl", "contents": [ { "type": "text", "text": "กลางภาค(15)", "size": "lg", "color": "#555555" }, { "type": "text", "text": data18, "size": "lg", "color": "#111111", "align": "end" } ] }, { "type": "box", "layout": "horizontal", "contents": [ { "type": "text", "text": "ปลายภาค(15)", "size": "lg", "color": "#555555" }, { "type": "text", "text": data19, "size": "lg", "color": "#111111", "align": "end" }, ] }, { "type": "box", "layout": "horizontal", "contents": [ { "type": "text", "text": "รวมคะแนน(100)", "size": "lg", "color": "#1DB446" }, { "type": "text", "text": data20, "size": "lg", "color": "#1DB446",


"align": "end" }, ] }, { "type": "box", "layout": "horizontal", "contents": [ { "type": "text", "text": "เกรด", "size": "lg", "color": "#b41d1d" }, { "type": "text", "text": data21, "size": "lg", "color": "#b41d1d", "align": "end" }, ] }, { "type": "box", "layout": "horizontal", "contents": [ { "type": "text", "text": "สถานะ", "size": "lg", "color": "#1d22b4" }, { "type": "text", "text": data22, "size": "lg", "color": "#1d22b4", "align": "end" }, ] } ] }, { "type": "separator", "margin": "xxl" }, { "type": "box", "layout": "horizontal", "margin": "md", "contents": [ { "type": "text", "text": "Tactical Studies Section", "size": "xs", "color": "#1DB446",


"flex": 0 }, { "type": "text", "text": "โดย ร.ท.พิษณุ ปิ่นชาติ", "color": "#1DB446", "size": "xs", "align": "end" } ] } ] }, "styles": { "footer": { "separator": true } } } result = { 'type': 'flex', 'altText': 'This is Flex Message', 'contents': result } break; };//End if };//End for } UrlFetchApp.fetch(line_endpoint, { 'headers': { 'Content-Type': 'application/json; charset=UTF-8', 'Authorization': 'Bearer ' + CHANNEL_ACCESS_TOKEN, }, 'method': 'post', 'payload': JSON.stringify({ 'replyToken': reply_token, 'messages': [result], }), }); var replyJSON = ContentService.createTextOutput(JSON.stringify(result)).setMimeType(ContentService.Mime Type.JSON); return replyJSON; } //************* End flax คะแนน********/ // *************************************************************************************** *****************************************


Line Hackathon27 ระบบ login เขาใช การประเมินมุงเนนผลปฏิบัติ/กิจเฉพาะ แสดงผลผาน line Hackathon27 Code


Code.gs function doGet() { return HtmlService.createTemplateFromFile('index').evaluate() .setTitle('PSN Login EIB Tactical Studies Section ') .addMetaTag('viewport', 'width=device-width, initial-scale=1') .setFaviconUrl('https://sv1.picz.in.th/images/2022/11/02/v5V9zI.png') .setXFrameOptionsMode(HtmlService.XFrameOptionsMode.ALLOWALL) } function include(fh){ return HtmlService.createHtmlOutputFromFile(fh).getContent() } /** เรียก URL */ function getURL() { var url = ScriptApp.getService().getUrl(); return url; } function getData(){ return ss = SpreadsheetApp.getActiveSpreadsheet().getSheetByName('link').getDataRange().getDisplayValues().slice(1) } function loginform(user,pass) { var ss = SpreadsheetApp.getActiveSpreadsheet().getSheetByName('login') var data = ss.getDataRange().getDisplayValues().slice(1) let rowID = data.find(r => {


return r[0] == user && r[1] == pass }) return rowID } index.html <html lang="en"> <head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <link href='https://unpkg.com/[email protected]/css/boxicons.min.css' rel='stylesheet'> <?!=include('css')?> </head> <body> <!-- /************** สวนแสดงสถานะ Loader..... *****************/ --> <div id="loading"></div> <div class="login-button-form"> <button onclick="document.getElementById('user-login').style.display = 'block' " id="login" type="submit" class="login-button">คลิ๊กเขาใชงาน</button> </div> <?!=include('formLogin')?> <?!=include('formList')?> </body> </html>


formLogin.html <div id="user-login" class="login-form"> <form id="myForm" class="login-container"> <div class="img-container"> <span class="close" onclick="document.getElementById('user-login').style.display = 'none' ">&times;</span> <img src="https://sv1.picz.in.th/images/2022/11/02/v5V9zI.png" alt=""> </div> <div class="container"> <label for="username">Username Email</label> <input type="text" placeholder="Enter Username" id="user" required> <label for="password">Password</label> <input type="password" placeholder="Enter Password" id="pass" required> <input type="submit" class="btn" value="ลงชื่อเขาใช" onclick="login()"> <div class="checkbox"> <input type="checkbox" > Remember me </div> <!-- <span class="password">Forgot <a href="#">password ?</a></span> --> </div> </form> </div> <script> function login(){ event.preventDefault()


document.querySelector('#loading').style.display="block" var pass = document.querySelector('#pass').value var user =document.querySelector('#user').value google.script.run.withSuccessHandler(function(output){ if(output !=null){ document.querySelector('#loading').style.display="none" document.querySelector('#user-list').style.display="block" document.querySelector('#user-login').style.display="none" document.querySelector('#myForm').reset() document.querySelector('#imgUSER').src= output[3] console.log(output[3]) }else{ document.querySelector('#loading').style.display="none" alert('รหัสผานไมถูกตอง') } }).loginform(user,pass) } function reLoad() { google.script.run.withSuccessHandler(function(url){ window.open(url,'_top'); }).getURL(); } var loader = document.querySelector('#loading') ; window.addEventListener("load",function(){ loader.style.display = "none" })


</script> formList.html <div id="user-list" class="login-form"> <form action="" class="login-container"> <div class="img-container"> <span class="close" onclick="document.getElementById('user-list').style.display = 'none' ">&times;</span> <img src="" id="imgUSER" alt="" height="150" width="150" style="box-shadow: rgba(6, 24, 44, 0.4) 0px 0px 0px 2px, rgba(6, 24, 44, 0.65) 0px 4px 6px -1px, rgba(255, 255, 255, 0.08) 0px 1px 0px inset;"> </div> <div class="container mt-1"> <center> <h3>URL>>>กิจเฉพาะ NCO27</h3></center> <div id="productbox" class="product"></div> <center> <h3>โดย ร.ท.พิษณุ ปนชาติ</h3></center> </div> </form> </div> <script src="https://code.jquery.com/jquery-3.6.0.js"></script> <script> google.script.run.withSuccessHandler(createTable).getData(); function createTable(menu) { var html = ''; for (let i = 0; i < menu.length; i++) { html += ` <ul class="ul-menu">


<li class="product-info"> <a href="${menu[i][2]}" taget="_blank"><i class='bx bx-brightness bx-sm'></i> ${menu[i][1]}</a> </li> </ul> ` } $("#productbox").html(html) } </script> <style> :root { --orange: #fff; } ul li { list-style: none; } ul li a { display: flex; text-decoration: none; padding: 10px 20px; border: 1px solid #000; color: #000; cursor: pointer; transition: .3s ease; border-radius:4px; margin:4px; background: #f6e1fa;


} ul li a:hover { background: #ff4367; color: var(--orange); } /* ul li:first-child a { /* border-top: 1px solid var(--orange); */ } */ .bc-menu-active { color: var(--orange) !important; font-weight: 700; } </style>


css.html <style> @import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Sans+Thai+Looped:wght@500&display=swap'); * { margin: 0; padding: 0; box-sizing: border-box; font-family: 'IBM Plex Sans Thai Looped', sans-serif; } body { background-image: url(''); background-size: cover; background-repeat: no-repeat; height: 100%; font-family: 'Kanit', Helvetica, Arial; padding: 50px 0; } body{ background: #333; width: 100%; min-height: 50%; } .header{


text-align: center; padding-top: 25px; margin-top: 20px; font-size: 36px; color: #ffffff; } .login-button-form{ display: flex; align-items: center; justify-content: center; min-height: 100vh; } .login-button-form .login-button{ font-size: 24px; padding: 14px 38px; color: #666; font-weight: 600; border-radius: 5px; cursor: pointer; outline: none; } .login-button-form .login-button:hover{ color: #ffffff; background: #ff4367; } .login-form{


Click to View FlipBook Version