• DİKKAT

    DOSYA İndirmek/Yüklemek için ÜCRETLİ ALTIN ÜYELİK Gereklidir!
    Altın Üyelik Hakkında Bilgi

VBS ile zaman aralığında kod çalışabilsin

mozdem

Altın Üye
Katılım
11 Kasım 2005
Mesajlar
454
Excel Vers. ve Dili
Windows 2011 TR
MS Office 365 TR - 64bit

VBA, Selenium ve VBS
Merhabalar,
------------------------------
On Error Resume Next
set calistir = createobject("wscript.shell")

Eğer Saat:10:00 ile 17:15 arası ise

wscript.sleep(500)
calistir.run "C:\Deneme.exe"

değilse son
-----------------
Yukarıdaki örnek .Vbs dosyası çalıştırıldığında Saat 10:00 ile 17:15 arası ise kodlar çalışsın. zaman dışında ise çalışmasın istiyorum.Bu mümlün mü?
Şimdiden yardımlarınız için teşekkür ederim.
 
Deneyin ,kendinize uyarlayın.

Kod:
Call saatci



Sub saatci()

If Hour(Now()) >= 8 OR hour(Now()) < 11 Then

Msgbox " Saat 8-11 arasinda firefoxu calistirin"
Call firefox()
Wscript.sleep(5000)

 Call saatci

Else

Msgbox " Saat 11'i gecmis"

Wscript.Quit

End If

End Sub

Sub firefox()

Set objShell = WScript.CreateObject("WScript.Shell")
objShell.Run("firefox")
Set objShell = Nothing

End Sub
 
Kod:
ilkSaat=timeserial(11,00,00)
sonSaat=timeserial(11,15,00)


if time>ilkSaat and time<sonSaat then
    set calistir = createobject("wscript.shell")
    wscript.sleep(500)  
    calistir.run ("C:\Deneme.exe")
    set calistir = nothing
else
    wscript.echo ("çalışmadı")
end if
 
Kod:
ilkSaat=timeserial(11,00,00)
sonSaat=timeserial(11,15,00)


if time>ilkSaat and time<sonSaat then
    set calistir = createobject("wscript.shell")
    wscript.sleep(500) 
    calistir.run ("C:\Deneme.exe")
    set calistir = nothing
else
    wscript.echo ("çalışmadı")
end if


Çok teşekkür ederim. Sorduğum sorunun tam cevabı.
Bir şey daha rica etsem. buraya günleride kriter olarak koymak istersem. Yani Cumartesi ve Pazar çalışmasın. Diğer günler çalışsın.
Mümkünmü.
Tekrardan cevabınız için çok çok teşekkür ederim.
 
Kod:
ilkSaat=timeserial(10,00,00)
sonSaat=timeserial(11,15,00)


if time>ilkSaat and time<sonSaat and weekday(date)>1 and weekday(date)<7 then
    set calistir = createobject("wscript.shell")
    wscript.sleep(500) 
    calistir.run ("C:\Deneme.exe")
    set calistir = nothing
else
    wscript.echo ("çalışmadı")
end if
 
Kod:
ilkSaat=timeserial(10,00,00)
sonSaat=timeserial(11,15,00)


if time>ilkSaat and time<sonSaat and weekday(date)>1 and weekday(date)<7 then
    set calistir = createobject("wscript.shell")
    wscript.sleep(500)
    calistir.run ("C:\Deneme.exe")
    set calistir = nothing
else
    wscript.echo ("çalışmadı")
end if

Çok teşekkür ederim. Ben bir şey öğrendiğimde çok mutlu oluyorum. Allah'ta sizi mutlu etsin.
 
Geri
Üst