Results 1 to 5 of 5

Thread: Nothing Fancy

  1. #1

    Thread Starter
    New Member
    Join Date
    Jul 2011
    Posts
    6

    Nothing Fancy

    Need assistance: As little as input, but code additions would be wonderful.

    Without going into too much detail, I'm a Govt Employee that requires an up-to-date hard drive of Electronic Publications and FAA approach information to be maintained. We have 180 of them (drives and personnel) and its been put onto to me to come up with a way to do it without any additional resources. However, I am still new to programming scene.

    Some brainstorms we came up with before, included using VBA via an HTA using a basic looking interface. This works for us, since all 180 users have no admin rights at all and HTA runs without any warnings or errors. Any other suggestions are welcome within those parameters.

    What I really need it to do? I need it to (and in a crazy simple looking way) go out (when opened) check to see if a newer version of the two folders are up-to-date with our shared drive (not mapped) version of these folders. I've gathered that since they often plug-in at other computers not on our internal network, it would need to ping for availability I'm guessing.

    One of my ideas would be: Traffic light. Green (Up-to-date), Yellow (unable to verify, offline), Red (out-of-date). When its Red, clicking on it would trigger an overwrite.

    I don't care about how the files get copied, native VBS...Robocopy silent in the background.

    A progress bar for the update would be a gucci feature, but not required. A tricked out animated GIF would work in their eyes are much as progress bar that actually keeps track.

    Its asking a lot, but if anyone has any ideas...it would help us out BIG TIME. I know it sounds like i'm asking for the moon, but I'm really just sound-boarding some ideas from some wiser than me. This would be a big "win" for my office to get this hassle under the rug.

  2. #2
    Fanatic Member
    Join Date
    Nov 2007
    Posts
    520

    Re: Nothing Fancy

    Is the government really that hard up for funds that they would require such a program without hiring an actual programmer?

    Hell, didnt the FBI blow like 8mil on a new anti terrorism system that couldn't tell the difference between a terrorist and a online gamer?

  3. #3

    Thread Starter
    New Member
    Join Date
    Jul 2011
    Posts
    6

    Re: Nothing Fancy

    You, Sir, have no idea. Not only would the funds be laughed at, but I'd have to ask about 30 different bosses and make presentations, and all kinds of hoops.

    They'd take it and turn into a huge project that would be for "all pilots" instead of just our 200 here. Scope would be completely blown out of proportion.

    I'm just trying to do a good thing for our people and not let Uncle Sam get too involved.

    Color this guy frustrated, and please don't take it as offense...I was just venting. Even worse, we're talking about the Air Force when it comes to these problems.
    Last edited by tssrshot; Aug 21st, 2011 at 02:35 PM.

  4. #4

    Thread Starter
    New Member
    Join Date
    Jul 2011
    Posts
    6

    Re: Nothing Fancy

    Ok, got some things figured out, but can't translate my ideas into code. I've been cutting/pasting pieces and working them together, but just doesn't seem to work from my little experience stand-point.

    We converted our EPubs viewer app into an HTML/JQuery/Web-Based solution, so we have XML file that states the version for comparison.

    Top line of the XMl states:

    <digital_tpp cycle="" version="4.3" from="25 AUG 2011" to="22 SEP 2011">

    In pseudo-pseudo code here is the breakdown of what I wasn trying to do above:

    -Check is P: is mapped, if it is, then check version of XML file "4.3" with the one located in the drive the application is running from
    -If P: is not mapped, then Map it from UNC and check version
    -If P: is unavailable and not able to be mapped, disable Update button and state, update status is unavailable, Current Loaded version fron XML is 4.3

    -If version on server is higher in number (i.e. 4.4), compile a list of files that are newer than versions on the drive based on date last modified and copy/overwrite only those files. With a progress bar, as its a couple of hundred users, and one shared drive...need to let them know how much longer it will be.

    When its done copying, check again and state up-to-date/Version/Today's Date.

    If I could even close to this functionality, i'd be sooo golden. Any help would be great.
    Attached Files Attached Files

  5. #5
    Frenzied Member
    Join Date
    Apr 2009
    Location
    CA, USA
    Posts
    1,516

    Re: Nothing Fancy

    This may not be entirely right; I'm not necessarily sure I understood all of your goals, and I haven't written anything in VBScript for a long while. But I took what you posted and tried to clean it up and flesh it out a bit...
    Code:
    <html>
      <head>
      <title>38 RS ePubs Updater</title>
      <hta:application id="oPU"
        applicationname="38 RS ePubs Updater"
        border="thick"
        caption="yes"
        contextmenu="no"
        icon=".\images\38RS.ico"
        maximizebutton="no"
        minimizebutton="no"
        navigable="no"
        scroll="no"
        showintaskbar="yes"
        singleinstance="yes"
        sysmenu="yes"
        version="1.0.1"
        windowstate="normal"
        >
    
      <style type="text/css">
          body{
              text-align: center;
          }
          .vAlign{
              vertical-align: top;
          }
          #driveSelect{
              text-align: left;
          }
      </style>
         
      <script language="VBScript">
      Const SOURCE_PATH = "P:\"
      Dim aImageCollection : aImageCollection = Array(_
        ".\images\loading.gif", _
        ".\images\warning.gif", _
        ".\images\go.gif", _
        ".\images\error.gif" _
        )
      Dim aMessageStatus : aMessageStatus = Array( _
        "Please wait while we check for availability of update server...", _
        "Update Server Not Available", _
        "ePubs up-to-date", _ 
        "ePubs needs updating" _
        )
      Dim arrContents
      Dim objFSO
    
      Sub Window_OnLoad
        window.offscreenBuffering = True
    
        Set objFSO = CreateObject("Scripting.FileSystemObject")
        If objFSO.FileExists(".\HTA.ini") Then
          Set objFile = objFSO.OpenTextFile(".\HTA.ini", 1)
          strContents = objFile.ReadAll
          objFile.Close
          arrContents = Split(strContents, ",")
        Else
          'display message: "cant run without ini file" ?
        End If
        
        Call statusUpdate(0)
    
        Set objNetwork = CreateObject("WScript.Network")
       
        If objFSO.DriveExists("P:") Then
          Call CheckVersion()
        Else
          On Error Resume Next
          objNetwork.MapNetworkDrive "P:", "\\off-cs-fas01\55_og_wg\"
          if Err.Number <> 0 then
            Call statusUpdate(1)
          end if
        End If
    
      End Sub
      
      Sub statusUpdate(index)
        statusImg.src = aImageCollection(index)
        statusCaption.InnerText = aMessageStatus(index)
        if index < 3 then
          copy.Style.Display = "none"
        else
          copy.Style.Display = ""
        end if
      End Sub
     
      'Up to user to implement
      'This is only showing an example
      Sub CheckVersion()
        If objFSO.FileExists("LOCAL_XML_FILE") Then
          Set objFile = objFSO.OpenTextFile("LOCAL_XML_FILE", 1)
          set xmlDoc = createobject("Microsoft.XMLDOM")
          xmlDoc.load(objFile.ReadAll) 
          objFile.Close
    
          localVersion = xmldoc.getElementsByTagName("digital_tpp").item(0).getAttribute("version")
        Else
          'display message: "cant get local XML file" ?
        End If
      
        If objFSO.FileExists("REMOTE_XML_FILE") Then
          Set objFile = objFSO.OpenTextFile("REMOTE_XML_FILE", 1)
          set xmlDoc = createobject("Microsoft.XMLDOM")
          xmlDoc.load(objFile.ReadAll) 
          objFile.Close
    
          remoteVersion = xmldoc.getElementsByTagName("digital_tpp").item(0).getAttribute("version")
        Else
          'display message: "cant get remote XML file" ?
        End If
    
        if remoteVersion => localVersion then
          'Version not up-to-date
          Call statusUpdate(3)
          versionDate.InnerText = "ePubs Version: " & localVersion
        elseif remoteVersion < localVersion then
           'Version up-to-date
          Call statusUpdate(2)
          versionDate.InnerText = "ePubs Version: " & localVersion
        end if
        
      End Sub
    
      '''<summary>Copys a folder to the specified destination</summary>
      '''<param name="sDestination">The path where the folder should be copied to</summary>
      Sub CopyFolder()
        Set objRootFolder = objFSO.GetFolder("P:\")
        For Each remoteFile in objRootFolder.Files
          if objFSO.FileExists("LOCAL_PATH" & remoteFile.Name) then
            localFile = objFSO.GetFile("LOCAL_PATH" & remoteFile.Name)
            if remoteFile.DateLastModified > localFile.DateLastModified then
              call remoteFile.Copy("LOCAL_PATH" & remoteFile.Name,true)
            end if
          else
            call remoteFile.Copy("LOCAL_PATH" & remoteFile.Name)
          end if
        Next
    
        Call statusUpdate(2)     
      End Sub  
     
      </script>       
             
      </head>
     
      <body>
    
          <img id="statusImg" />
          <p id="statusCaption"></p>
     
    
          <div id="information">
          <span id="versionDate"></span>
          <button id="copy" onClick="CopyFolder()">Update</button>
      </div>
             
    
      </body>
    </html>
    It still has some pseudo-code (in ALL_CAPS notation). No warranty provided, so please be cautious trying it out; if it seems like what you actually want, post any problems or errors and I can take a look. I can also "pretty up" the visual aspects, but that would come later.

Posting Permissions

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



Click Here to Expand Forum to Full Width