1 (2018-01-31 13:21:26 отредактировано Site_Bot)

Тема: Как воспроизвести звуковой сигнал в imacros

Используя возможность JS проигрывать звук, закодированный в base 64, мы можем применить это для воспроизведения аудио-файлов в imacros.

Для начала создадим звуковой js-скрипт

audio64.js

{
var snd = new window.Audio("data:audio/ogg;base64,сюда_вставляем_закодированный_звук");
}
snd.play();// воспроизводим звук там, где это нам необходимо

Вот практический пример audio64.js:

{
var snd = new window.Audio("data:audio/ogg;base64,//tSxAAAAAABpBQAAAJMyBxDKTAB8MhAFCPJkDYm/BMsBphG8DiMG1/wxmA0gA1P+ApMD0gInAK//4GFIG9oFhgBzAcD/8MKCbxRg2wNvDL//+IBhc2JYGMAGFhxAYw///DYxmCLiCgZEE4CiB6Ysf///gZQg2PkuGMx0DsDE5PEEEFxZf////5XMDyZDyJC4C+KTFLhxgWDCx8rjkf/////////////gAsOjBoww4OPqAcI8rKEBuLnFpAoKSKfQ0RRMlfmoNhGJr/NljR4843/+1LEFAAOjkEOGHOACZlIKTck0AE59E+cdHjR4ldDt3P9jyhphk12JTprM2Znoce2jnaHdnNNY3ttZL3bQ1zzlsjDBz56GUmZoqEsxXuiuO5w1GoJiW//////////////4Q4HY6HI7HQ7HA8AAAGsvhcsDDLubgD4BsWcNAuoR3UABwBudDIITg9fQdSCY4GT+63aXC4aJp/pppvTUXOj/rT+Ocdhpr/6H03tsuzJ//Wm//HYXF//////////////////////+AAAAAAQoZLpB//7UsQEgAuGQWm40oAJUaKo67agAS39gAAC4FSOgd0wdIPsZKyOslTptNWYB0PKOHKQpimJlZ5UzHOUqkHd/UT+/xYvoY/pJ87eZrDUoa91/tb6t/0/9P//////////////////////wAAAAyBQAlUy6RS0VBziQ4DDTfb7exgx431oZbVcqSmlQuQuACo1l3R++0id5McTOd/1OFkL5C3/+bNUlGppv//UkR7yYkNzh+NTf/5U4mC6BvQmcIAAIIUAIazkrVSBNKdOUKXwxK69//tSxAoACukTOu3Nq4lcImYNzDVxLPB+wF1lMcBgieWs2OmJDAu4tpH3dX9RkVlGRsjo//EaJWj/qZpgkpJIzNijNEUkn//Wo2qUXTLrmv/+cNlDwCgJFMDAAABfyigEBhgAUGFq6b8MBhgAw87d67EiEpzAvdE9ibtuJEYbn4tcbmoFL87N7//9c3//hI//6v/2C2nO/6j5+iggpA8aiYprU///////+TiGAYJLkIAACAABEEviVAoZAOJj5mgvQFAle6VYz0eC1IFlAbOBh0D/+1LEEIAKnQ8wblGriV2iJMHdNXAqBZIMXi4US0mWgLKDRBl/WImVOl//9IaDf/1OiokhghzCel1IQccheO///////+mIYJ2uzZwQQEZqSXRgkUh3MO4GChCNJaGKGyqoA0K7z3Y0uZ+ZpYel2U2QDiUO/FJFrXP/9xFaEX59Xn///+w40P/+61l0vA0hfVHn///////5NJUaCF/////6gEISy44CpvsEphNBxvMUI4AQFAdJGWugskLlQoCpBHUjxQdWKkFzl7dkvMHOdPXu0//7UsQYAAqVDyIO7auBTyIkgc2pcHf/8Lpdac7/yb////UNi///WnWDhIDv///////6KAT1/////1GCw4YQFphcqHfXeYB+BzdJmvJwayBZhsIAkDLLXaCgIMgwSBnHDTzdzs1+bqKNgYSp852z///1kX7H/qz////x8d//68MS3///////88Wv/////WAwkAtFQlDE0ySwwzWQTTozNfw1eCYIDsvOFAUUcFSYGxA0gfmui8oBJ8nuv41kOo84k36sc7/7vJUTvNYY9///9RFN//tSxCGACqURIA7o64GPluVJzJkx///wNJt///////+aRX/////1Au6BepKcRgoKp8wODTo4CMupsFYFb0ZJQGVFQFmrPQJA8bYZFbgTvK9MtXDkkzsZ17VJXhoh9/j97YEGOTJpxEk6IGR4w++9t8e2h9f9/kRGHhE/8cWIthhg+Q/20lwASZ/0iIAESSSAQXD9EOkITRJcw93ATUciKcBNNYMggJIKIPcGG24X8ud+ZCCZ8gY856PZPsVDw8cQyeobO7YkRN6wyvjXtHk4udf/+1LEIwANPP1E7KWLgZyfaAGntXHbf23TOUv9KmcYJo1jmr36OTLDkwv/K9fP45MzM8/X7r3yHEqDKCJI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ICKcyMkkk1lv9frVS///WitvJFEx/iI5+74v////3KjXqYoH4AapuXFqRhMByabGfHyVYKNZ4GlnCZmYgCrU8IpANqziK6m0zsV84Vh++65jj25TAF0Kb9M2//Uv///1Vr1sbP8gvZ/////p9oxju+IkJbCFiJKBUUNLFTE5cbhRYXZ4BAaBWXjgZRl/TEgRv8MBxCABSBMB9Ifn5qljEsnYbr3/5QU09I+4YYb//tSxJoACvS3Ik5hSYFNl2NBzLUw8sjf/X9X/9v56s3856IAMHHid/////+v/Y3YDYARCzF3UT9CwaDio3M1O2FGrvMwwOCW8XPPPoSrp2pU8SKDN2ctNor8th3tWHaW5f/9Rl4alNa7jj6O///+h39P+3+h1DqoSHQcCYZUM///////qrWgwIAOE2jAkBgaBphGBJh7A5lEJ6MjJS1S3BoBq0WkOsAhSgcMFQDQGAkJRcROihiRUXe2laXkkfSeP/////p7163/81BIDhQMMf3/+1LEooAJqLsYLempgV+bY4G9CXA9////6uhGifW+CIAuNafgSDkEBGMBqYoS+ZuiKWwVIYDga6LTBCATsB84IiKByA2gMCIQHJhMfRVUWn/6BD0P1Jf//////t//3ANC5Nf+j//////////+/7ldSrpX8QAw1AocTxEETGAANyEE/GPAMRC5hKLyoAY6DQG/BmE/QGraiEQKAiImxxM4yk3/qLqbf/+////v/9f/7AcNWzv1/+nTbp6//t//+n7bap6am8owSuf5wTBAFi7phv/7UsStgAqY3SAN7OuBVZtjAdqVcMExgRZxrOJwOFVQ4wCBdYNvzBAApCOAAVcBsVAqAnJdaBkbv9utX9X/qb+3///++5P+BAuXpbo/9fTX71//t++/126zMnVuQsIUojcaAaKmAoJyowoDIx504zeBYwBA0CgKYCAMps84sAytBeCSAEyIpo9LdFNyt/ppoI22ff/7f//0emvX6zu9uYGf63/7Vrb9e9/6+7/VP+1PZG/1VNZ+TI88rQhkEFojAwLNgrw8cLggPqNjgiL7PGFA//tSxLYAClmNFg7U7clLs+KByh25rDZFBGwCssRqRZGZJMpP0Fy6Rcjyu7VMhSQ//b///1n+jf7/Dev/6f+f77//7/y/6t7IyZOppwhCAh6ZgTwAAD4JHpGEgDVnMni8wjZTTwvAwYYKOwb9VgqCRTA7Ew2k0Jv1KOdl0trXP/VvmVPCWmghAgDo0JmSn+7dGf+v19VOPNdtHJH87p+n////z293QRFT/Nh4nzpwwJDIrKBkZKw5kxagoTx8vmprFRIHtmLYFBICnEd4s0rJXs3/+1LEwQAK2Z8SDtBNyVQzogHaHbm9V2ZQQARUaCT5w3/o/Mkqm//0qmzUQrPb83ubs9U/pT//6f//+n/bJ1oY7fBH0PxK11YyXt0wohMSBzUlk1eICIZnZbVszZTAAVajluAwMCIgLscc7fTNOOECLPTQ5//6f////N9P+nne6fv93///t2///9TfVTU/OXOO1dSgtdAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP/7UsTJAAr1oRIOUE3JXBciycwpMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA//tSxM+ACv2HEg5QTcE+s+ICtqABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA");
}
snd.play();// воспроизводим звук там, где это нам необходимо

