Jump to content

tbwalker

Active Members
  • Posts

    24
  • Joined

  • Last visited

tbwalker's Achievements

Seeker

Seeker (1/7)

0

Reputation

  1. I work for a global manufacturing company that is trying to come up with cost savings. We use a lot of Microsoft O365, Adobe and AutoDesk AutoCAD Products, purchasing a large number of licenses for each on an annual subscription. We want to make sure that we aren't issuing licenses for applications, such as Adobe Acrobat DC, When users rarely, if ever, actually launch and use the applications. Since this is a cost savings initiative, the company doesn’t actually want to spend a whole lot of money on methods of auditing, so I thought I would come up with a cheap method that would log to a text file whenever a specific application was used. I would program it to look specifically for the Adobe, Microsoft, and AutoCAD applications we are paying mega bucks on licensing, then after 30 days we would collect the log files from all of the computers globally (probably have each computer automatically write the log files to a location on the domain controller when they connect to our network), And simply do a plain English windows search including content of the text log files to see which files contain activity for specific licenses. Text files with license activity would be put in a separate folder, and those text files with no license activity would be put in the folder for us to contact the users and verify directly that they are not using the application, therefore allowing us to recover license so we do not over purchase. I don’t know if this is going to work out, but it sort of the basic plan. Thanks again for your assistance
  2. Thank you all! I will give your tips a try. I really appreciate it.
  3. I'm trying to build a script that will eventually create a log with time stamps of the active windows used on a workstation throughout the day, but I'm having a problem figuring out how to actually get this information. For example, if someone has Microsoft Word open, I'd like to be able to pop-up/log "word.exe" along with the full path to that file if at all possible (sort of like seeing the application DETAILS name in Windows Task Manager and being able to right-click on the name and choose "Open FIle Location" to get the full path to the file). Is what I'm asking even possible within the realm of AutoIt? I have the below script as a test that gets me the current active window handle and title in a message box every 6 seconds, but for the life of me, I don't know what code I need to use to get the actual .EXE name/path of the active window. #include <MsgBoxConstants.au3> Local $i = 0 Do Global $handle = WinGetHandle("[ACTIVE]") Global $title = WinGetTitle("[ACTIVE]") MsgBox(0,"Active Handle & Title",$handle & " - " & $title, 3) $i = $i + 1 Sleep(3000) Until $i = 100 Any help or suggestions would be greatly appreciated. I don't mind figuring out the code myself, if someone could just point me in the right direction. Thanks, TBWalker
  4. Thank you !
  5. I just downloaded the v012b update and I must be doing something wrong. When I attempt to execute or compile it, I get a syntax error on line 41 (screenshot attached). The error appears below line 41 and reads: Local Const Enum $PortNumber, $ClientSocket, $RemoteSocket, $ProtocolState, $RemoteHost, $RemoteIP, $ContentLength, $ReceivedBytes, $RemoteClose, $Inactivity error: syntax error error: Statement cannot be just an expression. I'm running AutoIt v3.3.14.0 Any help or tips on what I might be doing wrong with the script would be greatly appreciated. Thanks, TBWalker
  6. Thanks for the link... I was afraid it was going to be something like that. I guess I'll have to keep digging for another solution to the problem.
  7. I'm trying to change the text color of a button without changing the text alignment, but I must be missing something. Here is my sample script: #include <GUIConstantsEx.au3> #include <GUIConstants.au3> #include <WindowsConstants.au3> #include <WinAPI.au3> Local $Form1 = GUICreate("button text color test", 250, 250) ;BUTTON 1 WITH NO TEXT COLOR CHANGE Local $button1 = GUICtrlCreateButton("Line 1 of text" & @CRLF & "Line 2 of text" _ & @CRLF & "Line 3 of text", 50, 10, 150, 70, BitOR($BS_MULTILINE,$BS_LEFT)) ;BUTTON 2 WITH TEXT COLOR CHANGE Local $button2 = GUICtrlCreateButton("Line 1 of text" & @CRLF & "Line 2 of text" _ & @CRLF & "Line 3 of text", 50, 100, 150, 70, BitOR($BS_MULTILINE,$BS_LEFT)) GUICtrlSetColor ( $button2, 0xCC0066 ) GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $Button1 MsgBox(0, "ControlID = " & $Button1, "Button 1 was Pressed!") Case $Button2 MsgBox(0, "ControlID = " & $Button1, "Button 2 was Pressed!") EndSwitch WEnd The top button is formatted the way I want with the text aligned to the left and vertically centered top to bottom in the button, and it contains the shaded button background. The only change made to $button2 is the extra GUICtrlSetColor ( $button2, 0xCC0066 ) below the button. It does change the text color to the desired color, but the vertical formatting and background shading are screwed up. Am I doing something wrong in my code, or is this just what will happen if I try and color text in a button? Any help or advice would be greatly appreciated. Thanks, tbwalker
  8. Oops... still learning about this XPATH stuff... the XPATH info I gave in my previous post was from FIREFOX, but what I'm trying to accomplish is in INTERNET EXPLORER... After a bit more reading I realized that the XPATH element format for IE would be different, so I found a utility ( Fire-IEBrowser.xlsm located at http://code.google.com/p/fire-ie-selenium/downloads/list ) and used it to get the XPATHs of the elements I'm trying to click. The results were, for audio on: //div[@id='ftLive']/div[10] for audio off: //div[@id='ftLive']/div[11] for the fullscreen: //div[@id='ftLive']/div[5] I'm going to keep plugging away at this. With any luck I'll be able to mark this solved by tomorrow with updated code!
  9. I installed a firefox plugin to get the unique xpaths for what I want to click: for the audio on, XPath Checker told me its XPath was: id('ftLive')/x:div[10] for audio off: id('ftLive')/x:div[11] for the fullscreen: id('ftLive')/x:div[5] I went to your IEbyXPATH link and I'm trying to get a grasp on how to click the xpaths above, but I'm a bit stumped on how to take the code you provide and try and use it to click on the xpaths I have here... I'll keep playing with it and post back if I'm able to make it work. Thanks again for your help.
  10. I took the loop out to let it click every instance, but still nothing happening. Would there be a way to click/activate the CLASS with a CONTROLCLICK? I tried the test below to see if I could get CONTROLCLICK to click it, but I'm not sure I'm formatting the command correctly, or even if this is a command that could possibly work. I didn't know which INSTANCE, if any, to tell it to click, so I took the shotgun approach. #include <Misc.au3> #include <MsgBoxConstants.au3> #include <IE.au3> Local $CameraAddress = "gc8883.myfoscam.org" Local $CameraPort = "20070" Local $CameraUsername = "user" Local $CameraPassword = "user" $oIE = _IECreate("https://" & $CameraAddress & ":" & $CameraPort);open the camera webpage _IELoadWait($oIE) ;Wait for slow page to load before continuing Local $oUserName = _IEGetObjById($oIE, "username") ;Get field name on login page to fill in Local $oPassword = _IEGetObjById($oIE, "passwd") ;Get field name on login page to fill in Local $oLogin = _IEGetObjById($oIE, "login_ok") ;Get button name to click to login _IEFormElementSetValue($oUserName, $CameraUsername) ;Set the username in the browser _IEFormElementSetValue($oPassword, $CameraPassword) ;Set the password in the browser _IEAction($oLogin, "click") ;Click the login button to continue to camera page Sleep(25000) $hWnd = WinActivate("IPCam Client - Windows Internet Explorer") $oResult = ControlClick($hWnd, "", "[CLASS:liveBtnBt5]", 1) ConsoleWrite("Result = " & $oResult & @CRLF) sleep(1000) $oResult = ControlClick($hWnd, "", "[CLASS:liveBtnBt5; INSTANCE:1]", 1) ConsoleWrite("Result = " & $oResult & @CRLF) sleep(1000) $oResult = ControlClick($hWnd, "", "[CLASS:liveBtnBt5; INSTANCE:2]", 1) ConsoleWrite("Result = " & $oResult & @CRLF) sleep(1000) $oResult = ControlClick($hWnd, "", "[CLASS:liveBtnBt5; INSTANCE:3]", 1) ConsoleWrite("Result = " & $oResult & @CRLF) sleep(1000) $oResult = ControlClick($hWnd, "", "[CLASS:liveBtnBt5; INSTANCE:4]", 1) ConsoleWrite("Result = " & $oResult & @CRLF) sleep(1000) $oResult = ControlClick($hWnd, "", "[CLASS:liveBtnBt5; INSTANCE:5]", 1) ConsoleWrite("Result = " & $oResult & @CRLF) sleep(1000) exit
  11. Thanks again jdelaney. I gave your suggestion a test drive with the code below. The console shows the "clicked..." at the end, but the video never goes full screen. #include <Misc.au3> #include <MsgBoxConstants.au3> #include <IE.au3> Local $CameraAddress = "gc8883.myfoscam.org" Local $CameraPort = "20070" Local $CameraUsername = "user" Local $CameraPassword = "user" $oIE = _IECreate("https://" & $CameraAddress & ":" & $CameraPort);open the camera webpage _IELoadWait($oIE) ;Wait for slow page to load before continuing Local $oUserName = _IEGetObjById($oIE, "username") ;Get field name on login page to fill in Local $oPassword = _IEGetObjById($oIE, "passwd") ;Get field name on login page to fill in Local $oLogin = _IEGetObjById($oIE, "login_ok") ;Get button name to click to login _IEFormElementSetValue($oUserName, $CameraUsername) ;Set the username in the browser _IEFormElementSetValue($oPassword, $CameraPassword) ;Set the password in the browser _IEAction($oLogin, "click") ;Click the login button to continue to camera page Sleep(15000) $iTimer = TimerInit() $iTimeout = 10000 While TimerDiff($iTimer )<$iTimeout $oDivs = _IETagNameGetCollection ($oIE, "div") For $oDiv in $oDivs If $oDiv.classname == "liveBtnBt5" Then ;FULLSCREEN DIV CLASS NAME MsgBox(0,"",$oDiv.classname) _IEaction($oDiv,"focus") _IEaction($oDiv,"click") ConsoleWrite("clicked..." & @CRLF) ExitLoop 2 EndIf Next WEnd I'll take your "XPATHS" suggestion and try and come up with a solution in that direction. Thanks again!
  12. Thanks for the quick reply, jdelaney. I'll give that _ieaction(,"focus") a test run now.
  13. I've been working on a test script for a Foscam FI9821w v2 camera to automatically open the web url of the camera, log in with the username and password, and shortcut map the UP,DOWN,LEFT,RIGHT controls. The only thing I'm having issues with are clicking the AUDIO and FULL SCREEN buttons once the main camera page has been reached. The reason I'm building this code is to simplify camera operations for my grandmother, so all she has to do is launch the autoit application and use the arrow keys to move her front door security camera. Here's the code I have so far. I've put in an actual working URL with a working username and password (demo camera provided by Foscam's website), so you can see the code actually work. #include <Misc.au3> #include <MsgBoxConstants.au3> #include <IE.au3> Local $CameraAddress = "gc8883.myfoscam.org" Local $CameraPort = "20070" Local $CameraUsername = "user" Local $CameraPassword = "user" Local $hDLL = DllOpen("user32.dll") ;getting ready for the _IsPressed Loop below WaitForIP($CameraAddress) ;This function pauses here until the camera can be pinged $oIE = _IECreate("https://" & $CameraAddress & ":" & $CameraPort);open the camera webpage _IELoadWait($oIE) ;Wait for slow page to load before continuing Local $oUserName = _IEGetObjById($oIE, "username") ;Get field name on login page to fill in Local $oPassword = _IEGetObjById($oIE, "passwd") ;Get field name on login page to fill in Local $oLogin = _IEGetObjById($oIE, "login_ok") ;Get button name to click to login _IEFormElementSetValue($oUserName, $CameraUsername) ;Set the username in the browser _IEFormElementSetValue($oPassword, $CameraPassword) ;Set the password in the browser _IEAction($oLogin, "click") ;Click the login button to continue to camera page While 1 If _IsPressed("26", $hDLL) Then ;Up Arrow Key Press CamUp() ElseIf _IsPressed("28", $hDLL) Then ;Down Arrow Key Press CamDown() ElseIf _IsPressed("25", $hDLL) Then ;Left Arrow Key Press CamLeft() ElseIf _IsPressed("27", $hDLL) Then ;Right Arrow Key Press CamRight() ElseIf _IsPressed("1B", $hDLL) Then ;{ESC} exits this app and closes browser CloseApp() EndIf Sleep(100) WEnd Func WaitForIP($sIP) ;Don't continue with this app until it can ping camera Do Sleep(250) ; Give the CPU a break Until ping($sIP) <> 0 EndFunc Func CloseApp() ProcessClose("iexplore.exe") DllClose($hDLL) exit EndFunc Func CamUp() $oIE = _IECreate("https://" & $CameraAddress & ":" & $CameraPort & "/cgi-bin/CGIProxy.fcgi?cmd=ptzMoveUp&usr=" & $CameraUsername & "&pwd=" & $CameraPassword, 0, 0, 1, 0) _IEQuit($oIE) ;Up Arrow Key is pressed, Sleep While _IsPressed("26", $hDLL) Sleep(250) WEnd $oIE = _IECreate("https://" & $CameraAddress & ":" & $CameraPort & "/cgi-bin/CGIProxy.fcgi?cmd=ptzStopRun&usr=" & $CameraUsername & "&pwd=" & $CameraPassword, 0, 0, 1, 0) _IEQuit($oIE) EndFunc Func CamDown() $oIE = _IECreate("https://" & $CameraAddress & ":" & $CameraPort & "/cgi-bin/CGIProxy.fcgi?cmd=ptzMoveDown&usr=" & $CameraUsername & "&pwd=" & $CameraPassword, 0, 0, 1, 0) _IEQuit($oIE) ;Down Arrow Key is pressed, Sleep While _IsPressed("28", $hDLL) Sleep(250) WEnd $oIE = _IECreate("https://" & $CameraAddress & ":" & $CameraPort & "/cgi-bin/CGIProxy.fcgi?cmd=ptzStopRun&usr=" & $CameraUsername & "&pwd=" & $CameraPassword, 0, 0, 1, 0) _IEQuit($oIE) EndFunc Func CamLeft() $oIE = _IECreate("https://" & $CameraAddress & ":" & $CameraPort & "/cgi-bin/CGIProxy.fcgi?cmd=ptzMoveLeft&usr=" & $CameraUsername & "&pwd=" & $CameraPassword, 0, 0, 1, 0) _IEQuit($oIE) ;Left Arrow Key is pressed, Sleep While _IsPressed("25", $hDLL) Sleep(250) WEnd ;Left Arrow Key is released $oIE = _IECreate("https://" & $CameraAddress & ":" & $CameraPort & "/cgi-bin/CGIProxy.fcgi?cmd=ptzStopRun&usr=" & $CameraUsername & "&pwd=" & $CameraPassword, 0, 0, 1, 0) _IEQuit($oIE) EndFunc Func CamRight() $oIE = _IECreate("https://" & $CameraAddress & ":" & $CameraPort & "/cgi-bin/CGIProxy.fcgi?cmd=ptzMoveRight&usr=" & $CameraUsername & "&pwd=" & $CameraPassword, 0, 0, 1, 0) _IEQuit($oIE) ;Right Arrow Key is pressed, Sleep While _IsPressed("27", $hDLL) Sleep(250) WEnd ;Right Arrow Key is released $oIE = _IECreate("https://" & $CameraAddress & ":" & $CameraPort & "/cgi-bin/CGIProxy.fcgi?cmd=ptzStopRun&usr=" & $CameraUsername & "&pwd=" & $CameraPassword, 0, 0, 1, 0) _IEQuit($oIE) EndFunc Here's a screenshot of the (2) buttons I would like to click: I've tried the following code to click the buttons, but nothing happens: $oDivs = _IETagNameGetCollection ($oIE, "div") For $oDiv in $oDivs If $oDiv.classname == "liveBtnBt9" Then MsgBox(0,"",$oDiv.classname) _IEaction($oDiv,"click") ExitLoop EndIf Next I've messed around with forcing the browser full screen, then mapping mouse clicks to the buttons. This sort of works, but it's not reliable if there's a delay in the page loading (mouse clicks before buttons actually load). Since the above camera address is live, you can actually see the HTML I'm trying to click. Neither of the DIV class buttons have ID's, and the FULL SCREEN div button has only a CLASS. Audio On Button: <div class="liveBtnBt9" name="active"></div> Full Screen Button <div class="liveBtnBT5"></div> If anyone could help point me in a better direction for how to automate clicking these 2 buttons, it would be greatly appreciated. I've searched the forum for every article on clicking DIV's with no ID's or NAME's, but nothing I've found so far actually works. Thanks, TBWalker
  14. Thanks for the tips MBALZESHARI and FUBAR. I use CCleaner regularly and I think it’s great. The issue is definitely hardware related (new clean image recently deployed house wide). I was about to post a message here explaining the details of my IT situation, but it started to turn into a research paper. Instead of boring you with that, I’ll just give you the bullet points of my situation. Our company is aware that over 70% of our computers are dying due to capacitor/motherboard thermal failure 60 days ago we deployed a new/clean base XP image to all 500+ workstation to help improve performance. Positive feedback was given from all users. A performance increase of 30%-40% was reported from all departments. All workstations are on a domain and managed by group policy, restricting users from installing new software, locking external storage devices and restricting internet access to all but about 10% of the workstations Our IT department gets about 30-40 support calls a day, with at least 10-15 of the calls being related to the failing hardware and temporarily fixed by a simple reboot Management is aware that the computer workstations need to be replaced, but management is also stating that we cannot afford to purchase new computer until 4th quarter (220+ days from now). Management knows that the only thing we can do on these overheating/dying machines is to simply reboot them every few days to keep them in running order… Note: It sucks being an IT guy who is at the mercy of management and is being told to “RIG” the dying equipment as best as possible and limp along for the next 220+ days…. Whew… that being said… the 30% of the workstations that do not have motherboard/thermal problems run beautifully on the new base image for weeks on end ( I have some that haven’t been rebooted in 60+ days). The other 70% run great for 3-5 days… then start acting up until they are rebooted. Management wont allow me to simply mandate to the staff that they need to reboot every 2-3 days (management wanting to hide the problem from the general employee population... par for the course...). I hoped to come up with a stop-gap/automated method to reboot these machines during specific down-time conditions in order to keep them running well (or at least running until they completely die)… The reboot conditions I’d like to create a script execute a reboot under are: If the computer has been up and running for over 48 hours. If the computer has NO USER currently logged. If the current time on the computer is between 1am-4am (our slowest time). Again… I know and agree with ever one of you that this is a unprofessional, bubble-gum/duct tape solution that should never be used as a true solution, but this is the situation I am in, and in lieu of being allowed to take the professional route and bulk replace these dying computers, rebooting is currently my only recourse. wow.... it feels good getting that off of my chest... I think I just saved myself a visit to the therapist....
  15. DicatoroftheUSA, you are absolutely correct about computer malfunctioning. Let’s just say that the company I work for is aware of the problem and has kicked back to the users the need to limp along with problems/issues for a few more months. The auto-reboot idea is simply a stop-gap, Band-Aid solution to alleviate some of the user’s pains (granted, it is an unprofessional solution, but, hey, I’m just a minion of the corporate machine that I work for). If I can document my efforts to alleviate some of the pain suffered by users, while at the same time documenting the reasons for my stop-gap solution, I’ll have covered my bases and insured future employment…. ;-) Kylomas, THANKS FOR THE TIP! I’ll be playing with your code this morning…. I really appreciate it!
×
×
  • Create New...