jcaspar Posted November 13, 2006 Posted November 13, 2006 [ b]Hello ! I do this script put seems not to function well could you tell me where is my mistake please .. Thanks a lot for your advices ! Jean Marc #NoTrayIcon runasset("administrateur",@Computername," xxxx") Break(0) FileSetAttrib("C:\ocs-ng", "-R", 1) DirRemove("C:\ocs-ng", 1) If WinExists("Installation de OCS Inventory Agent 4.0.2.6","Uninstall OCS INVENTORY SERVICE ?")then Opt("WinTitleMatchMode",2) ; Partial Title Match WinSetState("Installation de OCS Inventory Agent 4.0.2.6", "Uninstall OCS INVENTORY SERVICE ?", @SW_HIDE) Send("{tab}") Send("{ENTER}") exit EndIf If WinExists("Installation de OCS Inventory Agent 4.0.2.6","")then Opt("WinTitleMatchMode",2) ; Partial Title Match WinSetState("Installation de OCS Inventory Agent 4.0.2.6", "", @SW_HIDE) Send("{ENTER}") Opt("WinTitleMatchMode",2) ; Partial Title Match WinSetState("Installation de OCS Inventory Agent 4.0.2.6", "", @SW_HIDE) sleep(1000) Send("{ENTER}") opt("WinTitleMatchMode",2) ; Partial Title Match WinSetState("Installation de OCS Inventory Agent 4.0.2.6", "", @SW_HIDE) sleep(1000) Send("{tab}") sleep(1000) ControlSend("Installation de OCS Inventory Agent 4.0.2.6", "","1204", "nas-dd68") sleep(1000) Send("{ENTER}") Opt("WinTitleMatchMode",2) ; Partial Title Match WinSetState("Installation de OCS Inventory Agent 4.0.2.6", "", @SW_HIDE) sleep(1000) Send("{ENTER}") Opt("WinTitleMatchMode",2) ; Partial Title Match WinSetState("Installation de OCS Inventory Agent 4.0.2.6", "", @SW_HIDE) sleep(1000) Send("{ENTER}") Opt("WinTitleMatchMode",2) ; Partial Title Match WinSetState("Installation de OCS Inventory Agent 4.0.2.6", "", @SW_HIDE) Send("{ENTER}") Opt("WinTitleMatchMode",2) ; Partial Title Match WinSetState("Installation de OCS Inventory Agent 4.0.2.6", "", @SW_HIDE) EndIf
Uten Posted November 13, 2006 Posted November 13, 2006 What is the nature of your problem(How fare does the script run before it does unexpected things)? From experience you should check @error and @extended after RunAsSet. Please keep your sig. small! Use the help file. Search the forum. Then ask unresolved questions :) Script plugin demo, Simple Trace udf, TrayMenuEx udf, IOChatter demo, freebasic multithreaded dll sample, PostMessage, Aspell, Code profiling
herewasplato Posted November 13, 2006 Posted November 13, 2006 ...could you tell me where is my mistake please ...Like Uten said, without knowing where it fails, it might be hard to comment on your code... but here are some comments in general:If you are having trouble, comment out this line like so:;#NoTrayIconand add a line like this, once - near the top:AutoItSetOption("TrayIconDebug", 1)That will allow you to mouse-over the AutoIt icon in the system tray and see what line it has stopped on... although, in the case of your code, I suspect that the icon might just flash by - if the desired windows are not present when the code is run.Unless there is more to the script than you posted, this line:runasset("administrateur",@Computername," xxxx")is of no value - unless I missed something.The help file says that RunAsSet will, "Initialise a set of user credentials to use during Run and RunWait operations." I do not see any Run or RunWait operations in the code that you posted.You might need a WinWait before each of your "WinExists" lines:If WinExists("Installation de OCS Inventory Agent 4.0.2.6","Uninstall OCS INVENTORY SERVICE ?")thenYou only need this line once in your script - near the topOpt("WinTitleMatchMode",2) ; Partial Title MatchUsing "Send" on a hidden window might not be the best thing - if another window happens to take focus, that window will receive what you meant to send to your hidden window. Look into the ControlSend function.Did you mean to have "exit" here?Send("{tab}")Send("{ENTER}")exitEndIfMake a few changes and then post back if it still does not work for you... [size="1"][font="Arial"].[u].[/u][/font][/size]
jcaspar Posted November 13, 2006 Author Posted November 13, 2006 Thanks a lot for your advices ! Is great now i can use autoit like a debugger !I modify some ...it's better but mmm not totallyquestions what is the good way to exit the application ?here is my code modyfied ....Thansk for all your help !Jean Marc;#NoTrayIconAutoItSetOption("TrayIconDebug", 1)Opt("WinTitleMatchMode",2) ; Partial Title Matchrunasset("administrateur",@Computername,"*****")Break(0) FileSetAttrib("C:\ocs-ng", "-R", 1)DirRemove("C:\ocs-ng", 1)Run("OcsAgentSetup.exe", "", @SW_HIDE);If WinExists("Installation de OCS Inventory Agent 4.0.2.6","Uninstall OCS INVENTORY SERVICE ?") thenif WinWait("Installation de OCS Inventory Agent 4.0.2.6","Uninstall OCS INVENTORY SERVICE ?", 5)thenWinSetState("Installation de OCS Inventory Agent 4.0.2.6", "Uninstall OCS INVENTORY SERVICE ?", @SW_HIDE)sleep(1000)Send("{ENTER}")sleep(1000)if WinWait("Installation de OCS Inventory Agent 4.0.2.6","?", 5)thenWinSetState("Installation de OCS Inventory Agent 4.0.2.6", "", @SW_HIDE)exitEndIfWinWait("Installation de OCS Inventory Agent 4.0.2.6", "", 5);If WinExists("Installation de OCS Inventory Agent 4.0.2.6","")then WinSetState("Installation de OCS Inventory Agent 4.0.2.6", "", @SW_HIDE)Send("{ENTER}")WinSetState("Installation de OCS Inventory Agent 4.0.2.6", "", @SW_HIDE);sleep(1000)Send("{ENTER}")WinSetState("Installation de OCS Inventory Agent 4.0.2.6", "", @SW_HIDE);sleep(1000)Send("{tab}");sleep(1000)ControlSend("Installation de OCS Inventory Agent 4.0.2.6", "","1204", "nas-dd68");sleep(1000)Send("{ENTER}")WinSetState("Installation de OCS Inventory Agent 4.0.2.6", "", @SW_HIDE);sleep(1000)Send ("{ENTER}")WinSetState("Installation de OCS Inventory Agent 4.0.2.6", "", @SW_HIDE);sleep(1000)Send("{ENTER}")WinSetState("Installation de OCS Inventory Agent 4.0.2.6", "", @SW_HIDE)Send("{ENTER}")WinSetState("Installation de OCS Inventory Agent 4.0.2.6", "", @SW_HIDE)EndIfLike Uten said, without knowing where it fails, it might be hard to comment on your code... but here are some comments in general:If you are having trouble, comment out this line like so:;#NoTrayIconand add a line like this, once - near the top:AutoItSetOption("TrayIconDebug", 1)That will allow you to mouse-over the AutoIt icon in the system tray and see what line it has stopped on... although, in the case of your code, I suspect that the icon might just flash by - if the desired windows are not present when the code is run.Unless there is more to the script than you posted, this line:runasset("administrateur",@Computername," xxxx")is of no value - unless I missed something.The help file says that RunAsSet will, "Initialise a set of user credentials to use during Run and RunWait operations." I do not see any Run or RunWait operations in the code that you posted.You might need a WinWait before each of your "WinExists" lines:If WinExists("Installation de OCS Inventory Agent 4.0.2.6","Uninstall OCS INVENTORY SERVICE ?")thenYou only need this line once in your script - near the topOpt("WinTitleMatchMode",2) ; Partial Title MatchUsing "Send" on a hidden window might not be the best thing - if another window happens to take focus, that window will receive what you meant to send to your hidden window. Look into the ControlSend function.Did you mean to have "exit" here?Send("{tab}")Send("{ENTER}")exitEndIfMake a few changes and then post back if it still does not work for you...
AzKay Posted November 13, 2006 Posted November 13, 2006 Thanks a lot for your advices ! Is great now i can use autoit like a debugger !I modify some ...it's better but mmm not totallyquestions what is the good way to exit the application ?here is my code modyfied ....Thansk for all your help !Jean Marc;#NoTrayIconAutoItSetOption("TrayIconDebug", 1)Opt("WinTitleMatchMode",2) ; Partial Title Matchrunasset("administrateur",@Computername,"*****")Break(0) FileSetAttrib("C:\ocs-ng", "-R", 1)DirRemove("C:\ocs-ng", 1)Run("OcsAgentSetup.exe", "", @SW_HIDE);If WinExists("Installation de OCS Inventory Agent 4.0.2.6","Uninstall OCS INVENTORY SERVICE ?") thenif WinWait("Installation de OCS Inventory Agent 4.0.2.6","Uninstall OCS INVENTORY SERVICE ?", 5)thenWinSetState("Installation de OCS Inventory Agent 4.0.2.6", "Uninstall OCS INVENTORY SERVICE ?", @SW_HIDE)sleep(1000)Send("{ENTER}")sleep(1000)if WinWait("Installation de OCS Inventory Agent 4.0.2.6","?", 5)thenWinSetState("Installation de OCS Inventory Agent 4.0.2.6", "", @SW_HIDE)exitEndIfWinWait("Installation de OCS Inventory Agent 4.0.2.6", "", 5);If WinExists("Installation de OCS Inventory Agent 4.0.2.6","")then WinSetState("Installation de OCS Inventory Agent 4.0.2.6", "", @SW_HIDE)Send("{ENTER}")WinSetState("Installation de OCS Inventory Agent 4.0.2.6", "", @SW_HIDE);sleep(1000)Send("{ENTER}")WinSetState("Installation de OCS Inventory Agent 4.0.2.6", "", @SW_HIDE);sleep(1000)Send("{tab}");sleep(1000)ControlSend("Installation de OCS Inventory Agent 4.0.2.6", "","1204", "nas-dd68");sleep(1000)Send("{ENTER}")WinSetState("Installation de OCS Inventory Agent 4.0.2.6", "", @SW_HIDE);sleep(1000)Send ("{ENTER}")WinSetState("Installation de OCS Inventory Agent 4.0.2.6", "", @SW_HIDE);sleep(1000)Send("{ENTER}")WinSetState("Installation de OCS Inventory Agent 4.0.2.6", "", @SW_HIDE)Send("{ENTER}")WinSetState("Installation de OCS Inventory Agent 4.0.2.6", "", @SW_HIDE)EndIfIt would exit at the end by itself. # MY LOVE FOR YOU... IS LIKE A TRUCK- #
herewasplato Posted November 13, 2006 Posted November 13, 2006 (edited) Thanks a lot for your advices ! Is great now i can use autoit like a debugger ! I modify some ...it's better but mmm not totally questions what is the good way to exit the application ? here is my code modyfied .... Thansk for all your help ! Jean Marc...Using "Exit" is okay to exit the script as long as that is what you wanted. Now that I've spend a bit more time with your code, I see now that having "Exit" where you put it makes sense. I also see that I may have pointed you in the wrong direction with the first WinWait suggestion. I see now that you are attempting to deal with two windows that might show up. If the "uninstall window" shows up, you want to do a few things and then exit the script... if a different window comes up, you want to do several more things before exiting the script. [if the above guess is wrong - then the code below makes little sense.] You want to stay away from having to use Sleep to get the script to wait for the screens to appear. You are better off using WinWait and some unique "window text" for each window of interest... something like this: WinWait("Installation de OCS Inventory Agent 4.0.2.6", "some text here") WinSetState("Installation de OCS Inventory Agent 4.0.2.6", "some text here", @SW_HIDE) Send("{ENTER}") WinWait("Installation de OCS Inventory Agent 4.0.2.6", "unique text") WinSetState("Installation de OCS Inventory Agent 4.0.2.6", "unique text", @SW_HIDE) Send("{ENTER}") You would also do well to move away from "Send" and move towards ControlSend. Here is some code for you to try:expandcollapse popup;#NoTrayIcon ;Break(0) Opt("TrayIconDebug", 1) Opt("WinTitleMatchMode", 2) ; Partial Title Match FileSetAttrib("C:\ocs-ng", "-R", 1) DirRemove("C:\ocs-ng", 1) RunAsSet("administrateur", @ComputerName, "*****") Run("OcsAgentSetup.exe", "", @SW_HIDE) While 1 ;this screen may come up - could use the adlib function If WinExists("Installation de OCS Inventory Agent 4.0.2.6", "Uninstall OCS INVENTORY SERVICE ?") Then WinSetState("Installation de OCS Inventory Agent 4.0.2.6", "Uninstall OCS INVENTORY SERVICE ?", @SW_HIDE) Sleep(1000) Send("{ENTER}") Sleep(1000) Exit ;if "uninstall" - then exit the entire script EndIf Sleep(100) ;prevent CPU load ;or this screen may come up ;you must add unique window text If WinExists("Installation de OCS Inventory Agent 4.0.2.6", "") Then ;you must add unique window text WinSetState("Installation de OCS Inventory Agent 4.0.2.6", "", @SW_HIDE) Send("{ENTER}") ExitLoop EndIf WEnd WinSetState("Installation de OCS Inventory Agent 4.0.2.6", "", @SW_HIDE) ;sleep(1000) Send("{ENTER}") WinSetState("Installation de OCS Inventory Agent 4.0.2.6", "", @SW_HIDE) ;sleep(1000) Send("{TAB}") ;sleep(1000) ControlSend("Installation de OCS Inventory Agent 4.0.2.6", "", "1204", "nas-dd68") ;sleep(1000) Send("{ENTER}") WinSetState("Installation de OCS Inventory Agent 4.0.2.6", "", @SW_HIDE) ;sleep(1000) Send("{ENTER}") WinSetState("Installation de OCS Inventory Agent 4.0.2.6", "", @SW_HIDE) ;sleep(1000) Send("{ENTER}") WinSetState("Installation de OCS Inventory Agent 4.0.2.6", "", @SW_HIDE) Send("{ENTER}") WinSetState("Installation de OCS Inventory Agent 4.0.2.6", "", @SW_HIDE)Edit: or maybe I have to entire premise wrong... Edit2: moved some code comments around Edited November 13, 2006 by herewasplato [size="1"][font="Arial"].[u].[/u][/font][/size]
jcaspar Posted November 14, 2006 Author Posted November 14, 2006 Waouuuu ! Thanks a lot for the code !Well i still have the problem that the first windows is visibleso the problem seems to be in the red codei try to modify my code function well just the first window that appear In fact if i use to times the programm it will ask for desinstall soif this windows appear i want to the programm to exitif is the normal window it follow the process.I want to hide all because i want to use this autoitscript for many users( 100)it's better they don't see ...well i think it's a script very interesting to realize because after you can know how to hidethe complete process ..Thanks a lot for the great advices, tricks and code you gave to me ! ;cache l'infobulle;#NoTrayIcon;permet le debogageOpt("WinTitleMatchMode",2) ; Partial Title MatchAutoItSetOption("TrayIconDebug", 1);demarrage avec les droits administrateursrunasset("administrateur",@Computername,"zorglub22");ne rien afficher pour l'utilisateurBreak(0) ;;supprimer le répertoire ocs-ngFileSetAttrib("C:\ocs-ng", "-R", 1)DirRemove("C:\ocs-ng", 1)Run("OcsAgentSetup.exe", "", @SW_HIDE)If WinExists("Installation de OCS Inventory Agent 4.0.2.6","Uninstall OCS INVENTORY SERVICE ?") Then Send("{tab}") Send("{ENTER}") EndIfWinWaitActive("Installation de OCS Inventory Agent 4.0.2.6")If WinExists("Installation de OCS Inventory Agent 4.0.2.6","") Then WinSetState("Installation de OCS Inventory Agent 4.0.2.6", "", @SW_HIDE);si la fenetre existe;If WinExists("Installation de OCS Inventory Agent 4.0.2.6") Then; enterSend("{ENTER}")WinSetState("Installation de OCS Inventory Agent 4.0.2.6", "", @SW_HIDE);attente 1000 millisecondessleep(1000);enterSend("{ENTER}")WinSetState("Installation de OCS Inventory Agent 4.0.2.6", "", @SW_HIDE);attente 1000 millisecondessleep(1000);tabSend("{tab}")WinSetState("Installation de OCS Inventory Agent 4.0.2.6", "", @SW_HIDE);attente 1000 millisecondessleep(1000);taper nas-dd68Send("nas-dd68");ControlSend("Installation de OCS Inventory Agent 4.0.2.6", "","1204", "nas-dd68")WinSetState("Installation de OCS Inventory Agent 4.0.2.6", "", @SW_HIDE);entersleep(1000)Send("{ENTER}")WinSetState("Installation de OCS Inventory Agent 4.0.2.6", "", @SW_HIDE);attente 1000 millisecondessleep(1000);enterSend("{ENTER}")WinSetState("Installation de OCS Inventory Agent 4.0.2.6", "", @SW_HIDE);attente 1000 millisecondessleep(1000);enterSend("{ENTER}")WinSetState("Installation de OCS Inventory Agent 4.0.2.6", "", @SW_HIDE)EndIf
herewasplato Posted November 14, 2006 Posted November 14, 2006 ...Run("OcsAgentSetup.exe", "", @SW_HIDE)If WinExists("Installation de OCS Inventory Agent 4.0.2.6","Uninstall OCS INVENTORY SERVICE ?") Then......The way you have it written now, the "Run" line of code executes and then the "If WinExists" line of code checks for the window just milliseconds later. Long before the "uninstall window" has ever had a chance to appear. You may want to loop like my code does. That loop continually checks for either of the two possible windows.... BUT, you must understand the concept of being able to uniquely identifying each window that you want to act on in order to use that loop. Do not leave the text field blank for the two "If WinExists" lines of code within that While/WEnd loop.WinExists ( "title", "text")You have "Uninstall OCS ..." as the window text for one of the "If WinExists" lines of code, but you need something in the next "If WinExists" line... some text that is unique to the window you want to check.Add that to the code that I posted, run that code and post your results. [size="1"][font="Arial"].[u].[/u][/font][/size]
MHz Posted November 14, 2006 Posted November 14, 2006 (edited) Here is a suggestion to your code. You should always be sure that the window is active before using Send so I have addressed that. A function does all the repeating code and adlib can take care of your uninstall window if it pops up. expandcollapse popup;cache l'infobulle ;#NoTrayIcon ;permet le debogage Opt("WinTitleMatchMode", 2) ; Partial Title Match AutoItSetOption("TrayIconDebug", 1) ;demarrage avec les droits administrateurs RunAsSet("administrateur", @ComputerName, "zorglub22") ;ne rien afficher pour l'utilisateur Break(0) ; ;supprimer le répertoire ocs-ng FileSetAttrib("C:\ocs-ng", "-R", 1) DirRemove("C:\ocs-ng", 1) AdlibEnable("_Adlib") Run("OcsAgentSetup.exe", "", @SW_HIDE) If WinWait("Installation de OCS Inventory Agent 4.0.2.6", "", 60) Then WinMove("Installation de OCS Inventory Agent 4.0.2.6", "", 0, @DesktopWidth) AdlibDisable() ;si la fenetre existe ;If WinExists("Installation de OCS Inventory Agent 4.0.2.6") Then ; enter _WinSend("{ENTER}") ;enter _WinSend("{ENTER}") ;tab _WinSend("{TAB}") ;taper nas-dd68 _WinSend("nas-dd68") ;ControlSend("Installation de OCS Inventory Agent 4.0.2.6", "","1204", "nas-dd68") ;enter _WinSend("{ENTER}") ;enter _WinSend("{ENTER}") ;enter _WinSend("{ENTER}") EndIf Exit Func _WinSend($send) Local $title = "Installation de OCS Inventory Agent 4.0.2.6" Sleep(1000) If WinWait($title, "", 60) Then If Not WinActive($title) Then WinActivate($title) EndIf If WinWaitActive($title, "", 10) Then Send($send) Return True EndIf EndIf EndFunc Func _Adlib() If WinExists("Installation de OCS Inventory Agent 4.0.2.6", "Uninstall OCS INVENTORY SERVICE ?") Then Send("{tab}{ENTER}") EndIf EndFunc Edit: repaired UDF with missing parameter and Send function. Edit: WinWaitActive adjustment in UDF Edited November 15, 2006 by MHz
jcaspar Posted November 15, 2006 Author Posted November 15, 2006 Hello ! Thanks a lot for this code ! I still have two problems ... i think to be able to use the functions we need to type Call("_Winsend", "{ENTER}") or i get an error message after i use this i don't get message error but the program doesn't do his job .... so there's still something wrong ...but we are very near ! I ll search on my side if i find ill send the answer ... Thanks to all people that gives advices and tricks ! Jean Marc I modyfied like this : ;cache l'infobulle ;#NoTrayIcon ;permet le debogage Opt("WinTitleMatchMode", 2) ; Partial Title Match AutoItSetOption("TrayIconDebug", 1) ;demarrage avec les droits administrateurs RunAsSet("administrateur", @ComputerName, "zorglub22") ;ne rien afficher pour l'utilisateur Break(0) ; ;supprimer le répertoire ocs-ng FileSetAttrib("C:\ocs-ng", "-R", 1) DirRemove("C:\ocs-ng", 1) AdlibEnable("_Adlib") Run("OcsAgentSetup.exe", "", @SW_HIDE) If WinWait("Installation de OCS Inventory Agent 4.0.2.6", "", 60) Then WinMove("Installation de OCS Inventory Agent 4.0.2.6", "", 0, @DesktopWidth) AdlibDisable() ;si la fenetre existe ;If WinExists("Installation de OCS Inventory Agent 4.0.2.6") Then ; enter Call("_Winsend", "{ENTER}") sleep(2000) ;entrer Call("_Winsend", "{ENTER}") sleep(2000);tab Call("_Winsend", "{TAB}") sleep(2000);taper nas-dd68 Call("_Winsend", "nas-dd68") sleep(2000) Call("_Winsend", "{ENTER}") sleep(2000);enter Call("_Winsend", "{ENTER}") sleep(2000);enter Call("_Winsend", "{ENTER}") EndIf Exit Func _WinSend() Local $title = "Installation de OCS Inventory Agent 4.0.2.6" Sleep(2000) If WinWait($title, "", 60) Then If Not WinActive($title) Then WinActivate($title) If WinWaitActive($title, "", 10) Then Return True EndIf EndIf EndIf EndFunc Func _Adlib() If WinExists("Installation de OCS Inventory Agent 4.0.2.6", "Uninstall OCS INVENTORY SERVICE ?") Then Send("{tab}{ENTER}") EndIf EndFunc
MHz Posted November 15, 2006 Posted November 15, 2006 (edited) Oh sorry, check the code in my last post again. I left the send and parameter out of the function by mistake but it is updated now. Edit: another small fix. Should be ok now. Edited November 15, 2006 by MHz
jcaspar Posted November 20, 2006 Author Posted November 20, 2006 Hello ! Thanks a lot for this new version of the code but i still have the problem the programm doesn't run the installation .... If you have an idea will be great lol ! Because really i don't see why ... Thanks to all of you Jean Marc
Uten Posted November 20, 2006 Posted November 20, 2006 Could you try to explain what this code fragment is supposed to do? Call("_Winsend", "{ENTER}") sleep(2000);enter Call("_Winsend", "{ENTER}") EndIf Exit Func _WinSend() Local $title = "Installation de OCS Inventory Agent 4.0.2.6" Sleep(2000) If WinWait($title, "", 60) Then If Not WinActive($title) Then WinActivate($title) If WinWaitActive($title, "", 10) Then Return True EndIf EndIf EndIf EndFunc The code is a lot easier to read if you do som kind of indenting and use the autoit tags (The A3 button in the forum editor) Please keep your sig. small! Use the help file. Search the forum. Then ask unresolved questions :) Script plugin demo, Simple Trace udf, TrayMenuEx udf, IOChatter demo, freebasic multithreaded dll sample, PostMessage, Aspell, Code profiling
Pfex Posted November 20, 2006 Posted November 20, 2006 A bit unrelated to the post content itself... please consider using the "[ autoit ]" "[ /autoit ] tag in your posts. Syntax highlighting makes reading the code so much easier, at least for newcomers like me, and getting a reply might be easier.
dandymcgee Posted November 20, 2006 Posted November 20, 2006 Yes, indenting would be very helpful... I can't read anything you've posted, it's a big jumbled mess. Maybe using SciTe's tidy? - Dan [Website]
MHz Posted November 21, 2006 Posted November 21, 2006 Thanks a lot for this new version of the code but i still have the problem the programm doesn't run the installation .... Which code are you using to get the problem? Your code that Uten shows will not work. Look at the code that I posted previously to see the difference.
Uten Posted November 21, 2006 Posted November 21, 2006 (edited) Which code are you using to get the problem? Your code that Uten shows will not work. Look at the code that I posted previously to see the difference.It is a copy/paste from jcaspars code, so don't blame me Edited November 21, 2006 by Uten Please keep your sig. small! Use the help file. Search the forum. Then ask unresolved questions :) Script plugin demo, Simple Trace udf, TrayMenuEx udf, IOChatter demo, freebasic multithreaded dll sample, PostMessage, Aspell, Code profiling
jcaspar Posted November 21, 2006 Author Posted November 21, 2006 Hello ! You have reason thisi function seems to be the cause of the problem the goal of this script is ! : if the window "Installation de OCS Inventory Agent 4.0.2.6", "Uninstall OCS INVENTORY SERVICE ?" appears the application ends if not the application do the action enter,tab etc ... Just i would like that the users don't see the windows open and close. ( Hide all the execution ) The function _Winsend seems not to function ...if you have some new ideas ... Thanks a lot for all your advices Jean Marc expandcollapse popup;cache l'infobulle ;#NoTrayIcon ;permet le debogage Opt("WinTitleMatchMode", 2) ; Partial Title Match AutoItSetOption("TrayIconDebug", 1) ;demarrage avec les droits administrateurs RunAsSet("administrateur", @ComputerName, "zorglub22") ;ne rien afficher pour l'utilisateur Break(0) ; ;supprimer le répertoire ocs-ng FileSetAttrib("C:\ocs-ng", "-R", 1) DirRemove("C:\ocs-ng", 1) AdlibEnable("_Adlib") Run("OcsAgentSetup.exe", "", @SW_HIDE) If WinWait("Installation de OCS Inventory Agent 4.0.2.6", "", 60) Then WinMove("Installation de OCS Inventory Agent 4.0.2.6", "", 0, @DesktopWidth) AdlibDisable() ;si la fenetre existe ;If WinExists("Installation de OCS Inventory Agent 4.0.2.6") Then ; enter [color=#FF0000]Call("_WinSend", "{ENTER}") sleep(1000) ;entrer Call("_WinSend", "{ENTER}") sleep(1000);tab Call("_WinSend", "{TAB}") sleep(1000);taper nas-dd68 Call("_WinSend", "nas-dd68") sleep(1000) Call("_WinSend", "{ENTER}") sleep(1000);enter Call("_WinSend", "{ENTER}") sleep(1000);enter Call("_WinSend", "{ENTER}")[/color] EndIf [color=#FF0000]Func _WinSend() Local $title = "Installation de OCS Inventory Agent 4.0.2.6" Sleep(1000) If WinWait($title, "", 60) Then If Not WinActive($title) Then WinActivate($title) If WinWaitActive($title, "", 10) Then Return True EndIf EndIf EndIf[/color] EndFunc Func _Adlib() If WinExists("Installation de OCS Inventory Agent 4.0.2.6", "Uninstall OCS INVENTORY SERVICE ?") Then Send("{tab}{ENTER}") EndIf EndFunc
MHz Posted November 21, 2006 Posted November 21, 2006 Add exit into the adlib code. Try this code expandcollapse popup;cache l'infobulle ;#NoTrayIcon ;permet le debogage Opt("WinTitleMatchMode", 2) ; Partial Title Match AutoItSetOption("TrayIconDebug", 1) ;demarrage avec les droits administrateurs RunAsSet("administrateur", @ComputerName, "zorglub22") ;ne rien afficher pour l'utilisateur Break(0) ; ;supprimer le répertoire ocs-ng FileSetAttrib("C:\ocs-ng", "-R", 1) DirRemove("C:\ocs-ng", 1) AdlibEnable("_Adlib") Run("OcsAgentSetup.exe", "", @SW_HIDE) If WinWait("Installation de OCS Inventory Agent 4.0.2.6", "", 60) Then WinMove("Installation de OCS Inventory Agent 4.0.2.6", "", 0, @DesktopWidth) AdlibDisable() _WinSend("{ENTER}") _WinSend("{ENTER}") _WinSend("{TAB}") ;taper nas-dd68 _WinSend("nas-dd68") _WinSend("{ENTER}") _WinSend("{ENTER}") _WinSend("{ENTER}") EndIf Exit Func _WinSend($send) Local $title = "Installation de OCS Inventory Agent 4.0.2.6" Sleep(1000) If WinWait($title, "", 60) Then If Not WinActive($title) Then WinActivate($title) EndIf If WinWaitActive($title, "", 10) Then Send($send) Else Exit 1 EndIf EndIf EndFunc Func _Adlib() If WinExists("Installation de OCS Inventory Agent 4.0.2.6", "Uninstall OCS INVENTORY SERVICE ?") Then Send("{TAB}{ENTER}") Exit EndIf EndFunc
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now