+ Post New Thread
Page 2 of 2 FirstFirst 12
Results 16 to 20 of 20
Scripts Thread, message of the day bat in Coding and Web Development; If you use ScITE to write the script you can check it in there, and compile it......
  1. #16

    mattx's Avatar
    Join Date
    Jan 2007
    Posts
    9,240
    Thank Post
    1,058
    Thanked 1,068 Times in 625 Posts
    Rep Power
    740

    Re: message of the day bat

    If you use ScITE to write the script you can check it in there, and compile it...

  2. #17
    alonebfg's Avatar
    Join Date
    Aug 2006
    Location
    south west some of the time
    Posts
    834
    Thank Post
    12
    Thanked 34 Times in 21 Posts
    Blog Entries
    5
    Rep Power
    24

    Re: message of the day bat

    The Problem i have is that most of them will display the message evertime you log in the one i have just done creates a file to compare dates and so will only disply it once a day

  3. #18
    alonebfg's Avatar
    Join Date
    Aug 2006
    Location
    south west some of the time
    Posts
    834
    Thank Post
    12
    Thanked 34 Times in 21 Posts
    Blog Entries
    5
    Rep Power
    24

    Re: message of the day bat

    Code:
    #include <Date.au3>
    #include <File.au3>
    
    $motd =  _DateTimeFormat(_NowCalc(),1)& @CRLF &  FileReadLine("\\server\mod.txt",1) & @CRLF & FileReadLine("\\server\mod.txt",2) & @CRLF & FileReadLine("\\server\mod.txt",3)  & @CRLF & "From Network Admin"
    ;for future use have not tested if i can save to here
    $file = @AppDataDir&"\logind.txt"
    ;$file = "c:\logind.txt"
    $t = FileGetTime($file)	
    $date = _DateDiff ( 'h',$t[0] & "/" & $t[1] & "/" & $t[2] & " " & $t[3] & ":" & $t[4] & ":" & $t[5],_NowCalc())
    ; checks to see age of file and finds diffreace if mor than 9 hours old send mesage else ends
    If 	$date > 10 Then
    	MsgBox(0,"Message Of The Day",$motd)
    	_FileWriteToLine($file, 1, _DateTimeFormat(_NowCalc(),0), 1)
    EndIf
    ;this section checks to see if a notepad is in the file
    Func OnAutoItStart ()
    ; will be using a text file in a share for motd but have not got it sorted yet
    	$motd =  _DateTimeFormat(_NowCalc(),1)& @CRLF & FileReadLine("\\server\mod.txt",1) & @CRLF & FileReadLine("\\server\mod.txt",2) & @CRLF & FileReadLine("\\server\mod.txt",3) & @CRLF & "From Network Admin"
    ;$file = "c:\logind.txt"
    	$file = @AppDataDir&"\logind.txt"
    	if FileExists($file) Then 
    	return 
    	ElseIf _FileCreate($file) Then
    	return MsgBox(0,"Message Of The Day",$motd)
    	EndIf
    EndFunc
    ok i have done it and it works really well it only sends a message once a day it does the by dropping a file in the apps folder and comparing mod dates when user logs in and if it is older than 10 hours it edits it to create a new mod date. am going to look at doing this in vbs now. it take the mod from a txt file on a share on the server. and if i have no massage i just put welcome to school on the txt file as they only recive it once no harm done.

  4. #19

    Join Date
    Mar 2007
    Posts
    323
    Thank Post
    6
    Thanked 7 Times in 6 Posts
    Rep Power
    17

    Re: message of the day bat

    Hey mattx I love that idea of the floating type tool bar.

    Urm if it helps I also created like a delprof as the MS version didnt delete all of the users profiles.

    PHP Code:
    $paths "C:\Documents and Settings"
    $search FileFindFirstFile($paths &"\*.*")  

    If 
    $search = -1 Then
        MsgBox
    (0"Error""No files/directories matched the search pattern")
        Exit
    EndIf

    While 
    1
        $file 
    FileFindNextFile($search
        If @
    error Then ExitLoop
            
    If $file <> "Administrator" AND _
           $file 
    <> "All Users" And _
           $file 
    <> "Default User" THEN
            
    If StringInStr(FileGetAttrib($file), "D"Then
                DirRemove
    ($file1)
        EndIf
    Endif
    WEnd

    FileClose
    ($search
    Urm hope that helps might save trying to put things in 1 folder first.

    Yeh I suggested if we cant manage the workstations from the server logon scripts then I add schedualled tasks such as defrag + cleanup once a week to keep them running at a better rate rather then doing it once a year. That wasnt liked either - "you cant just automate everything". I think its a basic task and why the hell not?

    They said that it means we cant check the physical state.. well that maybe the case but I will still go around cleaning them with a duster anyway a few times a year, just means its 1 less thing to have to perform whilst cleaning the machines. Umm arg

    Lmao

    Neways - you guys and girls rule


    Cheers

  5. #20

    mattx's Avatar
    Join Date
    Jan 2007
    Posts
    9,240
    Thank Post
    1,058
    Thanked 1,068 Times in 625 Posts
    Rep Power
    740

    Re: message of the day bat

    Hey mattx I love that idea of the floating type tool bar.
    Its handy I have to say, there are some more tools I'll add over the easter hols if I get time. [ Plus I really need to remove the not so needed gx which goes down the side. Thats really OTT - I only used that as a temp solution but never got round to changing it !! ]
    Thanks for your pointer on the profs, may have to incorperate that in the next version...
    Code of the admin bar is as follows if you want to mess with it....

    ; AutoIt Version: 3.10
    ; Language: English
    ; Platform: WinXP
    ; Author: Matt Marsh
    ; Script Function: Launches GUI For Admin Controls
    ; Version: 1 BETA

    #include <GUIConstants.au3>

    GUICreate(" Admin Bar ", 150, 700, 20, 20)
    GUICtrlCreatePic(@ScriptDir & "\mattsadminbar3.jpg", 60, 10, 66, 659)
    GUICtrlSetState(-1, $GUI_DISABLE)
    GUISetBkColor(0x0066FF)
    $n1 = GUICtrlCreateIcon(@ScriptDir & "\rdp.ico", -1, 10, 20, 20)
    GUICtrlCreateLabel("RDP", 10, 60)
    GUICtrlSetTip(-1, "Remote Access")
    $n2 = GUICtrlCreateIcon(@ScriptDir & "\delprof.ico", -1, 10, 80, 80)
    GUICtrlCreateLabel("DelProf", 10, 120)
    GUICtrlSetTip(-1, "Delete Local Profiles")
    $n3 = GUICtrlCreateIcon(@ScriptDir & "\fpolicy.ico", -1, 10, 140, 140)
    GUICtrlCreateLabel("Fpolicy", 10, 180)
    GUICtrlSetTip(-1, "Force Policy Update")
    $n4 = GUICtrlCreateIcon(@ScriptDir & "\wexplore.ico", -1, 10, 200, 200)
    GUICtrlCreateLabel("Files", 10, 240)
    GUICtrlSetTip(-1, "Windows Explorer")
    $n5 = GUICtrlCreateIcon(@ScriptDir & "\reboot.ico", -1, 10, 260, 260)
    GUICtrlCreateLabel("Reboot", 10, 300)
    GUICtrlSetTip(-1, "Reboot Computer")
    $n6 = GUICtrlCreateIcon(@ScriptDir & "\Scd.ico", -1, 10, 320, 320)
    GUICtrlCreateLabel("Srv CD", 10, 360)
    GUICtrlSetTip(-1, "Map Drive To Server CD Rom")
    $n7 = GUICtrlCreateIcon(@ScriptDir & "\wupdate.ico", -1, 10, 380, 380)
    GUICtrlCreateLabel("Win Upt", 10, 420)
    GUICtrlSetTip(-1, "Force Windows Update From SUS Server")
    $n8 = GUICtrlCreateIcon(@ScriptDir & "\vnc.ico", -1, 10, 440, 440)
    GUICtrlCreateLabel("VNC", 10, 480)
    GUICtrlSetTip(-1, "Run VNC Session")
    $n9 = GUICtrlCreateIcon(@ScriptDir & "\appman.ico", -1, 10, 500, 500)
    GUICtrlCreateLabel("Prism", 10, 540)
    GUICtrlSetTip(-1, "Prism Application")
    $n10 = GUICtrlCreateIcon(@ScriptDir & "\userman.ico", -1, 10, 560, 560)
    GUICtrlCreateLabel("User Mgr", 10, 600)
    GUICtrlSetTip(-1, "CSE User Manager")
    $n11 = GUICtrlCreateIcon(@ScriptDir & "\appmgr.ico", -1, 10, 620, 620)
    GUICtrlCreateLabel("App Mgr", 10, 660)
    GUICtrlSetTip(-1, "CSE Application Manager")
    GUISetState(@SW_SHOW)

    ; All test to see if Icons work !!

    While 1
    $bpress = GUIGetMsg()
    Select
    Case $bpress = $n1
    Run('c:\windows\system32\mstsc.exe /v:server01 /console /f')
    Case $bpress = $n2
    Run('l:\delprof\delprof.exe')
    Case $bpress = $n3
    Run('\\stjohns01\apps\misc\force policy.cmd')
    Case $bpress = $n4
    Run('c:\windows\explorer.exe')
    Case $bpress = $n5
    Run('l:\matt\reboot.cmd')
    Case $bpress = $n6
    Run('l:\matt\server cd.cmd')
    Case $bpress = $n7
    Run('l:\sus\nwsusutil.exe server01')
    Case $bpress = $n8
    Run('p:\misc\vnc-4.0-x86_win32_viewer.exe')
    Case $bpress = $n9
    Run('f:\network toolkit\application manager\prism pack\paedit.exe')
    Case $bpress = $n10
    Run('f:\network toolkit\user manager\cse user manager.exe')
    Case $bpress = $n11
    Run('c:\program files\cse application manager\cse application manager.exe')
    EndSelect
    WEnd

SHARE:
+ Post New Thread
Page 2 of 2 FirstFirst 12

Similar Threads

  1. Message of the day
    By googlemad in forum Netware
    Replies: 0
    Last Post: 7th November 2007, 10:29 AM
  2. Message of the Day - yes again!
    By alan-d in forum How do you do....it?
    Replies: 1
    Last Post: 28th March 2007, 11:32 AM
  3. Message of the day application
    By NetworkGeezer in forum How do you do....it?
    Replies: 16
    Last Post: 23rd January 2007, 11:11 AM

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •