Jump to content

ProcessClose And WinKill


Recommended Posts

My Script work fine until it time to kill windows or close process don't know what wrong ... i was previously used scriptit 2.64 and work fine to close my windows... i updated my script to version 3 (because wow! very nice job on version 3.... ) and the same windows and process won't close :)

This is my script file... the command to close process are at the end thx in advance for your help dude...

i know the probleme is not from my script because i teste with only the command processclose and do nothing with the command processexists he return me the process pid everything fine...

**********************My Script File*******************************

; Sebastien Hawkins

; Créé le 26/01/2004 Mod: 2 Octobre 2004 Update To Version 3

;Autoit3 Script Pour Démarrer Et Quitter Réception (gacsr.exe)

;Ordinateur Cible: Réception Local Ou Terminal Tout les machines.

;*****************************************Début******************************************

; Déclaration Des Settings Et Variable

AutoItSetOption ( "WinWaitDelay", 500 )

AutoItSetOption ( "RunErrorsFatal", 0 )

AutoItSetOption ( "TrayIconDebug", 0 )

AutoItSetOption ( "TrayIconHide", 0 )

AutoItSetOption ( "WinDetectHiddenText", 1 )

AutoItSetOption ( "RunErrorsFatal", 0 )

AdlibEnable ( 'adlibv3', 125 )

Global $_username = @Username

;Global $_username = 'rdroite'

Global $_computername = @Computername

Global $_pf = @ProgramFilesDir

Global $_mmpath

Global $_hauteur = @DesktopHeight - 26

Global $_largeur = @DesktopWidth

Global $_x = 0 , $_y = 0

;Global $_app

adlibv3()

detectpath()

detectapps()

;************Détection du path ou se trouve l'application réception***********************

Func detectpath()

If $_username = 'reception' then

$_mmpath = '\MMSOFT\tennis'

elseif $_username = 'rgauche' then

$_mmpath = '\MMSOFTG\tennis'

elseif $_username = 'rdroite' then

$_mmpath = '\MMSOFTD\tennis'

elseif $_username = 'rcentre' then

$_mmpath = '\MMSOFTC\tennis'

else

Msgbox ( 262144, 'Lancement De MMSoft', 'Vôtre username n''a pas été trouvé.', 5 )

exit

endif

Endfunc

;************Détection des application démarré*********************

Func detectapps()

;------Detect Réception----------

If Not WinExists ( 'Réception') then

launch( 'Réception' )

else

$_msgbox = msgbox ( 262452, 'Réception Détecté', 'Voulez-Vous Quitter L''application "Réception"', 6 )

If $_msgbox = 6 then

kill ( 'Réception' )

endif

endif

;------Detect Vendeur------------

If Not WinExists ( 'Vendeur') then

launch( 'Vendeur' )

else

$_msgbox = msgbox ( 262452, 'Vendeur Détecté', 'Voulez-Vous Quitter L''application "Vendeur"', 6 )

If $_msgbox = 6 then

kill ( 'Vendeur' )

endif

endif

;------Detect Tourniquet---------

If Not WinExists ( 'Tourniquet') And $_username = 'rdroite' Or $_computername = 'rdroite' then

launch( 'Tourniquet' )

elseif $_username = 'rdroite' Or $_computername = 'rdroite' then

$_msgbox = msgbox ( 262452, 'Tourniquet Détecté', 'Voulez-Vous Quitter L''application "Tourniquet"', 6 )

If $_msgbox = 6 then

kill ( 'Tourniquet' )

endif

endif

exit

endfunc

;***********Lancement de l'application réception**********************

Func launch( $_app )

if $_app = 'Réception' then

$_exec = '\gacsr.exe'

$_execpath = '\Reception'

elseif $_app = 'Vendeur' then

$_exec = '\gacsv.exe'

$_execpath = '\Vendeur'

elseif $_app = 'Tourniquet' then

$_exec = '\gacst.exe'

$_execpath = '\Tourniquet'

endif

Run ( $_pf & $_mmpath & $_execpath & $_exec, $_pf & $_mmpath & $_execpath )

$_winwait = Winwait ( $_app, '', 5 )

if $_winwait = 0 then

fuck( $_app )

else

moving( $_app )

endif

Endfunc

;***********Moving Apps***********************************************

Func moving( $_ledeplace )

if $_ledeplace = 'Tourniquet' then

Local $_witdh = $_largeur / 2

elseif not $_ledeplace = 'tourniquet' and $_username = 'rdroite' or $_computername = 'rdroite' then

Local $_witdh = $_largeur /2

Local $_x = $_witdh

endif

Winmove ( $_ledeplace, '', $_x, $_y, $_largeur, $_hauteur )

Endfunc

;***********Fuck Le chien*********************************************

Func fuck( $_lefuckker )

$_msgbox = Msgbox ( 262198, 'Démarrage De ' & $_lefuckker, 'Un problème est survenue en tantant de démarrer ' & $_lefuckker & '!', 15 )

if $_msgbox = 2 then

exit

elseif $_msgbox = 10 then

launch ( $_lefuckker )

else

Endif

Endfunc

;**************************ADLIB**************************************

Func adLibv3()

;-------pour détecter quand l'application plante au démarrage-----

if WinExists ( 'Microsoft Visual FoxPro' ) then

Winkill ( 'Microsoft Visual FoxPro' )

MsgBox ( 262144, 'Initialisation De FoxPro', 'Recommencez s.v.p. Si _

vous revoyez ce message contactez vôtre Administrateur System.' )

EndIf

EndFunc

;****************************Close To Death**************************

Func kill ( $_tokill )

;----Association des exe avec les nom d'applications-------------

if $_tokill = 'Réception' then

$_processkill = 'gacsr.exe'

elseif $_tokill = 'Vendeur' then

$_processkill = 'gacsv.exe'

elseif $_tokill = 'Tourniquet' then

$_processkill = 'gacst.exe'

endif

;------Kill Process------

Winkill ( $_tokill )

$_processpid = ProcessExists ( $_processkill )

if $_processpid > 0 then ProcessClose ( $_processkill )

Endfunc

GreenseedMCSE+I, CCNA, A+Canada, QuebecMake Love Around You.

Link to comment
Share on other sites

Ok, i think i found the probleme... actualy this script run localy on computer and on a terminal server, i got this probleme only on the terminal server .. the function winkill try to close the windows but does not kill the application and the command processclose do not send the close command to the process maybe a security probleme.... anyone have a good idea to solve my probleme... ho yeah in the version 2.64 of autoit the command winkill work fine in the same environement.

GreenseedMCSE+I, CCNA, A+Canada, QuebecMake Love Around You.

Link to comment
Share on other sites

ok guys! thx for the help! but but probleme is now ok! i use the pskill.exe utility to close my process and it work fine! but i continue to not understand what going on with the winkill and processclose.

Bye BYe!

GreenseedMCSE+I, CCNA, A+Canada, QuebecMake Love Around You.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...