AutoHotkey Community

It is currently May 26th, 2012, 11:20 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 12 posts ] 
Author Message
PostPosted: November 16th, 2009, 1:10 am 
Offline

Joined: November 15th, 2009, 10:21 pm
Posts: 21
Location: London, UK
Image

Quote:
It is already one year playing with the AutoHotkey codes in my lonely room in somewhere in London, UK. Since I work in a preparatory school with old computers and a dozen of printers, I decided to design a single script to connect printers to the users. This idea became my playing toy in few weekends and changed into a sophisticated suit of software.

I am sharing with you to receive suggestions and transform the software in a professional project.


NetKeeper

Overview
NetKeeper is a small piece of software designed in AutoHotkey language code to support users in a Windows NT environment. Using already present resources in the operate system, the NetKeeper improve the printer sharing features of the network. It also helps deploy files into the terminals and manage installed virtual machines.

Version
Alpha Version being tested with success in a Windows XP network system connected to a Windows 2003 server. The network is monitored by the Ranger software and Norton Anti-Virus Corporation software.

Modules
The software works from four different modules recorded in four executable files:

NetKeeper NetKeeper.exe
V 2.0 Main module, with start-up and background routines

NetKeeper Working Office NKOffice.exe
V 1.5 User interface module, with options to synchronize documents and locate printers.

NetKeeper Infiltrator NKInfiltrator.exe
V 1.0 Setting up module, which work in the operate system starting script to verify the NetKeeper installation.

NetKeeper Shed NKShed.exe
[In development.] Server module, managing the universal files and settings.

NetKeeper

An important feature of the main module is the use of the icon tray as the main interface. Just few routines inside the modules show a graphic interface to the user. The NetKeeper small icon in the tray shows the current status of the current routine working.

The main module routines are organized in:
• Starting Up
o Update time and date with the log on server.
o Install a network port printer if the user own administrative rights.
o File Deploying - Deploy files from a source in the network to a terminal hard drive.
o Virtual Machine Management - Synchronize virtual machines files between the server and the computer. Locate and register the virtual machines installed in the computer to the logged user. [Microsoft Virtual PC]
o Launch a queued application (especially MSI extension) or open a document file.
o Create or delete a shortcut in the desktop to access virtual machines, deployed files and the Netkeeper Working Office.

• Background
o Keep verifying the access status to the server and local system.
o Printer Smart Redirection - Redirect the output default printer when the printer status changes.
o Printer Auto Sharing - Connect the user to shared and available printers in the network
o Periodically list the installed printers in the system in a universal file in the server.
o Restart the operate system if the computer lost connection with the server.

File Deploying
This routine copies only the files (not subfolders) inside the source folder to any target folder in the computer. Before start, the routine verify the free space and accessing rights to the target folder. Once the verification is done, all files are compared and copied. If the file is already present in the target folder, it is overwritten if older than seven days.

Virtual Machine Management
Inside the NetKeeper folder, a special folder stores the virtual machines files to be synchronized with the computer when the user log on. If the files are not present in the folder, they are erased from the computer folder. Any already current file in the computer is overwritten if is thirty days old. After the synchronization, this routine registers all virtual machine console files to the current user. If specified, the routine launch a virtual machine and even turn off the computer once the machine window is closed.

Printer Smart Redirection
If a printer status change to offline or is a null printer (fax or file generators), this intelligent routine will look for the best output of an available printer. The selected printer preference starts with the local printers. If none is found, the network printers are tested. A printer with less jobs and full access is the routine’s preference.

Printer Auto Sharing
Using a universal printers list, this automated script installs available network printers to the current user. The printers are sorted in groups to organize the printer’s location. The user can access a single shared printer in different computers without the interference of a manual installation.


Last edited by First Toy Lab on November 21st, 2009, 2:16 am, edited 3 times in total.

Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 16th, 2009, 9:57 am 
Offline

Joined: May 17th, 2007, 12:07 pm
Posts: 1004
Location: Germany - Deutschland
sorry, but where´s the script?


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 16th, 2009, 4:25 pm 
Offline

Joined: November 15th, 2009, 10:21 pm
Posts: 21
Location: London, UK
aaffe wrote:
sorry, but where´s the script?


