Page 1 of 1 1
Topic Options
#76731 - 2003-09-17 05:58 PM New Inventory Script
tekkmann140 Offline
Lurker

Registered: 2003-09-17
Posts: 3
Loc: USA
Break On

;--------------------------------------------------------------------------------------------------
;Program Name: Aida.kix
;Creation Date: 9/17/2003
;Purpose: Inventory workstations only if Admin logs on.
;Author: Dan Drass
;Company Name: BRTRC
;Instructions: Download a copy of Aida32 Enterprise Edition from http://www.aida32.hu/aida32.php,
; Its free. Register your copy please.
;
; Create a network share called Aida AND put the following files in it:
; Aida32.exe, Aida32.bin , Aida32.dat AND whatever rpf file you create in it as well.
; Give your users RX rights to it. Under your Server\Aida directory, Create another
; directory called Reports. Give your users W access.

; Note: The names of the server directories are unimportant. You can call them
; anything that you want. You can also create CSV files. I like INI files. See the
; Aida32 manual for all the cool command-line options.
;
; You don't need to install Aida on any other machine.
; I've tested this on NT 4.0 Server and W2K machines. You're free to tweak and
; alter this file any way that you like. Cheers to all.
;------------------------------------------------------------------------------------------------

$Selection = MessageBox("Do you want to inventory this machine? Click No to skip this update. Click Yes to inventory now.", "Inventory Updater", 36)

Select

Case $Selection = 2
? "Cancel selected, continuing...."
Goto CANCEL
Case $Selection = 6
? "Yes selected, continuing...."
Goto YES
Case $Selection = 7
? "No selected, continuing...."
Goto NO

Case 1
? "Unknown selected, continuing...."
Goto Error

EndSelect

:YES
Sleep 1
CLS
Run "\\server\share\aida\aida32 /R \\server\share\aida\a32reports\$HOSTNAME /INI /Custom \\server\share\aida\test.rpf /Silent /Safe"
Goto MESS
;Return

:NO
Sleep 1
CLS
Goto END

;--------------------------------------Lines added for later use

:Error
Sleep 1
CLS
$ReturnCode = SendMessage("LANADMIN" , @USERID + " Inventory Error at " + @TIME)
If $ReturnCode = 0
? "Message has been sent to LAN Admin..."
Sleep 2
Goto END
EndIf

; -----------------------------------------------------------

; *****************************************
; END OF ROUTINE. END OF PROGRAM
;********************************************

:MESS
Sleep 2
CLS
?" Inventory is in progress...please wait....."
Sleep 2
CLS
Goto END

:END
CLS
FlushKB
Exit

;------------- Just in case everything else fails do this check


CLS

Top
#76732 - 2003-09-17 06:28 PM Re: New Inventory Script
tekkmann140 Offline
Lurker

Registered: 2003-09-17
Posts: 3
Loc: USA
This all should be on one line. It's word-wrapped.
Run "\\server\share\aida\aida32 /R \\server\share\aida\a32reports\$HOSTNAME /INI /Custom \\server\share\aida\test.rpf /Silent /Safe"

Top
#76733 - 2003-09-17 06:32 PM Re: New Inventory Script
Radimus Moderator Offline
Moderator
*****

Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
use code tages and you fix the problem
_________________________
How to ask questions the smart way <-----------> Before you ask

Top
#76734 - 2003-09-17 06:38 PM Re: New Inventory Script
Radimus Moderator Offline
Moderator
*****

Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
btw.... prepare for a canadian 'busting' as soon as he sees gotos in your script.
[Big Grin] [Eek!] [Wink]
_________________________
How to ask questions the smart way <-----------> Before you ask

Top
#76735 - 2003-09-18 04:29 PM Re: New Inventory Script
tekkmann140 Offline
Lurker

Registered: 2003-09-17
Posts: 3
Loc: USA
I like to follow the K.I.S.S. principal when running my network. Personally, I hate programming. Here I just do not have the time or inclination to "program" anything. Third party solutions, short batch files and kix scripts are the way to go for me. Canadian busting? What the hell is that? And who cares? LOL
Top
#76736 - 2003-09-18 08:08 PM Re: New Inventory Script
Vertigo1 Offline
Lurker

Registered: 2003-09-18
Posts: 1
With COol code tags.

code:
Break On

;--------------------------------------------------------------------------------------------------
;Program Name: Aida.kix
;Creation Date: 9/17/2003
;Purpose: Inventory workstations only if Admin logs on.
;Author: Dan Drass
;Company Name: BRTRC
;Instructions: Download a copy of Aida32 Enterprise Edition from http://www.aida32.hu/aida32.php,
; Its free. Register your copy please.
;
; Create a network share called Aida AND put the following files in it:
; Aida32.exe, Aida32.bin , Aida32.dat AND whatever rpf file you create in it as well.
; Give your users RX rights to it. Under your Server\Aida directory, Create another
; directory called Reports. Give your users W access.

; Note: The names of the server directories are unimportant. You can call them
; anything that you want. You can also create CSV files. I like INI files. See the
; Aida32 manual for all the cool command-line options.
;
; You don't need to install Aida on any other machine.
; I've tested this on NT 4.0 Server and W2K machines. You're free to tweak and
; alter this file any way that you like. Cheers to all.
;------------------------------------------------------------------------------------------------

$Selection = MessageBox("Do you want to inventory this machine? Click No to skip this update. Click Yes to inventory now.", "Inventory Updater", 36)

Select

