Raith Posted June 4, 2015 Share Posted June 4, 2015 I viewed through the FAQ but couldn't find how I could post the code properly, can someone help? That's the first question I suppose.Second question is that I have this phone system for my work where we have to log into everyday and during breaks we have to press some buttons to "pause" it so we don't get calls (like a DND). It is a virtual IP communicator, and I have been trying to write a program to automate the clicking and such. Whenever we leave our desk, we usually lock our machines, so I was doing a combination of _isPressed commands and ControlClicks, if there's a good way of showcasing my code, can someone let me know? I'm hitting some kind of issues and I was wondering if there is a better and efficient way of writing the script to do my task.Thanks, in advance. Link to comment Share on other sites More sharing options...
abberration Posted June 4, 2015 Share Posted June 4, 2015 On the text formatting bar, there is an icon that looks like <>. Click it and a pop-up will allow you to paste code. I don't know if this still works since the forum has been updated, but you also could post it with the following:[autoit] Code goes here [/autoit]One hint, check to see if the software you are trying to control supports hotkeys such as CTRL + some key to pause they system. If so, that will make your job easier. Easy MP3 | Software Installer | Password Manager Link to comment Share on other sites More sharing options...
Raith Posted June 5, 2015 Author Share Posted June 5, 2015 (edited) Awesome! The program doesn't support it (I'm using Cisco Agent if you're interested in how I am automating it). Here's the code (the [autoit][/autoit] doesn't seem to be working?):[autoit]#include <Misc.au3>Local $hDLL = DllOpen("user32.dll")while 1 If _IsPressed("41", $hDLL) And _IsPressed("53", $hDLL) Then ;keys are pressed;Clicks on Agent for NotReady StatusControlClick("Ready - Cisco Agent Desktop","","XTPToolBar2","left",1,106,19)WinExists("Select Reason for Not Ready")ControlSend("Select Reason for Not Ready","","SysListView321","Send({DOWN 3})")EndIfWEnd[/autoit]Let me break it down:[autoit] If _IsPressed("41", $hDLL) And _IsPressed("53", $hDLL) Then ;keys are pressed[/autoit]I will change the above (right now it is just for testing so I don't need to lock my PC all the time) to CTRL (L or R) + L to lock my machine.[autoit] ControlClick("Ready - Cisco Agent Desktop","","XTPToolBar2","left",1,106,19) [/autoit]It pulls the agent box and goes to a set coordinate so it will click into the "Not Ready" button, it's a literally a button, but using the Windows Tool, it shows that it is one part of the segment of the entire program.[autoit]WinExists("Select Reason for Not Ready") [/autoit]Just was using to determine if the click was successful because it launches a new box that can be moved around. It is a popup.[autoit]ControlSend("Select Reason for Not Ready","","SysListView321","Send({DOWN 3})") [/autoit]Here is where I am hitting the problem, I am using ControlSend and I am not sure if I am doing it correctly. The new popup, I can drag it around, etc, but AutoIt does not "snap" onto this, the coordinates constantly change so this is why I am not doing a ControlClick. The popup also gives me a bunch of selections and an OK button, but I cannot get to the correct selection due to the dynamic coordinates, and everyone's computer is different meaning they could drag the box elsewhere too.The selections are something like a 1, 2, 3 list, however, it sometimes, when I click on "a" + "s" together, it snaps to the Agent, click onto the NotReady button, but does not send the down arrow 3 times to my selection. I'm doing this modularly, but if there is a more effective way, I'd love to learn it.Thanks again, whoever is reading. I'm just learning through trial and error a lot of the times. Edited June 5, 2015 by Raith Link to comment Share on other sites More sharing options...
nitekram Posted June 5, 2015 Share Posted June 5, 2015 I am not sure of what you are trying to do, but if you are trying to get a box/window that shows up everywhere (different places for different users)...the way I deal with it is, find that window, get the coordinates of its location, save those, move the box to where you know where it is, do whatever you need to do, move the box back to where it was. I have also found the blocking the keyboard and mouse during this process, helps with it not getting messed up in the process. 2¢ All by me:"Sometimes you have to go back to where you started, to get to where you want to go." "Everybody catches up with everyone, eventually" "As you teach others, you are really teaching yourself." From my dad "Do not worry about yesterday, as the only thing that you can control is tomorrow." WIKI | Tabs; | Arrays; | Strings | Wiki Arrays | How to ask a Question | Forum Search | FAQ | Tutorials | Original FAQ | ONLINE HELP | UDF's Wiki | AutoIt PDF AutoIt Snippets | Multple Guis | Interrupting a running function | Another Send StringRegExp | StringRegExp Help | RegEXTester | REG TUTOR | Reg TUTOT 2 AutoItSetOption | Macros | AutoIt Snippets | Wrapper | Autoit Docs SCITE | SciteJump | BB | MyTopics | Programming | UDFs | AutoIt 123 | UDFs Form | UDF Learning to script | Tutorials | Documentation | IE.AU3 | Games? | FreeSoftware | Path_Online | Core Language Programming Tips Excel Changes ControlHover.UDF GDI_Plus Draw_On_Screen GDI Basics GDI_More_Basics GDI Rotate GDI Graph GDI CheckExistingItems GDI Trajectory Replace $ghGDIPDll with $__g_hGDIPDll DLL 101? Array via Object GDI Swimlane GDI Plus French 101 Site GDI Examples UEZ GDI Basic Clock GDI Detection Ternary operator Link to comment Share on other sites More sharing options...
Raith Posted June 5, 2015 Author Share Posted June 5, 2015 I am not sure of what you are trying to do, but if you are trying to get a box/window that shows up everywhere (different places for different users)...the way I deal with it is, find that window, get the coordinates of its location, save those, move the box to where you know where it is, do whatever you need to do, move the box back to where it was. I have also found the blocking the keyboard and mouse during this process, helps with it not getting messed up in the process.Pretty much automate a way when the workstation is locked, does X, Y, and Z. The smaller window can move anywhere and autoit is not snapping to it whereas the overall window is fine. I'm not understanding why. Link to comment Share on other sites More sharing options...
SadBunny Posted June 5, 2015 Share Posted June 5, 2015 May be off-topic, but IIRC the Cisco Agent Administrator supports setting hotkeys for all kinds of actions. Ever looked into that? Roses are FF0000, violets are 0000FF... All my base are belong to you. Link to comment Share on other sites More sharing options...
nitekram Posted June 5, 2015 Share Posted June 5, 2015 I know that I have issues with some apps, not able get to the window or control I need when the work station is locked. Since it looks like you are using a hotkey (not windows) to lock work station, maybe before actually locking the work station, it performs the tasks first and then continues to the lock out? 2¢ All by me:"Sometimes you have to go back to where you started, to get to where you want to go." "Everybody catches up with everyone, eventually" "As you teach others, you are really teaching yourself." From my dad "Do not worry about yesterday, as the only thing that you can control is tomorrow." WIKI | Tabs; | Arrays; | Strings | Wiki Arrays | How to ask a Question | Forum Search | FAQ | Tutorials | Original FAQ | ONLINE HELP | UDF's Wiki | AutoIt PDF AutoIt Snippets | Multple Guis | Interrupting a running function | Another Send StringRegExp | StringRegExp Help | RegEXTester | REG TUTOR | Reg TUTOT 2 AutoItSetOption | Macros | AutoIt Snippets | Wrapper | Autoit Docs SCITE | SciteJump | BB | MyTopics | Programming | UDFs | AutoIt 123 | UDFs Form | UDF Learning to script | Tutorials | Documentation | IE.AU3 | Games? | FreeSoftware | Path_Online | Core Language Programming Tips Excel Changes ControlHover.UDF GDI_Plus Draw_On_Screen GDI Basics GDI_More_Basics GDI Rotate GDI Graph GDI CheckExistingItems GDI Trajectory Replace $ghGDIPDll with $__g_hGDIPDll DLL 101? Array via Object GDI Swimlane GDI Plus French 101 Site GDI Examples UEZ GDI Basic Clock GDI Detection Ternary operator Link to comment Share on other sites More sharing options...
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