I am not sharing the script, just the idea.

:wink:

I can tell how I did the routines, but I will not reveal the whole script. It is a important 'toy' to my career.


Report this post
Top
 Profile  
Reply with quote  
PostPosted: November 16th, 2009, 5:12 pm 
Offline

Joined: May 17th, 2007, 12:07 pm
Posts: 1004
Location: Germany - Deutschland
But so why do you post under Scripts&Functions? This should be instead under Smalltalk...


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 16th, 2009, 5:42 pm 
Offline

Joined: November 15th, 2009, 10:21 pm
Posts: 21
Location: London, UK
NetKeeper’s Working Office

This module open to the user a graphic interface window with buttons to access tools and a small panel showing the virtual machines files found in the computer. The routines in this module use the same universal files in the Netkeeper suit, but work independent from the main module. The tools available to the user are:

• Open the company’s network message board
• Synchronize ‘My Document’ files to a removable device
• Locate and use available printers in the network
• Request technical support to solve an issue

In the bottom, the small panel of the virtual machines offer two buttons to open the files in a window or in full screen. Both buttons trigger a routine which detect if the machine need registration before start.

Open the company’s network message board
In this interface the user accesses the box of the message, a list with the subject messages, and two buttons options: Post a Message and Delete. The user can delete just the messages post by it. A message is show with the domain username, date and number of views. Messages older than thirty days are erased.

Synchronize ‘My Document’ files to a removable device
A powerful and useful interface which let the user keep its document files in synchronization with a removable device driver (memory stick, hard disk, etc). The interface routine is designed to automatically detect the device connection to the USB port. Once the connection is confirmed, the routine gather information about the device and the ‘My Documents’ folder. If the device owns enough space, the routine release the button to synchronize. Once the synchronization starts, the routine compare the files and execute a bi-directional copy of the files respecting the last update file. It also delete files and duplicate the folder‘s tree in both directions. The removable device folder and the ‘My Document’ folder become exactly the same after the synchronization.

Locate and use available printer in the network
The first interface of this option shows the number of local and network printer available to the user. All local shared printers and remote printers are tested to verify they status. If they are ready and on line, they are include in the list. All local printers are listed, except the ones with null output. Once the printer list is filtered, the second interface offer to the user important details about the printer and a button to use the printer.

Request technical support to solve an issue
[In development]


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 16th, 2009, 5:45 pm 
Offline

Joined: November 15th, 2009, 10:21 pm
Posts: 21
Location: London, UK
aaffe wrote:
But so why do you post under Scripts&Functions? This should be instead under Smalltalk...


Because this is the best spot to speak about a software done in AutoHotkey, not in 'small talk'

:twisted:

I will relase parts of the script soon I have a beta version.

Stop to be a bee.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 16th, 2009, 6:15 pm 
Offline

Joined: May 17th, 2007, 12:07 pm
Posts: 1004
Location: Germany - Deutschland
I think youre wrong. Scripts&Functions is only for existing Scripts and Functions.
To talk about Scripts without a code belongs to Smalltalk.
:wink:


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 16th, 2009, 6:27 pm 
Offline

Joined: November 15th, 2009, 10:21 pm
Posts: 21
Location: London, UK
aaffe wrote:
I think youre wrong. Scripts&Functions is only for existing Scripts and Functions.
To talk about Scripts without a code belongs to Smalltalk.
:wink:


Hey, be nice or you will not have your candy!

What so ever, here are few pictures showing the graphic interface of the software.

http://cid-22f512d0bb6954f1.skydrive.live.com/browse.aspx/.Public/NetKeeper?lc=1033


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 17th, 2009, 12:44 am 
Offline

Joined: April 24th, 2009, 7:06 pm
Posts: 87
Nevertheless it looks amazing.

Did i got you right, You can automatically connect a shared Printer
to multiple Computers simultaneously?
Is it possible to make the silent, too?
Is it possible to use multifunction printer's features like scanning?

Looking Forward to it. :wink:


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 17th, 2009, 5:16 pm 
Offline

Joined: November 15th, 2009, 10:21 pm
Posts: 21
Location: London, UK
Deep-Silence wrote:
Nevertheless it looks amazing.