Case $Selection = 2
? "Cancel selected, continuing...."
Goto CANCEL
Case $Selection = 6
? "Yes selected, continuing...."
Goto YES
Case $Selection = 7
? "No selected, continuing...."
Goto NO

Case 1
? "Unknown selected, continuing...."
Goto Error

EndSelect

:YES
Sleep 1
CLS
Run "\\server\share\aida\aida32 /R \\server\share\aida\a32reports\$HOSTNAME /INI /Custom \\server\share\aida\test.rpf /Silent /Safe"
Goto MESS
;Return

:NO
Sleep 1
CLS
Goto END

;--------------------------------------Lines added for later use

:Error
Sleep 1
CLS
$ReturnCode = SendMessage("LANADMIN" , @USERID + " Inventory Error at " + @TIME)
If $ReturnCode = 0
? "Message has been sent to LAN Admin..."
Sleep 2
Goto END
EndIf

; -----------------------------------------------------------

; *****************************************
; END OF ROUTINE. END OF PROGRAM
;********************************************

:MESS
Sleep 2
CLS
?" Inventory is in progress...please wait....."
Sleep 2
CLS
Goto END

:END
CLS
FlushKB
Exit

;------------- Just in case everything else fails do this check


CLS


Top
#76737 - 2003-09-18 11:15 PM Re: New Inventory Script
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
Still contains these GOTOs. Get rid of them. They are not even necessary and indicate a lack of understanding of flow of script execution.

I won't allow any script in my network that contains even a single GOTO!
_________________________
There are two types of vessels, submarines and targets.

Top
#76738 - 2003-09-19 01:47 AM Re: New Inventory Script
JohnQ Offline
Starting to like KiXtart

Registered: 2003-03-04
Posts: 171
I'm not sure if Jens is Canadian or even the person that Radimus was refering to but now you know what a 'GOTO BUSTING' is.

Don't feel bad... I think he's busted everyone at some point. His points are valid though. Just do a couple of searches on the board and you'll find plenty of reasons why you shouldn't use GOTO and better methods of accomplishing things. [Embarrassed]

You're better off saving the GOTO's for your batch files.

Top
#76739 - 2003-09-19 01:54 AM Re: New Inventory Script
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
HEHEE
I could make Jens an honorary Canadian if helps rid the world of GOTOs. [Big Grin]

This Canadian judge gives a big fat zero for the use of GOTOs. [Razz]
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#76740 - 2003-09-19 02:02 AM Re: New Inventory Script
Radimus Moderator Offline
Moderator
*****

Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
Jens is already German... it would be too much if you made hime part French too [Eek!] [Big Grin] [Eek!]
_________________________
How to ask questions the smart way <-----------> Before you ask

Top
#76741 - 2003-09-19 02:11 AM Re: New Inventory Script
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Bite your tongue...
You know we blackened your Whitehouse once before. [Big Grin]
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#76742 - 2003-09-19 06:55 AM Re: New Inventory Script
JimRobinson Offline
Fresh Scripter

Registered: 2003-01-10
Posts: 42
Loc: Tempe, AZ
I mostly just lurk here, but I can't resist.

quote:
You're better off saving the GOTO's for your batch files.
The only good GOTO in a batch file is a GOTO :EOF [Wink]
_________________________
Jim
--------------------

Top
#76743 - 2003-09-19 09:54 AM Re: New Inventory Script
Radimus Moderator Offline
Moderator
*****

Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
see your code for BEFORE:

The is AFTER:
code:
 
$Selection = MessageBox("Do you want to inventory this machine? Click No to skip this update. Click Yes to inventory now.", "Inventory Updater", 36)
Select
Case $Selection = 2
? "Cancel selected, continuing...."
Case $Selection = 6
? "Yes selected, continuing...."
Run "\\server\share\aida\aida32 /R \\server\share\aida\a32reports\$HOSTNAME /INI /Custom \\server\share\aida\test.rpf /Silent /Safe"
?" Inventory is in progress...please wait....."
Case $Selection = 7
? "No selected, continuing...."
Case 1
? "Unknown selected, continuing...."
$ReturnCode = SendMessage("LANADMIN" , @USERID + " Inventory Error at " + @TIME)
If $ReturnCode = 0
? "Message has been sent to LAN Admin..."
EndIf
EndSelect
CLS
FlushKB
Exit

Note that you have an unassigned GOTO
quote:
Case $Selection = 7
? "No selected, continuing...."
Goto NO

and a bunch of sleep statements... probably for the entertainment of your users (users can't read) and CLS statements (so they only had 1 line to read at a time.
_________________________
How to ask questions the smart way <-----------> Before you ask

Top
#76744 - 2003-09-19 01:40 PM Re: New Inventory Script
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
this is bad.
user will always answer no as that means faster startup.
_________________________
!

download KiXnet

Top
#76745 - 2003-09-19 05:54 PM Re: New Inventory Script
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
Then build in some "harassment code". After clicking NO three times, the computer will be inventoried automatically, but three times as slow while annoying music is being played [Wink]

[ 19. September 2003, 17:55: Message edited by: sealeopard ]
_________________________
There are two types of vessels, submarines and targets.

Top
Page 1 of 1 1


Moderator:  Glenn Barnas, NTDOC, Arend_, Jochen, Radimus, Allen, ShaneEP, Ruud van Velsen, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 778 anonymous users online.
Newest Members
batdk82, StuTheCoder, M_Moore, BeeEm, min_seow
17885 Registered Users

Generated in 0.041 seconds in which 0.017 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org