Google App Scriptでスプレッドシートから登録しているワードを自動で一定時間おきに呟くbotで、セリフ登録順の投稿にしたい。 | SolveForum | S2

Google App Scriptでスプレッドシートから登録しているワードを自動で一定時間おきに呟くbotで、セリフ登録順の投稿にしたい。

望郷のガタラッド

Google Apps Scriptでスプレッドシートから内容を読み込んでSNSへ投稿するbotを作成しているのですが、既存のコードだとランダムに投稿されてしまう仕様になっており、これをシートの上から読んでセルの順番に投稿する仕様にしたいです。

var suuji = Math.floor(Math.random()*(rows-1));

↑ここの部分の=の後ろをMath関数ではないものに書き換えれば上から順に読んで実行してくれる仕様に変わるのですが、コードが思いつきません。

コードは、トリガーで1時間に1回、指定した関数を自動で実行するように設定しています。

何かいい案は無さそうでしょうか。

//suujiの値は0から一番下にあるセルの行番号の数値-1
//ここでは一行目の投稿内容のセルを参照したくないので+2している
var postMessageCell = sheet.getRange(suuji+2, 1).getValue();

↑参考までに上記で読んだセルを投稿する関数へ代入しているコードです
 

Unreplied Threads

What is this "/|\" symbol on the enclosures of various appliances?

  • Wossname
  • Physics
  • Replies: 0
I keep seeing this symbol on old electronics appliances of varying types.

enter image description here

Two examples that I own...

Early 1960's portable "Megger" insulation tester enter image description here

July 1969 Marconi attenuator enter image description here

I have also seen this on other equipment manufactured as late as the 1980's, such as an HP 3314A signal generator.

So, it appears that this is a standard symbol, and not a proprietary one.

What does it mean?

Regulate voltage from 24V to 3V for radio receiver module

  • Pavlo
  • Physics
  • Replies: 0
I'm going to make my own quadcopter. I plan to use 6s Lipo battery (24V). Radio receiver module accepts 5V input power source. Seems like voltage regulator will be overheated cause of big voltage difference. At the same time buck converter may produce noise that will interfere with the radio receiver

RC circuit not working as intended

  • Vishal
  • Physics
  • Replies: 0
I am trying to plot the waveforms is following RC circuit and I am not getting the intended results : The First Voltage controlled switch(S2) is on for 4 seconds , thus charging the cap for that time and then it turns-off, immediately after that S1 gets on and I expect the Capacitor to gets Discharge through Resistor, but when I see the waveforms , they are not as I thought they would be.. Please help me understand where I am going wrong.. Thanks!!

enter image description here

enter image description here

Thyristor controlled 3-phase heater control, spiky current

  • Wacky
  • Physics
  • Replies: 0
Lets say you have 10 thyristor controlled heaters in a 3-phase system. The control of these thyristors is sync'd, so the current draw is spiky (all of the heaters draw current from the same phase when its voltage is high). The heaters are connected to a triangle/star configuration.

50Hz system, the cycle is 20ms, if you were to delay all(but one) 10 heater controls by 2ms apart from each other, would the current draw smooth out from a spiky system to more sine-wave type?

Since the power needs to be delivered from somewhere, the phases would be at a differend angle and would distribute the loads on differend phases more equally. since I=U/R

Currently the current draw looks like a camel back in half wave

-Wacky- enter image description here

Para que serve e como definir a prop "key" no React?

  • Rafael Tavares
  • Technology
  • Replies: 0
Ao renderizar uma lista dinâmica no React ou React Native, recebo o seguinte aviso:

Warning: Each child in a list should have a unique "key" prop.

Apesar disso, as coisas parecem funcionar bem sem a prop key. Veja este exemplo:


Code:
function shuffleArray(array) {
  var currentIndex = array.length,
    randomIndex;

  // While there remain elements to shuffle...
  while (0 !== currentIndex) {
    // Pick a remaining element...
    randomIndex = Math.floor(Math.random() * currentIndex);
    currentIndex--;

    // And swap it with the current element.
    [array[currentIndex], array[randomIndex]] = [
      array[randomIndex],
      array[currentIndex]
    ];
  }

  return array;
}

function App() {
  const [pokemons, setPokemons] = React.useState([
    {
      name: "Bulbasaur",
      img: "https://assets.pokemon.com/assets/cms2/img/pokedex/detail/001.png"
    },
    {
      name: "Ivysaur",
      img: "https://assets.pokemon.com/assets/cms2/img/pokedex/detail/002.png"
    },
    {
      name: "Venusaur",
      img: "https://assets.pokemon.com/assets/cms2/img/pokedex/detail/003.png"
    },
    {
      name: "Charmander",
      img: "https://assets.pokemon.com/assets/cms2/img/pokedex/detail/004.png"
    },
    {
      name: "Charmeleon",
      img: "https://assets.pokemon.com/assets/cms2/img/pokedex/detail/005.png"
    },
    {
      name: "Charizard",
      img: "https://assets.pokemon.com/assets/cms2/img/pokedex/detail/006.png"
    },
    {
      name: "Squirtle",
      img: "https://assets.pokemon.com/assets/cms2/img/pokedex/detail/007.png"
    },
    {
      name: "Wartortle",
      img: "https://assets.pokemon.com/assets/cms2/img/pokedex/detail/008.png"
    },
    {
      name: "Blastoise",
      img: "https://assets.pokemon.com/assets/cms2/img/pokedex/detail/009.png"
    }
  ]);

  function shuffle() {
    setPokemons(shuffleArray([...pokemons]));
  }

  return (
    <ul>
      <button onClick={shuffle}>Embaralhar</button>
      {pokemons.map((pokemon) => (
        <li onClick={() => console.log(pokemon.name)}>
          <img src={pokemon.img} alt={pokemon.name} />
          <span>{pokemon.name}</span>
        </li>
      ))}
    </ul>
  );
}

ReactDOM.render(<App /> , document.querySelector("#app"));

Code:
ul {
  padding-right: 2rem;
  padding-left: 2rem;
}

li {
  list-style: none;
  display: flex;
  align-items: center;
  padding: 10px;
  border: 2px solid #ccc;
}

li:hover {
  background-color: #deebff;
  cursor: pointer;
}

img {
  height: 40px;
  width: 40px;
}

span {
  font-size: 20px;
}

Code:
<script crossorigin src="https://unpkg.com/react@17/umd/react.production.min.js"></script>
<script crossorigin src="https://unpkg.com/react-dom@17/umd/react-dom.production.min.js"></script>
<div id="app"></div>

Para resolver esse aviso, já encontrei várias respostas aqui utilizando o índice como key, então tenho as seguintes dúvidas:


  • Para que serve essa propriedade key?


  • Eu preciso definir uma key somente ao percorrer um array?


  • Como posso definir uma chave? Posso utilizar o índice, um número aleatório ou tem outro jeito melhor?

Переадресация если браузер не поддерживается

  • Алексей
  • Technology
  • Replies: 0
Как сделать переадресацию на другую страницу, если человек заходит со старого браузера на сайт?

На html или js

Извлечь с Excel ячейки только то что в скобках

  • Валерий
  • Technology
  • Replies: 0
Всем привет! Подскажите пожалуйста кто знает функцию в excel, чтобы с ячейки оставить данные только те что в скобках, когда в ячейке, могут быть их несколько. Спасибо
Top