Looking Forward to it. :wink:


Thank you by you interest. I am glad that someone is interested.

Quote:
Did i got you right, You can automatically connect a shared Printer to multiple Computers simultaneously?


The NetKeeper is designed to connect the network printers without the user interference. Printers with an IP port can be installed as local printers in the computer, with appear to any logged user. When a shared printer from other computer is installed, the windows just update the registry of the present user. That means the others user must repeat the process every time they first log on in the computer.

If this is necessary in a room with 16 computers and just 1 shared ink printer without IP port, the responsible IT technician will be drive nuts when the room is fully busy and everyone wish to print. A user with advanced level and access to the option ‘Add Printer’ perhaps locates and connect the printer. All other users simply cannot follow the steps without support.

Do you think that is the end?

If these 16 users come back next day and each one sit in a different computer, is necessary repeat the ‘Add Printer’ process 16 times! And it is just one group. If the room is used by 80 users every week, you do not need read Pythagoras to realize the big task: 16x80=1280 times to install a single printer connection.

Someone forgot to feedback the Microsoft team about this horrible mistake of software design.

Since this is a challenge in the preparatory school where I work, I wrote the two modules to trick this mistake: Auto Sharing and Smart Redirection.

The first works in the background and is silent. While the user is log on, the module read a universal file in the server and connects to any available printer. The printer’s availability is sorted in groups. With this option is possible organize near printers to be shared by the computers of the same group. This avoids the guy in the reception find his printed documents in the stock room printer.

The second just verify the status of the output default printer. If the printer cannot work because is offline or do not produce real piece of paper, it is replaced by other available printer. And since the Auto Sharing just connects printers from the near group, the choice can be a shared printer in another room. Once the printer is changed, the module warns the user with a ‘balloon tip’.

Quote:
Is it possible to make the silent, too?


The NetKeeper just shows a different icon in the system tray when working. But I will implement an option to make the whole script silent.

Quote:
Is it possible to use multifunction printer's features like scanning?


No... And I am looking for any support or starting point to work with scanners in AHK. Does anyone know a command-line executable program that manage scanners or drivers TWAIN?

_________________
Image

http://www.autohotkey.net/~FirstToyLab/


Report this post
Top
 Profile  
Reply with quote  
PostPosted: November 17th, 2009, 6:44 pm 
Offline

Joined: November 15th, 2009, 10:21 pm
Posts: 21
Location: London, UK
NetKeeper Infiltrator 1.5a

To deploy the standalone module and install it in the start-up registry key, this module was written to work in the ‘Netlogon Script’ set in the active directory profile.

Quote:
:idea:

Version 1.5a
- Just install the NetKeeper if user own administrative rights.
- Added the executable command-line CACLS to grant full permission to the installation folder.
- Force the NetKeeper start if the registry does not own a RUN key or is inaccessible.


I wish share this script with network administrators as a good example to create a little executable which can work with the automated scripts. It’s kept the update the files in the terminal and ensures the program is launched. Next version I will implement a uninstall subroutine.

Funny fact: it update quicker the files in the terminal computer than if was did by few lines in the own Net Logon script. And if the usual user of the machines owns administrative rights, it’s possible stay in the office and chill out... The script spread the software like butter!

8)

Code:
; -------------------------------------------
; NetKeeper Infiltrator
; ver. 1.5 alpha
; NetKeeper Infiltrator.ahk
;
; Wrote by Augusto Croppo
;
; Started in Nov 2009
; augustocroppo@hotmail.co.uk
;
; Interpretation and compilation by AutoHotkey
; http://www.autohotkey.com/
; -------------------------------------------



; PICK-LOCK MODULE
; ****************
SetBatchLines, -1

#SingleInstance ignore
#NoTrayIcon
#Persistent

Menu, TRAY, NoStandard
Menu, TRAY, DeleteAll

terminalmainfile = C:\NetKeeper\NetKeeper.exe
servermainfile = N:\Applications\Netkeeper\NetKeeper.exe
terminalfolder = C:\NetKeeper\
serverfolder = N:\Applications\Netkeeper\

