VoxCommando

Поддержка русского языка => Поддержка русского языка => Topic started by: mr.niki on March 01, 2016, 01:56:46 AM

Title: Python
Post by: mr.niki on March 01, 2016, 01:56:46 AM
Для примеров команд на Python
Если есть кто использует коды Python в VC
Размешайте примеры
Title: Re: Python
Post by: mr.niki on March 02, 2016, 04:00:31 AM
Есть вопрос как добавить понимание Русского языка в код Python
что бы не получать в логе такие сообщения
à¥¢ë襭 ¨­â¥à¢ « ®¦¨¤ ­¨ï ¤«ï § ¯à®á .
à¥¢ë襭 ¨­â¥à¢ « ®¦¨¤ ­¨ï ¤«ï § ¯à®á .


сам нашел ответ в начале кода добавьте
import sys

sys.setdefaultencoding('cp866')

Title: Re: Python
Post by: jitterjames on March 02, 2016, 08:23:53 AM
Nice. +1

 :)
Title: Re: Python
Post by: mr.niki on March 03, 2016, 02:07:31 AM
подскажите как вывести в текстовом поле: не слово а значение переменной.

tmp = 7
vc.callAction("OSD.ShowText","tmp", None)


tell me how to get into the text field : not a word and the value of the variable .

tmp = 7
vc.callAction("OSD.ShowText","tmp", None)
Title: Re: Python
Post by: nime5ter on March 03, 2016, 08:01:49 AM
Here is the error message that your code would have received.
Code: [Select]
TypeError: expected str, got int
The parameter must be a string, not an integer.

So it must be:
Code: [Select]
tmp = 7
vc.callAction("OSD.ShowText",str(tmp), None)

or,

Code: [Select]
tmp = '7'
vc.callAction("OSD.ShowText",tmp, None)
Title: Re: Python
Post by: mr.niki on March 03, 2016, 08:47:11 AM
thanks It works
I did so
List[str]
Title: Re: Python
Post by: mr.niki on March 03, 2016, 10:43:12 AM
well as the output variable in the form :


from System.Collections.Generic import *
tmp = 'exempl'
vc.callAction("OSD.ShowText", List[str]"[tmp]&&5000&&-10", None)

or


from System.Collections.Generic import *
maptabel = "map1"
key = "key1"
value= 1982
vc.callAction("Map.Set",list[str]("[maptabel&&key&&value]"))

SystemError: MakeGenericType on non-generic type


Line: 5 >> vc.callAction("Map.Set",List[str]("[maptabel]&&[key]&&[value]"),None)
TypeError: Не удалось привести тип объекта "System.Char" к типу "System.String".


from System.Collections.Generic import *
maptabel = "map1"
key = "key1"
value= 1982
vc.callAction("Map.Set",str("maptabel&&key&&value"),None)
but it is wrong
Title: Re: Python
Post by: jitterjames on March 03, 2016, 01:27:52 PM
Mr Niki.

You need to learn the basics of programming and using Python first.  We cannot teach you this because:

a) We are not in the business of teaching basic computer programming for free.
b) We do not speak the same language as you.

You must first learn the basic things about programming like "what is a variable?" and "what is a string?".  You should find another place where you can learn these things in your own language.
Title: Re: Python
Post by: mr.niki on September 23, 2016, 01:27:07 PM
Добрый день есть вопрос.  Я помню что вы говорили что не учите pyton  но прошу  подсказать хотя бы  в каком направлении искать.
И так сам вопрос :
y = "Ответ от 8.8.8.8: число байт=32 время=6мс TTL=53"
x = "Ответ от : число байт= время= TTL="
if X in Y :
я не понимаю как сравнить эти 2 строки если данные в строке Y разные но есть база которая представлена в строке X ?
   


Title: Re: Python
Post by: jitterjames on September 23, 2016, 03:17:50 PM
https://wiki.python.org/moin/RussianPythonBooks
Title: Re: Python
Post by: Tarassk on April 05, 2017, 03:51:13 PM
Доброго всем дня. Уважаемые администраторы помогите пожалуйста разобраться с плагином Python. Я начал осваивать вашу замечательную программу VoxCommando совсем не давно, в программировании я пока профан, поэтому прошу у вас помощи. Какие команды вписать нужно чтобы VoxCommando смог считать, вычитать, умножать и делить. И нужно ли прописывать еще какой-то код для этой функции в самом плагине. Спасибо!

Kind all day. Dear administrators, please help me understand the Python plugin. I started to master your wonderful VoxCommando program not long ago, I'm still proficient in programming, so I ask for your help. What commands should be entered so that VoxCommando can count, subtract, multiply and divide. And whether it is necessary to prescribe some more code for this function in the plug-in itself. Thank you!
Title: Re: Python
Post by: jitterjames on April 05, 2017, 05:51:40 PM
General info about python in VoxCommando:  http://voxcommando.com/mediawiki/index.php?title=Python

Here is a forum post where I talk about doing basic math with python:
http://voxcommando.com/forum/index.php?topic=1005.0

A more complex example that uses math:
http://voxcommando.com/forum/index.php?topic=2165.0

Maybe this helps since some of it is in Russian, and maybe you can ask Mr. Niki for help in Russian.
http://voxcommando.com/forum/index.php?topic=2459.0
Title: Re: Python
Post by: mr.niki on April 24, 2017, 03:14:14 AM
простая команда на сложение будет выглядеть так
в дереве выбора команд выберете  действие плагина питон следующие :
PY.ExecString
эта команда выполняет 1 действие плагина питон
дальше  вписываем  что нам надо выполнить
у нас  будет сложение
пример команды такой :result = {1}+{2}
в этой команде {1} и {2}  это числа из пэйлауда которые вы должны прикрепить к команде
ну  и далее если вам надо обработать результат  вокс его будет видеть как {LastResult}
к примеру
TTS.Speak   {LastResult}
вокс озвучит получившийся результат в вашем примере

более сложный пример  result = {1}{2}{3}
эта команда простой калькулятор на питоне 
если что то непонятно  то можете спрашивать тут https://vk.com/ognechannel
я там чаше бываю