Для кодирования звуковых файлов в base 64 можно использовать данный сервис

PS: Так как звуковой скрипт имеет довольно большой размер, то лучше его использовать отдельно, вызывая из основного скрипта (как запустить один скрипт из другого: https://forum.mozilla-russia.org/viewtopic.php?id=66458 )

Поделиться

2 (2018-02-02 00:09:56 отредактировано Site_Bot)

Re: Как воспроизвести звуковой сигнал в imacros

Пример вызова функции проигрывания звука из js-файла:

В папке Macros  создаем папку lib и помещаем в нее звуковой файл audio64.js.


Основной файл test.js:

function playAudio(){
    iimPlayCode("URL GOTO=imacros://run/?m=lib/audio64.js");
}

// .....здесь какой-то код.....

playAudio(); // проиграть звук

Поделиться

3 (2018-07-11 20:04:08 отредактировано Site_Bot)

Re: Как воспроизвести звуковой сигнал в imacros

Более простое решение можно реализовать, если нам нужно проиграть в коде imacros простейший звук, опять же используя js

sound = imns.Cc['@mozilla.org/sound;1'].createInstance(imns.Ci.nsISound);
        
        sound.beep();

    iimDisplay("♪ sound");

то же самое из wiki.imacros.net

var sound = Components.classes["@mozilla.org/sound;1"].createInstance(Components.interfaces.nsISound);
sound.beep();

Поделиться