我必须制作一个vbscript程序,它的sendkey是一个随机的6位数字的Nomber,有什么想法吗?
我尝试过
def event(request):
all_events = Events.objects.all()
if request.method == 'POST':
event_form = ModelEventsForm(request.POST)
start = (event_form['start_date'].value())#get datetime string from request
end = (event_form['end_date'].value())
#transform string to python datetime
if 'T' in start and end:
start = datetime.strptime(start, "%Y-%m-%dT%H:%M:%S")
end = datetime.strptime(end, "%Y-%m-%dT%H:%M:%S")
else:
start = datetime.strptime(start, "%Y-%m-%d")
end = datetime.strptime(end, "%Y-%m-%d")
update_request = request.POST.copy()
update_request.update({'start_date': start, "end_date": end})
event_form = ModelEventsForm(update_request)
if event_form.is_valid():
update = event_form.save(commit=False)
update.owner = request.user.profile
update.start_date = event_form.cleaned_data['start_date']
update.end_date = event_form.cleaned_data['end_date']
update.save()
return redirect('events:event')
else:
event_form = ModelEventsForm()
context = {
"events": all_events,
'event_form': event_form
}
return render(request, 'profile/event_management.html', context)
答案 0 :(得分:0)
使用该内容创建文件(例如test.vbs
)并运行它:
Randomize
WScript.CreateObject("WScript.Shell").SendKeys Int((999999 - 100000 + 1) * Rnd + 100000)
信息:
Randomize
必须在Rnd
之前调用以获得随机结果。