; SORT OUT THE INFILTRATION TASK
IfExist, C:\NetKeeper
{
   IfExist, %terminalmainfile%
   {
      IfExist, %servermainfile%
      {
         FileGetTime, time1, %terminalmainfile%, M
         FileGetTime, time2, %servermainfile%, M
         EnvSub, time2, %time1%, S
         if time2 > 1
         {
            Goto UpdateFiles
         }
         Else
         {
            Goto VerifyRegistry
         }
      }
      Else
      {
         ExitApp
      }
   }
   Else
   {
      Goto Install
   }
}
Else
{
   Goto Install
}

VerifyRegistry:
; SPY THE REGISTRY TO FIND THE RUN KEY
RegRead, verifyrunregistry, HKLM, SOFTWARE\Microsoft\Windows\CurrentVersion\Run, %terminalmainfolder%
If Errorlevel
{
   Goto ForceRun
}
Else
{
   If verifyrunregistry <> %terminalmainfile%
   {
      Goto Install
   }
   Else
   {
      ExitApp
   }
}

Install:
; TRY TO INSERT A KEY INTO THE REGISTRY
If A_IsAdmin = 1
{
   FileCreateDir, C:\NetKeeper
   If ErrorLevel
   {
      ExitApp
   }
   Else
   {
      
      ; -> Add more subfolders here with FILECREATEDIR <-
         
      Run %comspec% /C "cacls.exe %terminalfolder% /e /t /c /g "Authenticated Users":F",, Hide UseErrorLevel
      If ErrorLevel
      {
         ExitApp
      }
      Else
      {
         writerunkey = 1
         Goto UpdateFiles
      }
   }
}
Else
{
   Goto ForceRun
}
   
UpdateFiles:
; DELIVER THE TOOLS AND MATERIALS
FileDelete, %terminalfolder%\*.*
Loop, %serverfolderr%\*.*, 0, 0
{
   if A_LoopFileAttrib contains H,S
      continue
   newline = "%A_LoopFileFullPath%","%terminalfolder%\%A_LoopFileName%"`n`r
   copylist .= newline
   filecount += 1
}
If copylist <>
{   
   Gui, Add, GroupBox, x11 y50 w282 h64 ,
   Gui, Font, S8 CDefault, Verdana
   Gui, Add, Text, x15 y12 w280 h30 center, NetKeeper is syncronizing with the central server to update itself in this terminal computer.
   Gui, Add, Progress, x20 y66 w265 h15 vProgress Range0-%filecount% BackgroundWhite,
   Gui, Add, Text, x22 y88 w260 h16 vCountup center,
   Gui, Show, x480 y274 center, NetKeeper Infiltrator!,
   Loop, Parse, copylist, `r
   {
      If A_LoopField <>
      {
         Loop, Parse, A_LoopField, CSV, "
         {
            If A_Index = 1
               source = %A_LoopField%
            If A_Index = 2
               target = %A_LoopField%
         }
         GuiControl,, Progress, +1
         FileCopy, %source%, %target%, 1
         if ErrorLevel
         {
            Continue
         }
         GuiControl,, Countup, %A_Index% of %filecount% files copied...
         countup += 1
         If %countup% >= %filecount%
            Break
      }
   }
   GuiControl,, Progress, +1
   Sleep 2000
   If writerunkey = 1
   {
      RegWrite, REG_SZ, HKEY_LOCAL_MACHINE, SOFTWARE\Microsoft\Windows\CurrentVersion\Run, %terminalmainfolder%, %terminalmainfile%
      If Errorlevel
      {
         Goto ForceRun
      }
      GuiControl,, Countup, Logging off to load the NetKeeper!
      Sleep 2000
      Shutdown, 4
   }
   ExitApp
}

ForceRun:
; RUN INTO THE BUILDING IF THE KEY DO NOT WORK
IfExist, %terminalmainfile%
   Run %comspec% /C "%terminalmainfile%",, Hide
ExitApp

GuiClose:
; JUST LEAVE WHEN THE INFILTRATION IS DONE
Return


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 21st, 2009, 2:11 am 
Offline

Joined: November 15th, 2009, 10:21 pm
Posts: 21
Location: London, UK
:arrow:

http://www.autohotkey.net/~FirstToyLab/


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 12 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: Miguel and 14 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group