Spusteni aplikaci pro startu Windows StartUp.vbs 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 ' 0 Hide the window (and activate another window.) ' 1 Activate and display the window. (restore size and position) Specify this flag when displaying a window for the first time. ' 2 Activate & minimize. ' 3 Activate & maximize. ' 4 Restore. The active window remains active. ' 5 Activate & Restore. ' 6 Minimize & activate the next top-level window in the Z order. ' 7 Minimize. The active window remains active. ' 8 Display the window in its current state. The active window remains active. ' 9 Restore & Activate. Specify this flag when restoring a minimized window. '10 Sets the show-state based on the state of the program that started the application. Function readFromRegistry (strRegistryKey, strDefault) Dim WSHShell, value On Error Resume Next Set WSHShell = CreateObject ("WScript.Shell") value = WSHShell.RegRead (strRegistryKey) If err.number <> 0 Then readFromRegistry= strDefault else readFromRegistry=value end if set WSHShell = nothing End function Function OpenWithChrome(strURL, Optional boolNewWindow) Dim strChrome Dim WShellChrome '--- strChrome = readFromRegistry ( "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\chrome.exe\Path", "") If (strChrome = "") Then strChrome = "chrome.exe" Else strChrome = strChrome & "\chrome.exe" End If strChrome = """" & strChrome & """" '--- If boolNewWindow = True Then strChrome = strChrome & " --new-window " End If '--- Set WShellChrome = CreateObject("WScript.Shell") strChrome = strChrome & " """ & strURL & """" '--- WShellChrome.Run strChrome, 3, False End Function Function OpenWithIE(strURL) Dim strIE Dim WShellIE strIE = readFromRegistry ( "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\iexplore.exe\Path", "" ) If (strIE = "") Then strIE = "iexplore.exe" Else strIE = strIE & "\iexplore.exe" End If Set WShellIE = CreateObject("WScript.Shell") strIE = """" & strIE & """" & " " & strURL WShellIE.Run strIE, 3, False End Function Function RunAnyProgram(strProgram) Dim WShellAnyProg Set WShellAnyProg = CreateObject("WScript.Shell") strProgram = """" & strProgram & """" WShellAnyProg.Run strProgram, 1, False End Function Function RunProgramsAfterStartPC(strSiteName) Dim adSys Set adSys = CreateObject("ADSystemInfo") If adSys.SiteName = strSiteName Then '---------------------------------------------------------------------- '--- Run program's '---------------------------------------------------------------------- ' -- Email client RunAnyProgram "C:\....exe" 'RunAnyProgram "%windir%\system32\calc.exe" Else MsgBox "Script has been not started" End If End Function RunProgramsAfterStartPC "XXX"