Page 1 of 5 12345>
Topic Options
#173331 - 2007-01-28 04:46 PM ANY SAVIOUR I N HERE TODAY??
selormquarshie Offline
Getting the hang of it

Registered: 2006-12-24
Posts: 85
OK so finally i got a script written. what i will be doing is put it into a GPO and then when th user logon it automathically runs itself with no user prompt; essentially i want it to be in passive mode, and i need it to reboot after the script too..... When i debug this scrip it gives me an 'Invalid function call error" Please help me......

Break off

If Exist ("C:\Program Files\Pivotal\Relation") = 0

MessageBox ("Please wait while Relationship is uninstalled")

Shell 'C:\WINDOWS\uninst.exe-y -f"C:\Program Files\Pivotal\Relation" >NUL 2>NUL /passive'

Sleep 6

Else

? "Error Code = " @Error " Error Details = " @Serror

EndIf

Top
#173332 - 2007-01-28 05:12 PM Re: ANY SAVIOUR I N HERE TODAY?? [Re: selormquarshie]
Gargoyle Offline
MM club member
*****

Registered: 2004-03-09
Posts: 1597
Loc: Valley of the Sun (Arizona, US...
Code:
$rc = messagebox("Please wait while Relationship is uninstalled","Uninstall",0,48,6)


From the manual

MESSAGEBOX
Action


Displays a standard dialog box in Windows.



Syntax


MESSAGEBOX ("message", "title", style, time-out)



Parameters


Message

The message to display in the dialog box.

Title

The title of the dialog box.

Style

Optional numeric expression that is the sum of values specifying the number and type of buttons to display, the icon style to use, the identity of the default button, and the modality. The following table illustrates the values used and the meaning of each group of values.



Buttons to display

Value
Meaning

0
Display OK button only.

1
Display OK and Cancel buttons.

2
Display Abort, Retry, and Ignore buttons.

3
Display Yes, No, and Cancel buttons.

4
Display Yes and No buttons.

5
Display Retry and Cancel buttons.




Icon to display

Value
Meaning

16
Stop symbol

32
Question mark

48
Exclamation mark

64
Information symbol




Default button

Value
Meaning

0
First button is default.

256
Second button is default.

512
Third button is default.




Modality

Value
Meaning

0
Application-modal. The user must respond to the message box before continuing work in the application.

4096
System-modal. All applications are suspended until the user responds to the message box.




When adding numbers to create a final value for the argument type, use only one number from each group. If style is omitted, a default value of 0 is assumed.

Time-out

Optional numeric expression representing the number of seconds after which to close the dialog box.



Note


The time-out feature only works if the MESSAGEBOX dialog box is the active window for the duration of the time-out. If the user switches away from KiXtart and activates another application, the MESSAGEBOX dialog box is not closed.



Remarks


MESSAGEBOX displays a maximum of 1024 characters in application-modal dialog boxes. Longer messages are truncated after the 1024th character. Message strings longer than 255 characters with no intervening spaces are truncated after the 255th character. For system-modal dialog boxes, the number of characters you can display depends on screen resolution and number of lines in the message.



MESSAGEBOX breaks lines automatically at the right edge of the dialog box. If you want to set line breaks yourself, place a linefeed (ANSI character 10) before the first character of the text that is to begin each new line.



Returns


The value returned by MESSAGEBOX indicates which button was selected, as shown in the following table.



Value
Meaning

-1
User did not respond to the dialog box within the specified time-out period.

1
OK button selected.

2
Cancel button selected.

3
Abort button selected.

4
Retry button selected.

5
Ignore button selected.

6
Yes button selected.

7
No button selected.




If the dialog box contains a Cancel button, pressing esc has the same effect as choosing Cancel.
_________________________
Today is the tomorrow you worried about yesterday.

Top
#173333 - 2007-01-28 05:42 PM Re: ANY SAVIOUR I N HERE TODAY?? [Re: Gargoyle]
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Please DON'T SHOUT in the title!

This line is wrong:
Shell 'C:\WINDOWS\uninst.exe-y -f"C:\Program Files\Pivotal\Relation" >NUL 2>NUL /passive'

You cannot redirect without the command interpreter. There is a FAQ on that.
There should be a space between .exe and -y
The /passive switch should be before the failed redirects.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#173334 - 2007-01-28 06:01 PM Re: ANY SAVIOUR I N HERE TODAY?? [Re: Les]
selormquarshie Offline
Getting the hang of it

Registered: 2006-12-24
Posts: 85
I did the recommended changes but it still returns the same error...please help, anyone........

Break off

If Exist ("C:\Program Files\Pivotal\Relation") = 0

$rc = MessageBox("Please wait while Relationship is uninstalled","ESI INTL",0)

Shell 'C:\WINDOWS\uninst.exe -y -f "C:\Program Files\Pivotal\Relation" /passive'

Sleep 6

Else

? "Error Code = " @Error " Error Details = " @Serror

EndIf

Top
#173335 - 2007-01-28 06:28 PM Re: ANY SAVIOUR I N HERE TODAY?? [Re: selormquarshie]
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Your Exist() logic is backwards.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#173336 - 2007-01-28 06:58 PM Re: ANY SAVIOUR I N HERE TODAY?? [Re: Les]
selormquarshie Offline
Getting the hang of it

Registered: 2006-12-24
Posts: 85
so how would you reqrite the Exist logic?
Top
#173337 - 2007-01-28 07:28 PM Re: ANY SAVIOUR I N HERE TODAY?? [Re: selormquarshie]
Allen Administrator Offline
KiX Supporter
*****

Registered: 2003-04-19
Posts: 4545
Loc: USA
What version of kix are you running?

@kix

Top
#173338 - 2007-01-28 07:44 PM Re: ANY SAVIOUR I N HERE TODAY?? [Re: selormquarshie]
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Originally Posted By: selormquarshie
so how would you reqrite the Exist logic?
Like I said, it is backwards. You need to equate it to a 1, not a 0.

There is nothing in your latest posted code that should throw an error, so if you are getting an error, then you are not showing us all the code.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#173340 - 2007-01-28 08:57 PM Re: ANY SAVIOUR I N HERE TODAY?? [Re: Les]
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11164
Loc: Boston, MA, USA
Quote:
automathically runs itself with no user prompt; essentially i want it to be in passive mode, and i need it to reboot

You want no user prompt and but use a MESSAGEBOX() function, you want it to reboot but don't incldue a SHUTDOWN command.

Also, do your users have local admin right? The uninstall will most likely require those.
_________________________
There are two types of vessels, submarines and targets.

Top
#173341 - 2007-01-28 09:15 PM Re: ANY SAVIOUR I N HERE TODAY?? [Re: Sealeopard]
selormquarshie Offline
Getting the hang of it

Registered: 2006-12-24
Posts: 85
ok here's what i got now...however when i debug ..it jumps the MESSAGEBOX () and it does not show the SHELL command. Yes all my users have local admin rights...using kix 4.51. please any suggestions are welcome...my deadline is noon tomorrow....please help...

Code:
Break off 

If Exist ("C:\Program Files\Pivotal\Relation") = 1
  $rc = MessageBox("Please wait while Relationship is uninstalled","ESI INT'L", 10, 0, 1)
  Shell 'C:\WINDOWS\uninst.exe -y -f "C:\Program Files\Pivotal\Relation" /passive'
  Sleep 6
Else
 ? "Error Code = " @Error " Error Details = " @Serror
EndIf 
$rc = Shutdown("", "System is being rebooted to enable new settings.", 30, 0, 1)


[edit: code tags added by Allen.]


Edited by Allen (2007-01-28 09:24 PM)

Top
#173342 - 2007-01-28 09:30 PM Re: ANY SAVIOUR I N HERE TODAY?? [Re: selormquarshie]
Allen Administrator Offline
KiX Supporter
*****

Registered: 2003-04-19
Posts: 4545
Loc: USA
As you have it now, it looks like the shutdown will be a continuous loop... everyone will be effected by it to... also please place your code in between the code tags (# on the post bar).

Might you give this a try
(untested)
Code:
$programpath="C:\Program Files\Pivotal\Relation\"
If Exist($programpath)
  $rc = MessageBox("Please wait while Relationship is uninstalled","ESI INT'L", 10, 0, 1)
  Shell 'C:\WINDOWS\uninst.exe -y -f "C:\Program Files\Pivotal\Relation" /passive'
  Sleep 6
  $rc = Shutdown("", "System is being rebooted to enable new settings.", 30, 0, 1)
Else
  ? $programpath + " Does not Exist"
EndIf 




Top
#173343 - 2007-01-28 09:32 PM Re: ANY SAVIOUR I N HERE TODAY?? [Re: selormquarshie]
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
If it skips past, then you must not have a folder called "Relation" under the subfolder "Pivotal" in "C:\Program Files".
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#173344 - 2007-01-28 09:43 PM Re: ANY SAVIOUR I N HERE TODAY?? [Re: Allen]
selormquarshie Offline
Getting the hang of it

Registered: 2006-12-24
Posts: 85
Moderator, your sample code jumps from the Exist command straight to the ? $programpath + " Does not Exist" line when i attempt to debug it...i guess it should go thru all required steps in debug mode but it's not happening here....i appreciate all your help so please keep them coming....

$programpath="C:\Program Files\Pivotal\Relation\"
If Exist($programpath)
$rc = MessageBox("Please wait while Relationship is uninstalled","ESI INT'L", 10, 0, 1)
Shell 'C:\WINDOWS\uninst.exe -y -f"C:\Program Files\Pivotal\Relation" /passive' Sleep 6
$rc = Shutdown("", "System is being rebooted to enable new settings.", 30, 0, 1)
Else
? $programpath + " Does not Exist"
EndIf

Top
#173345 - 2007-01-28 10:47 PM Re: ANY SAVIOUR I N HERE TODAY?? [Re: selormquarshie]
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
I think relation is not a folder but a file without extension...
_________________________
!

download KiXnet

Top
#173346 - 2007-01-28 10:52 PM Re: ANY SAVIOUR I N HERE TODAY?? [Re: Lonkero]
selormquarshie Offline
Getting the hang of it

Registered: 2006-12-24
Posts: 85
i'm testing at home b4 i deploy on the network tomorrow at work, so i did a sample on my machine but it's still not taking....

$programpath="C:\Program Files\Macromedia\Dreamweaver MX\"
If Exist($programpath)
Shell 'C:\WINDOWS\uninst.exe -y -f "C:\Program Files\Macromedia\Dreamweaver MX" ' Sleep 6
$rc = Shutdown("", "System is being rebooted to enable new settings.", 30, 0, 1)

Else
? $programpath + " Does not Exist"
EndIf

Top
#173347 - 2007-01-28 11:25 PM Re: ANY SAVIOUR I N HERE TODAY?? [Re: selormquarshie]
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Originally Posted By: selormquarshie
Moderator, your sample code jumps from the Exist command straight to the ? $programpath + " Does not Exist" line when i attempt to debug it...
Obviously then, the folder does not exist as I already said.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#173348 - 2007-01-28 11:37 PM Re: ANY SAVIOUR I N HERE TODAY?? [Re: Les]
selormquarshie Offline
Getting the hang of it

Registered: 2006-12-24
Posts: 85
YOu are right..however i gave the code a different input, it should look for maromedia\DreamweaverMX\and delete it o nmy local compuater at home but it wont run that.....am i doing anything wrong. i have Dreamweaver on my pc here.....

$programpath="C:\Program Files\Macromedia\Dreamweaver MX\"
If Exist($programpath)
Shell 'C:\WINDOWS\uninst.exe -y -f "C:\Program Files\Macromedia\Dreamweaver MX" ' Sleep 6
$rc = Shutdown("", "System is being rebooted to enable new settings.", 30, 0, 1)

Else
? $programpath + " Does not Exist"
EndIf

Top
#173349 - 2007-01-28 11:50 PM Re: ANY SAVIOUR I N HERE TODAY?? [Re: selormquarshie]
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
So, what happens when you run it? Do you get $programpath + " Does not Exist"?
The Shell line may not be valid for DreamWeaver.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#173350 - 2007-01-29 02:54 AM Re: ANY SAVIOUR I N HERE TODAY?? [Re: Les]
selormquarshie Offline
Getting the hang of it

Registered: 2006-12-24
Posts: 85
Should it matter if i am just debugging the code....i thought it will go thru the whole process in debug mode??

Break Off
$programpath="C:\Program Files\Pivotal\Relation\"

If Exist($programpath)

$rc = MessageBox("Please wait while Relationship is uninstalled","ESI INT'L", 10, 0, 1)

Shell 'C:\WINDOWS\uninst.exe -y -f"C:\Program Files\Pivotal\Relation\DeIsL1.isu" /passive'
Sleep 6

$rc = Shutdown("", "System is being rebooted to enable new settings.", 30, 0, 1)

Else
? $programpath + "Does not Exist"
EndIf

Top
#173351 - 2007-01-29 03:21 AM Re: ANY SAVIOUR I N HERE TODAY?? [Re: selormquarshie]
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Why would you need to run such a small snippet of code in debug? Maybe you are hitting the wrong keys.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
Page 1 of 5 12345>


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

Who's Online
0 registered and 248 anonymous users online.
Newest Members
gespanntleuchten, DaveatAdvanced, Paulo_Alves, UsTaaa, xxJJxx
17864 Registered Users

Generated in 0.086 seconds in which 0.035 seconds were spent on a total of 15 queries. Zlib compression enabled.

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