我编写了vbscript代码来监控系统的开始和结束时间,但它没有在同一天登录'这意味着没有打开并写入相同的日期文件如何解决这个问题
Dim objFS, objFile
Dim crdate,ckdate,fname
Set objFS = CreateObject("Scripting.FileSystemObject")
do
crdate = Day(now) & "-" & Month(now) & "-" & Year(now)
fname = crdate & ".txt"
if (objFS.FileExists(fname)) Then
do
ckdate = Day(now) & "-" & Month(now) & "-" & Year(now)
objFile.WriteLine(Time & "\n")
wscript.sleep 300000
loop until ckdate <> crdate
else
Set objFile = objFS.CreateTextFile(fname)
end if
loop
答案 0 :(得分:0)
我在google中找到了关闭该文件的答案 objFile.Close
Dim objFS, objFile
Dim crdate,ckdate,fname
Set objFS = CreateObject("Scripting.FileSystemObject")
do
crdate = Day(now) & "-" & Month(now) & "-" & Year(now)
fname = crdate & ".txt"
if (objFS.FileExists(fname)) Then
Set objFile = objFS.OpenTextFile(fname, 8, True)
objFile.WriteLine("-------------------------------")
do
ckdate = Day(now) & "-" & Month(now) & "-" & Year(now)
objFile.WriteLine(Time)
wscript.sleep 300000
loop until ckdate <> crdate
objFile.Close
else
Set objFile = objFS.CreateTextFile(fname)
objFile.Close
end if
loop
答案 1 :(得分:0)
Windows本机地执行此操作...您不必重新发明轮子。您可以在本地或远程使用Windows事件来更精确地拉动它。
public function searchActivity(Request $request){
$validator = Validator::make($request->all(), [
'search' => 'required',
'date' => 'required_with:search|required|date|date_format:d-m-y|after:yesterday'
]);
if ($validator->fails()){
return response()->json([
'sucess' => false,
'errors' => $validator->errors()->toArray(),
'data' => $request->all()
]);
}else{
$queries = DB::table('activities')->where('name', $request->search)->orWhere('City', $request->search)->paginate(1);
return redirect()->route('ActivitiesResults', ['results' => $queries]);
}