r4b1dm0nk3y
Active Members-
Posts
31 -
Joined
-
Last visited
r4b1dm0nk3y's Achievements
Seeker (1/7)
0
Reputation
-
Check available keypress options
r4b1dm0nk3y replied to r4b1dm0nk3y's topic in AutoIt General Help and Support
Hey guys, I figured everything out. I just needed to add sleep() command between each _WinWaitActivate() and each Send() command. I set sleep if about 2 seconds and that worked like a charm on my VM's and physical machines. I added several other functions to the script to check service status, start if stopped, set startup type and other error checking features. AutoIT seems somewhat elementary to the many, but perhaps revolutionary to us noob's. Thank you for all your help with this. I learned a lot in this thread and from many other threads while researching. Sometimes silence of others is the greatest is the motivator. -
Check available keypress options
r4b1dm0nk3y replied to r4b1dm0nk3y's topic in AutoIt General Help and Support
My current issue is still about key strokes. I was just clarifying on what you said earlier. To recap the keystroke issue: Keystrokes work on physical machine(s), both on my workstation and on another physical workstation. On my test VM's the keystrokes execute way too fast and do not do anything, even with sleep times of up to 1second in between each command. -
Check available keypress options
r4b1dm0nk3y replied to r4b1dm0nk3y's topic in AutoIt General Help and Support
I see. So this is pretty much not going to help me if I'm compiling as x86. In other works if I want to use x86 or x64 I can choose to either 1, compile two versions, one to run on each architecture or 2. detect the os type and execute the function (each func configured to run on respective architecture), like I am doing now. Correct? Or is there another alternative that I am missing? -
Check available keypress options
r4b1dm0nk3y replied to r4b1dm0nk3y's topic in AutoIt General Help and Support
I think he is referencing my issue with @ProgramFilesDir not working correctly on x64 machine with the #AutoIt3Wrapper_UseX64=N directive. -
Check available keypress options
r4b1dm0nk3y replied to r4b1dm0nk3y's topic in AutoIt General Help and Support
@Spiff59, I appreciate you suggestion of googleing the problem. I have done just that and did not find a suitable solution that would work for my environment, so (with some assistance) I created one. Reg hacks and other 'dirty' options will not work for me. In my environment the McAfee services, files and registry settings are protected from manipulation. Connecting to McAfee console's via a remote machine is inefficient, I need to do changes in mass. The whole point of this script is to take the manual process out of the equation and to manipulate the machines in a clean, controlled and reliable manner. Using other means could cause potentially cause unwanted results. -
Check available keypress options
r4b1dm0nk3y replied to r4b1dm0nk3y's topic in AutoIt General Help and Support
Any ideas folks? I should mention that the machine I'm testing on is a VM where the keypresses are not functioning properly. I think that is the issue. I tried the script on another physical machine this afternoon and it ran with no issues. Is there any recommendation for configuring a script to run on a VM? It seems the VM is running through the key presses too fast. I put sleep time of up to 1second and it did not solve the problem. -
Check available keypress options
r4b1dm0nk3y replied to r4b1dm0nk3y's topic in AutoIt General Help and Support
SciTE Version 2.27 Jun 24 2011 17:46:25 by Neil Hodgson. Updated: Valik & Jos -
Check available keypress options
r4b1dm0nk3y replied to r4b1dm0nk3y's topic in AutoIt General Help and Support
Yes, I have SciTE4AutoIt3. -
Check available keypress options
r4b1dm0nk3y replied to r4b1dm0nk3y's topic in AutoIt General Help and Support
After much searching, trial and error, I figured out how to read a file then execute task. My script is working well except the key commands on the console portion. The script key commands work on my machine(compiled as .exe), but not on on the test machine of the same architecture (compiled as .exe). The console opens, then the ALT key is pressed and that seems about it. Any ideas what the problem could be? -
Check available keypress options
r4b1dm0nk3y replied to r4b1dm0nk3y's topic in AutoIt General Help and Support
@guinness, I copied the code directly as you put, saved it and ran the script. My MsgBox output was "C:Program Files" on Win7 x64 SP1 machine. -
Check available keypress options
r4b1dm0nk3y replied to r4b1dm0nk3y's topic in AutoIt General Help and Support
I'll give it another try. It hasn't worked for me in the past. I've added a section to uninstall an agent then loop to check when the completion notice comes up and close it out so the script can continue. That seems to be working fine but my key stroke actions, which happen after the loop, to unlock the console don't work anymore. The console will appear and then it looks like the commands are all sent at once but nothing happens (I can see the alt key being pressed, then the menus looks like its "strobes" superfast). I'm not sure how else to explain it. Can you look at my code and see if you can find anything wrong with it? #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Icon=C:UsersStaffDownloadsepo (2).ico #AutoIt3Wrapper_UseX64=n #AutoIt3Wrapper_Add_Constants=n #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** ; --- Change log --- Version 2 --- ; v1 - Detect OS archirecture then execute function. Setup keypresses to unlock interface ; v2 - Setup script to deltect if console is locked or unlock, then choose action to complete process. ; v2.2 - Fixed if..elseif..else syntax issues ; v2.4 - Experiment with ControlCommand() parameters ; v2.6 - Experiment with ControlGetText(), WinMenuSelectItem() and ControlFocua() commands ; v2.8 - Removed if..elseif..else statement and added keypresses to lock the console first. This fixed the initial issue where the script hangs if console is ; already unlocked. Added BlockInput()command to avoid user input stopping the script in process ; v3 - Added commands to uninstall McAfee ePO Agent ; v3.2 - Added loop to check when McAfee Agent is finished uninstalling, Added "Opt("TrayAutoPause", 0)" to stop script from auto pausing. ; v3.4 - Added "Return 0" or "ExitLoop" to exit ePO "While 1" loop, otherwiswe the script never ends ; ; ; ---- Detect System OS Architecture ---- ; This section check if the OS is running x86 or x64 bit Windows. If the machine detect x86 or x64 OS it will execute ; commands for that Windows version. x86 will execute programs from C:Program Files and x64 will execute ; programs from C:Program Files (x86). Opt("TrayAutoPause", 0) ; Stops script from auto pausing Opt("TrayIconDebug", 1) ; Output's debug info BlockInput(1) ; Lock keyboard and mouse inputs to avoid interference Switch @OSArch Case "x86" ; Do stuff for x86 _x86() Case "x64" ; Do stuff for x64 _x64() Case Else MsgBox(16, "Error", "Unhandled case: CPU architecture not recognized." & @CRLF & "Please notify your system administrator!") Exit EndSwitch Func _x86() ; Code to be executed on x86 machines #region ---Au3Recorder generated code Start --- Opt("WinWaitDelay",100) Opt("WinDetectHiddenText",1) Opt("MouseCoordMode",0) ; ---- Uninstall McAfee ePO Agent ---- ; This section will uninstall McAfee ePO Agent via program ; execution, then use keyboard (Enter) to close completion dialogue Run('"C:Program FilesMcAfeeCommon Frameworkfrminst.exe" /forceuninstall') ; Runs McAfee ePO agent uninstall While 1 ; Loop until window appears If WinExists("McAfee Agent", "OK") Then _WinWaitActivate("McAfee Agent","") Send("{ENTER}") ; Closes the "McAfee Agent Setup completed successfully" dialogue Sleep (100) ExitLoop Else Sleep (100) EndIf WEnd ; ---- Disable McAfee Access Protection ---- ; This section will run McAfee VirusScan Console to disable Access Protection via program ; execution, then using keyboard (ALT + <key>) Run('C:Program FilesMcAfeeVirusScan Enterprisemcconsol.exe') ; Opens McAfee console _WinWaitActivate("VirusScan Console","") Send("{ALTDOWN}ol{ALTUP}") ; Locks console if it is unlocked _WinWaitActivate("VirusScan Console","") Send("{ALTDOWN}on{ALTUP}") ; Unlocks console _WinWaitActivate("Login","The user interface i") Send("<password_here>") ; Enters password to unlock console _WinWaitActivate("VirusScan Console","") Send("{F4}") ; Stops highlighted feature _WinWaitActivate("VirusScan Console","") Send("{ALTDOWN}ol{ALTUP}") ; Locks console _WinWaitActivate("VirusScan Console","") Send("{ALTDOWN}{F4}{ALTUP}") ; Closes McAfee Console #region --- Internal functions Au3Recorder Start --- #endregion --- Internal functions Au3Recorder End --- #endregion --- Au3Recorder generated code End --- EndFunc ;==>_x86 Func _x64() ; Code to be executed on x64 machines #region ---Au3Recorder generated code Start --- Opt("WinWaitDelay",100) Opt("WinDetectHiddenText",1) Opt("MouseCoordMode",0) ; ---- Uninstall McAfee ePO Agent ---- ; This section will uninstall McAfee ePO Agent via program ; execution, then use keyboard (Enter) to close completion dialogue Run('"C:Program Files (x86)McAfeeCommon Frameworkfrminst.exe" /forceuninstall') ; Runs McAfee ePO agent uninstall While 1 ; Loop until window appears If WinExists("McAfee Agent", "OK") Then _WinWaitActivate("McAfee Agent","") Send("{ENTER}") ; Closes the "McAfee Agent Setup completed successfully" dialogue Sleep (100) ExitLoop Else Sleep (100) EndIf WEnd ; ---- Disable McAfee Access Protection ---- ; This section will run McAfee VirusScan Console to disable Access Protection via program ; execution, then using keyboard (ALT + <key>) Run('C:Program Files (x86)McAfeeVirusScan Enterprisemcconsol.exe') ; Opens McAfee console _WinWaitActivate("VirusScan Console","") Send("{ALTDOWN}ol{ALTUP}") ; Locks console if it is unlocked _WinWaitActivate("VirusScan Console","") Send("{ALTDOWN}on{ALTUP}") ; Unlocks console _WinWaitActivate("Login","The user interface i") Send("<password_here>") ; Enters password to unlock console _WinWaitActivate("VirusScan Console","") Send("{F4}") ; Stops highlighted feature _WinWaitActivate("VirusScan Console","") Send("{ALTDOWN}ol{ALTUP}") ; Locks console _WinWaitActivate("VirusScan Console","") Send("{ALTDOWN}{F4}{ALTUP}") ; Closes McAfee Console #region --- Internal functions Au3Recorder Start --- #endregion --- Internal functions Au3Recorder End --- #endregion --- Au3Recorder generated code End --- EndFunc ;==>_x64 Func _WinWaitActivate($title,$text,$timeout=0) WinWait($title,$text,$timeout) If Not WinActive($title,$text) Then WinActivate($title,$text) WinWaitActive($title,$text,$timeout) EndFunc BlockInput(0); Unlock keyboard and mouse inputs On another front, I need to check if the agent is installed. I want to try to do that by opening a file and checking for a string.. If present execute agent uninstall else unlock console using the run and while = 1 sections from above. I need to read "C:ProgramDataMcAfeeCommon FrameworkSiteList.xml" then check for "epo_server" Any ideas? I know I need to use _FileReadArray(). I started out with this code but it keeps erroring out. Msgbox responds with 0, so I take it the string is not being found. #include <File.au3> Dim $aResult Global $File = "C:ProgramDataMcAfeeCommon FrameworkSiteList.xml" If Not _FileReadToArray($File, $aResult) Then MsgBox(4096, @ScriptName, "There was an error reading file!") Exit EndIf For $x = 1 To $aResult[0] $Result = StringInStr($aResult[$x], "epo_server", 0) MsgBox(0, @ScriptName, $Result) Next ; Uninstall script here EndIf WEnd Thanks to all for your help and input this far. -
Check available keypress options
r4b1dm0nk3y replied to r4b1dm0nk3y's topic in AutoIt General Help and Support
I tested it out and doesn't work that way. I have the #AutoIt3Wrapper_UseX64=N declaration and with @ProgramFilesDir the script would not runon an x64 machine. I could define the variables as guinness did and that might do the the trick. -
Check available keypress options
r4b1dm0nk3y replied to r4b1dm0nk3y's topic in AutoIt General Help and Support
Yeah, I understand that, what I didn't understand was what Blue_Drache and Melba23 were saying, but I got it now. @ProgramFilesDir does not work for what I need to do on x64 machines. @ProgramFilesDir references "c:program files" on both x86 and x64 machines. I am not able to use that function because I need to reference "c:program files" and "c:program files (x86)" on x86 and x64 respectively. -
Check available keypress options
r4b1dm0nk3y replied to r4b1dm0nk3y's topic in AutoIt General Help and Support
I don't understand what that means. Does this mean that using " #AutoIt3Wrapper_UseX64=N" would not be of benefit to use in my script? Edit: Nevermind about above question. I figured out what you guys were talking about. -
Check available keypress options
r4b1dm0nk3y replied to r4b1dm0nk3y's topic in AutoIt General Help and Support
If I use #AutoIt3Wrapper_UseX64=N the script is compiles for x86 correct? If so do I even need to detect the architecture then? If I'm referencing the same function in each 'case' its kind of superfluous it seems. Also, the windows variable %programfiles% opens "c:program files" regardless of OS architecture (not "c:program files (x86)" on a x64 machine), wouldn't the same thing happen with the @ProgramFilesDir variable? Or would @ProgramFilesDir be similar to using %programfiles% on x86 machines and %programfiles(x86)% on x64 machines?