видимо проблема сейчас после if в двигать мышь и кликнуть на элемент
var data = {fail:false,wait:true};data["scroll"] = "no scroll" == "scroll";data["threshold"] = parseInt(80);data["timeout"] = 5000;data["data"] = "iVBORw0KGgoAAAANSUhEUgAAAMEAAAAeBAMAAABnBGdVAAAALVBMVEUAWv/V5P////+cv/9Chf+Qt/+81P/k7v+Crv/y9/+nxv/5+/9dlv/F2f9zpf8aFseGAAABB0lEQVR4Ae2SsUoDQRCG58ixbHHFXhCsHcHG5kilaJFG5j1EMIepwqFgtYWNbGWEEGGtfQBBzm4LC/MkvoazupWphEkT9msGrvi/m38HMpnMfxg2a5/O0qxVJyDQT2sp5bWoQd32GzbQdAHl7NAqPABCr5+xJ+Rgh3tChhN7OaZO+SvrThfQfr6H9oN3qB5h1MgYanDNvf1pZtABTV6BLn5bWskY+F/JHIc4QSHiZAnFTjSUM5QxxFSfDAXn6WSo5kZoBzKg31JLyrMhtTTw3J6IIYbffBm9bANNH8Ad8UuHmg19NZcx7I75nO7Sta5wn6/Vw4iXOccXI3NLf+B32DDbYMhktphvXodGRgltnEgAAAAASUVORK5CYII=";_wait_image(data)!
_if(typeof _Idle != "undefined", function(){
_Idle.emulate({useGeneral: true, target: _image()})!
})!
_if_else(typeof _Idle != "undefined" && _Idle.additionalEmulationEnabled(), function(){
_Idle.moveAndClickOn(_image(),{holdCtrl: false, clickType: "left", wait: false, moveSettings: {} })!
}, function(){
_image().random_point()!
_if(_result().length > 0, function(){
move( {} )!
_image().clarify(X,Y)!
_call(_clarify, {} )!
mouse(X,Y)!
})!
})!
Google Sheets API v4 | NodeJs | Не могу запустить код в БАС
-
Re: Google Sheets API v4 | NodeJs | Как запустить в БАС ?
Доброго дня, у меня такая же проблема как у этого пользователя, скрипт ничего не выводит, к сожалению https://community.bablosoft.com/post/30034 не помог, подскажите что я не так делаю?
Код:await (new Promise((resolve, reject) => {
/Place your code here and call resolve to proceed/const fs = require('fs').promises;
const path = require('path');
const process = require('process');
const {authenticate} = require('@google-cloud/local-auth');
const {google} = require('googleapis');// If modifying these scopes, delete token.json.
const SCOPES = ['https://www.googleapis.com/auth/spreadsheets.readonly'];
// The file token.json stores the user's access and refresh tokens, and is
// created automatically when the authorization flow completes for the first
// time.
const TOKEN_PATH = path.join(process.cwd(), 'token.json');
const CREDENTIALS_PATH = path.join(process.cwd(), 'credentials.json');/**
- Reads previously authorized credentials from the save file.
- @return {Promise<OAuth2Client|null>}
*/
async function loadSavedCredentialsIfExist() {
try {
const content = await fs.readFile(TOKEN_PATH);
const credentials = JSON.parse(content);
return google.auth.fromJSON(credentials);
} catch (err) {
return null;
}
}
/**
- Serializes credentials to a file comptible with GoogleAUth.fromJSON.
- @param {OAuth2Client} client
- @return {Promise<void>}
*/
async function saveCredentials(client) {
const content = await fs.readFile(CREDENTIALS_PATH);
const keys = JSON.parse(content);
const key = keys.installed || keys.web;
const payload = JSON.stringify({
type: 'authorized_user',
client_id: key.client_id,
client_secret: key.client_secret,
refresh_token: client.credentials.refresh_token,
});
await fs.writeFile(TOKEN_PATH, payload);
}
/**
- Load or request or authorization to call APIs.
*/
async function authorize() {
let client = await loadSavedCredentialsIfExist();
if (client) {
return client;
}
client = await authenticate({
scopes: SCOPES,
keyfilePath: CREDENTIALS_PATH,
});
if (client.credentials) {
await saveCredentials(client);
}
return client;
}/**
- Prints the names and majors of students in a sample spreadsheet:
- @see https://docs.google.com/spreadsheets/d/1BxiMVs0XRA5nFMdKvBdBZjgmUUqptlbs74OgvE2upms/edit
- @param {google.auth.OAuth2} auth The authenticated Google OAuth client.
*/
async function listMajors(auth) {
const sheets = google.sheets({version: 'v4', auth});
const res = await sheets.spreadsheets.values.get({
spreadsheetId: '1BxiMVs0XRA5nFMdKvBdBZjgmUUqptlbs74OgvE2upms',
range: 'Class Data!A2:E',
});
const rows = res.data.values;
if (!rows || rows.length === 0) {
console.log('No data found.');
return;
}
console.log('Name, Major:');
rows.forEach((row) => {
// Print columns A and E, which correspond to indices 0 and 4.
console.log(${row[0]}, ${row[4]});
});
}
authorize().then(listMajors).catch(console.error);
resolve()
})); -
с гугл таблицами наприер я работаю норм через get запросы отправляемые басом. промежуточный код для связи гугл таблицы и баса это код написаный в https://script.google.com/ .
такой принцип:
BAS (get запрос) -> https://script.google.com -> ваша гугл таблица она определяется кстати по id