我正在尝试制作一个简单的python脚本,可以使用键盘来编写/执行命令.
示例:打开Photoshop并在1秒后执行"全选并删除,然后保存"(控制+ a,删除,控制+ s)键.
示例2:打开taskmanager(control + alt + del)使用N键移动到进程中的N部分并每隔几分钟使用结束任务(alt + e)...
另外要创建一个函数,当python脚本运行时,如果我点击alt + f1(例如)它执行(control + alt + del)
我正在尝试使用discord.py编写一个简单的机器人,所以我开始使用有趣的命令,就像获取api的挂起
import discord
import asyncio
client = discord.Client()
@client.event
async def on_message(message):
# we do not want the bot to reply to itself
if message.author == client.user:
return
if message.content.startswith('!hug'):
await client.send_message(message.channel, "hugs {0.author.mention}".format(message))
# Greetings
if message.content.startswith('hello'):
msg = 'Hello {0.author.mention}'.format(message)
await client.send_message(message.channel, msg)
# say (id) is the best
# This is where I am lost. how to mention someone's name or id ?
if message.content.startswith('!best'):
mid = User.id('ZERO#6885').format(message)
await client.send_message(message.channel, '{mid} mentioned')
Run Code Online (Sandbox Code Playgroud) 我正试图在页面加载时隐藏视频,并在按下任何链接后显示视频
这是我目前的代码
var videoplayer = document.getElementById("videoplayerlayer");
var links = document.getElementsByTagName("a");
if(localStorage !== 'undefined')
{
console.log("localStorage exists")
if(localStorage["vv"] == false)
{
videoplayer.style.display = "none";
localStorage["vv"] = false;
}
else
{
for( i=0; i<links.length; i++ )
{
links[i].onclick = function()
{
localStorage["vv"] = true;
videoplayer.style.display = "block";
console.log(localStorage["vv"]);
}
}
}
}
else
{
localStorage["vv"] == false;
}
Run Code Online (Sandbox Code Playgroud)