Jump to content

All Activity

This stream auto-updates     

  1. Past hour
  2. If Else Statements

    That means the program never started, and your If/Endif statement above should be able to catch that, but does nothing. Your script should either exit if the PID is zero, or retry running the program until the PID > 0
  3. Xysten, So why not approach your employer and get them to provide a proper solution rather than try to work up some Heath Robinson (or Rube Goldberg if you prefer) code? M23
  4. If Else Statements

    Updated code and got the following error.
  5. I was so curious that i logged in via VPN to have a test drive. You are totally right. When the AutoIt3.exe is stored on a turnkey file share, the network function was blocked. Stored on a local disk or even a Network Share provided by Windows server 2012 R2 , everything works! I tried to force turnkey to not use smbv1 by adding a line to conf: server min protocol = SMB2 But this didnt work. I also tried to add the server to trusted sites in IE, but neither work. So to keep it simple i copy the programm files to a Windows Server Share. By the way, only the exe and other AutoIT runtime files need to be moved. The AD UDFs and my au3 File can stay on the turnkey share for now. Thanks for the help!
  6. _RunDos

    Why?
  7. _RunDos

    Hi, I wanted to re-write the following script using the _RunDos function Run('"' & @AutoItExe & '" "' & $Path & '"') Any Help?
  8. If Else Statements

    I just realized that this will only ever work if the title of the window is "New Session Wizard" because of the WinWaitActive here. local $hWnd = WinWaitActive("[TITLE:New Session Wizard; CLASS:#32770]") If(WinGetTitle($hWnd)=="New Session Wizard") Then SessionWizzard() Else Sleep(100) send("{ENTER}") EndIf WinWaitActive won't proceed until the window title matches what you have in there. So, your whole script grinds to a halt as soon as the title changes. Try this to get the title of the window of the program you started. #include <WinAPIProc.au3> ; <<<<<<<<<<<<<<<<<<<<<<<< Add thisline Local $ConnectionClientPID = Run($CLIENT_EXECUTABLE, "", @SW_MAXIMIZE) If ($ConnectionClientPID == 0) Then ;Error(StringFormat("Failed to execute process [%s]", $CLIENT_EXECUTABLE, @error)) EndIf Local $aWnd = _WinAPI_EnumProcessWindows($ConnectionClientPID) ; <<<<<<<<<<<<<<<<< Gets the windows handle of the process you started above If (WinGetTitle($aWnd[1][0]) = "New Session Wizard") Then ; <<<<<<<<<<<<< Checks the title of the window SessionWizzard() Else Sleep(100) Send("{ENTER}") EndIf
  9. Greetings! Scroll-down to *Problem if you want to skip the mumbo-jumbo and see the actual problem. I am about a week into Auto-it and I have had a blast using it trying to solve a unique situation. Due to circumstances of my job, I am not always able to get to a PC or remember to use my phone when trying to clock in. Here are my objectives 1. Listen for device to hit network ( WiFi or BLE beacon ) 2. When beacon is detected, sign into clock-in website and enter my hard coded employee code to clock in 3. Periodically check if device is still connected to network 4. If not seen for 15 minutes, sign into website and use employee code to clock out. Now, I was able to get this working using ping and WiFi for my phone. However, I would like to be able to use this for other applications and people in the future, and since phones like to turn off WiFi during idle (and I don't think forcing WiFi on all the time is the best), I don't think this is reliable as using a BLE beacon. Here is my code for the WiFi version that works, but ultimately fails due to device specific WiFi issues. #include <IE.au3> #include <Inet.au3> //* False means Im not clocked in, true means I am Global $statusFlag = False Call ("listenForCI") //*Listens for my device until it is seen then //calls the sign in function Func listenForCI () Local $sf = $statusFlag While $sf = False Local $iPing = Ping("172.16.8.97",10000) If $iPing Then Call ("signIn") ContinueLoop EndIf WEnd EndFunc //*Listens for my device until it is no longer seen // then calls the signout function Func listenForCO () Local $sf = $statusFlag While $sf = True Local $iPing = Ping("172.16.8.97",10000) If $iPing Then ContinueLoop Else Call ("signOutCountdown") EndIf WEnd EndFunc //* Timer/failsafe that gives me a chance to get my //device back online if there is connectivity issues Func signOutCountdown () Local $iPing = Ping("172.16.8.97",10000) Sleep ( 300000 ) If $iPing Then Call ("listenForCO") Else Sleep ( 300000 ) EndIf If $iPing Then Call ("listenForCO") Else Call ("signOut") EndIf EndFunc //*this signs me into the website, submits my employee id //to clock me in then goes to a logout page, enters a password // to logout then closes IE. After IE is closed it sets a flag //that tells if Im clocked in on the website or not and calls the //function that listens if my device is still here. Func signIn () Local $oIE = _IECreate ("https://checkinwebsite/",0,1,1,1) Local $username = _IEGetObjByName ($oIE,"txtUserName") Local $password = _IEGetObjByName ($oIE,"txtPassword") Local $button = _IEGetObjByName ($oIE,"btnSubmit") _IEFormElementSetValue ($username, "myusername") _IEFormElementSetValue ($password,"mypassword") _IEAction ($button,"click") sleep (5000) Local $employeeId = _IEGetObjByName ($oIE,"tbEmployeeID") _IEFormElementSetValue ($employeeId,"myemployeeid") Send ("{ENTER}") sleep (5000) _IEFormImageClick($oIE, "btn-back.jpg", "srC") Sleep (5000) Local $fsProtpass = _IEGetObjByName ($oIE, "tbPassword") Local $doneBtn = _IEGetObjByName ($oIE, "btnDone") _IEFormElementSetValue ($fsProtpass,"mypassword") _IEAction ($doneBtn,"click") _IEQuit($oIE) Global $statusFlag = True Call ("listenForCO") EndFunc //*Similar to the signIn function but calls the //listener to wait for my device to come back online instead Func signOut () Local $oIE = _IECreate ("https://checkinwebsite/",0,1,1,1) Local $username = _IEGetObjByName ($oIE,"txtUserName") Local $password = _IEGetObjByName ($oIE,"txtPassword") Local $button = _IEGetObjByName ($oIE,"btnSubmit") _IEFormElementSetValue ($username, "myusername") _IEFormElementSetValue ($password,"mypassword") _IEAction ($button,"click") sleep (5000) Local $employeeId = _IEGetObjByName ($oIE,"tbEmployeeID") _IEFormElementSetValue ($employeeId,"myemployeeID") Send ("{ENTER}") sleep (5000) _IEFormImageClick($oIE, "btn-back.jpg", "srC") Sleep (5000) Local $fsProtpass = _IEGetObjByName ($oIE, "tbPassword") Local $doneBtn = _IEGetObjByName ($oIE, "btnDone") _IEFormElementSetValue ($fsProtpass,"mypassword") _IEAction ($doneBtn,"click") Global $statusFlag = False _IEQuit($oIE) Call ("listenForCI") EndFunc Now, this works great other than the fact that my Google Pixel likes to turn off its WiFi during lock to conserve power. I can changed this with android SDK but I will have to re-do this probably after every update and it may be different for other phone brands so ultimately I can't call this efficient for that reason. My other option, BLUETOOTH BEACONS So we are a full Meraki Stack network that is managed in house and my access points can search and see low energy Bluetooth beacons. The data is presented in a dynamic table : So the data that is important to me is "Status" ,the name of the device in "description" and for the future, the "last seen by" . My plan is to run a script to get this data every 5 minutes and keep an updated excel database. After data is pulled, I plan to one-to-many search until I find the device "LE-reserved_S" and take the "status" into account on whether or not to sign in or sign out. ***PROBLEM*** I need suggestions on the best way to get the data from the status column and shoot it to an excel spreadsheet or simple database. Why database and not just run from memory? Future proofing where more data can be kept here and presented in a different way. I'm open to all suggestions, best practices, use cases, etc and I appreciate your time. Below is more info if needed on the table. The table populates based on any device that has been sensed in a certain time period instead of just showing what devices are currently being detected (this cannot be filtered to only show detected devices). This gives me a mix of all devices but creates a possible two hour play in getting clock in or clock out times as accurate as possible. If you haven't noticed yet, Meraki Devs decided to use an image instead text for status which creates a problem when trying to write the entire table by array to an excel sheet. Just shows up blank. Here is the function for the table pull : Func signIn () Local $oIE = _IECreate ("https://mymerakidashboard/bluetoothclients",0,1,1,1) Local $username = _IEGetObjByName ($oIE,"email") Local $password = _IEGetObjByName ($oIE,"password") Local $button = _IEGetObjByName ($oIE,"commit") _IEFormElementSetValue ($username, "myusername") _IEFormElementSetValue ($password,"mypassword") _IEAction ($button,"click") sleep ( 5000 ) Local $oExcel = _Excel_Open() Local $oWorkbook = _Excel_BookNew($oExcel) Local $tables = _IETableGetCollection ( $oIE ) For $table In $tables If StringCompare ( $table.className, "filter compact fill" ) = 0 Then $tabledata = _IETableWriteToArray($table, True) _Excel_RangeWrite($oWorkbook, $oWorkbook.Activesheet, $tableData, "A1") Else ContinueLoop EndIf Next EndFunc Which gives me See, no status data showing the cells under the status collumn. Here is the code for the dynamic table I'm pulling from <table class="filter compact fill"> <colgroup> <col /> <col width="0*" /> <col /> <col /> <col /> <col /> <col /> <col /> </colgroup> <thead> <tr class="ft_head"> <th class="ft ftl checkbox nodrag checknum checkbox ftlegend c1"><input type= "checkbox" class="check_all" /></th> <th class="ft ftl status ftsortable"> <table class="lean"> <tbody> <tr class="c3"> <td class="ftlegend">Status</td> <td class="c2"></td> </tr> </tbody> </table> </th> <th class="ft ftl description ftsortable"> <table class="lean"> <tbody> <tr class="c3"> <td class="ftlegend">Description</td> <td class="c5"><img src="/images/icon_arrow_down_10x10.png" title= "Toggle sort order" alt="[Sorting down]" class="c4" /></td> </tr> </tbody> </table> </th> <th class="ft ftl ftnowrap last_seen ftsortable"> <table class="lean"> <tbody> <tr class="c3"> <td class="ftlegend">Last seen</td> <td class="c2"></td> </tr> </tbody> </table> </th> <th class="ft ftl ftnowrap last_seen_by ftsortable"> <table class="lean"> <tbody> <tr class="c3"> <td class="ftlegend"><span class="c6">Last seen by</span></td> <td class="c2"></td> </tr> </tbody> </table> </th> <th class="ft ftl oui ftsortable"> <table class="lean"> <tbody> <tr class="c3"> <td class="ftlegend">Manufacturer</td> <td class="c2"></td> </tr> </tbody> </table> </th> <th class="ft ftc outage_graph ftsortable"> <table class="lean c8"> <tbody> <tr class="c3"> <td class="c7"></td> <td class="ftlegend">Connectivity</td> <td class="c7"></td> </tr> </tbody> </table> </th> <th class="ft ftl tags ftsortable"> <table class="lean"> <tbody> <tr class="c3"> <td class="ftlegend">Tags</td> <td class="c2"></td> </tr> </tbody> </table> </th> </tr> </thead> <tbody class="flex-table-body"> <tr class="ftp0" data-idx="0"> <td class="ft notranslate checkbox nodrag checknum"><input type="checkbox" class= "row_check" />&nbsp;1</td> <td class="ft notranslate status mks-cli-wireless-on c9">&nbsp; &nbsp; &nbsp;</td> <td class="ft notranslate description"><a href= "/ABC-Main-Campus/n/GjBDmcv/manage/bluetooth_clients/574771902443332083">LE-reserved_S</a></td> <td class="ft notranslate ftnowrap">Jun 18 17:05</td> <td class="ft notranslate ftnowrap"><a href= "/ABC-Main-Campus/n/GjBDmcv/manage/nodes/list#n=149624928557424">RM15</a></td> <td class="ft notranslate oui">Bose</td> <td class="ft notranslate outage_graph ftc"> <div class="bt_connectivity_graph fill-graph c10" data-mac="2c:41:a1:59:8d:81"> </div> </td> <td class="ft notranslate tags"></td> </tr> <tr class="ftp1" data-idx="1"> <td class="ft notranslate checkbox nodrag checknum"><input type="checkbox" class= "row_check" />&nbsp;2</td> <td class="ft notranslate status mks-cli-wireless-on c9">&nbsp; &nbsp; &nbsp;</td> <td class="ft notranslate description"><a href= "/ABC-Main-Campus/n/GjBDmcv/manage/bluetooth_clients/574771902443332085">LE-Robbie's Bose Free</a></td> <td class="ft notranslate ftnowrap">Jun 18 17:06</td> <td class="ft notranslate ftnowrap"><a href= "/ABC-Main-Campus/n/GjBDmcv/manage/nodes/list#n=149624928612960">RM11</a></td> <td class="ft notranslate oui">Bose</td> <td class="ft notranslate outage_graph ftc"> <div class="bt_connectivity_graph fill-graph c10" data-mac="2c:41:a1:59:8f:af"> </div> </td> <td class="ft notranslate tags"></td> </tr> <tr class="ftp0" data-idx="2"> <td class="ft notranslate checkbox nodrag checknum"><input type="checkbox" class= "row_check" />&nbsp;3</td> <td class="ft notranslate status mks-cli-wireless-off c9">&nbsp; &nbsp; &nbsp;</td> <td class="ft notranslate description"><a href= "/ABC-Main-Campus/n/GjBDmcv/manage/bluetooth_clients/574771902443303080">Flex</a></td> <td class="ft notranslate ftnowrap">Jun 18 16:07</td> <td class="ft notranslate ftnowrap"><a href= "/ABC-Main-Campus/n/GjBDmcv/manage/nodes/list#n=13803411384454">Gym-AP</a></td> <td class="ft notranslate oui"></td> <td class="ft notranslate outage_graph ftc"> <div class="bt_connectivity_graph fill-graph c10" data-mac="d3:7b:dd:d3:4e:f3"> </div> </td> <td class="ft notranslate tags"></td> </tr> <tr class="ftp1" data-idx="3"> <td class="ft notranslate checkbox nodrag checknum"><input type="checkbox" class= "row_check" />&nbsp;4</td> <td class="ft notranslate status mks-cli-wireless-on c9">&nbsp; &nbsp; &nbsp;</td> <td class="ft notranslate description"><a href= "/ABC-Main-Campus/n/GjBDmcv/manage/bluetooth_clients/574771902443407785">Alta</a></td> <td class="ft notranslate ftnowrap">Jun 18 17:06</td> <td class="ft notranslate ftnowrap"><a href= "/ABC-Main-Campus/n/GjBDmcv/manage/nodes/list#n=13803411385997">Front Office - AP</a></td> <td class="ft notranslate oui"></td> <td class="ft notranslate outage_graph ftc"> <div class="bt_connectivity_graph fill-graph c10" data-mac="fa:36:e3:06:4b:98"> </div> </td> <td class="ft notranslate tags"></td> </tr> <tr class="ftp0" data-idx="4"> <td class="ft notranslate checkbox nodrag checknum"><input type="checkbox" class= "row_check" />&nbsp;5</td> <td class="ft notranslate status mks-cli-wireless-on c9">&nbsp; &nbsp; &nbsp;</td> <td class="ft notranslate description"><a href= "/ABC-Main-Campus/n/GjBDmcv/manage/bluetooth_clients/574771902443302716">18:93:d7:1c:09:75</a></td> <td class="ft notranslate ftnowrap">Jun 18 17:06</td> <td class="ft notranslate ftnowrap"><a href= "/ABC-Main-Campus/n/GjBDmcv/manage/nodes/list#n=149624928612960">RM11</a></td> <td class="ft notranslate oui">Texas Instruments</td> <td class="ft notranslate outage_graph ftc"> <div class="bt_connectivity_graph fill-graph c10" data-mac="18:93:d7:1c:09:75"> </div> </td> <td class="ft notranslate tags"></td> </tr> </tbody> </table> Status cell html contains either <i style="width: 50px;" class="mks-cli-wireless-on" title="online wireless client">&nbsp; &nbsp; &nbsp;</i> Which shows the device as currently detected or <i style="width: 50px;" class="mks-cli-wireless-off" title="offline wireless client">&nbsp; &nbsp; &nbsp;</i> Which shows that we have seen you in the last two hours, but don't currently see you now. Thanks for your time!
  10. Today
  11. If Else Statements

    Remove the unnecessary part, again thanks for the help completely new to AutoIT. Global Const $CLIENT_EXECUTABLE = "filepath\qws3270s.exe" ; CHANGE_ME - change if installed in different path Global Const $DISPATCHER_NAME = "QWS_Dispatcher" Global $TargetUsername = "UserID" Global $TargetPassword = "SuperSecretPassword" Global $sleep = 100 AutoItSetOption("WinTitleMatchMode", 3) ; Run exe and activate Local $ConnectionClientPID = Run($CLIENT_EXECUTABLE, "", @SW_MAXIMIZE) if ($ConnectionClientPID == 0) Then ;Error(StringFormat("Failed to execute process [%s]", $CLIENT_EXECUTABLE, @error)) EndIf local $hWnd = WinWaitActive("[TITLE:New Session Wizard; CLASS:#32770]") If(WinGetTitle($hWnd)=="New Session Wizard") Then SessionWizzard() Else Sleep(100) send("{ENTER}") EndIf ;#Acutal Login process============================================================================================================= $hWnD = WinWaitActive("[TITLE:1.1.1.1; CLASS:QWS3270S;]") if(WinGetTitle($hWnD) == "1.1.1.1")Then Sleep(1000) ;Username Sleep(1000) Send($TargetUsername) ;Password sleep(100) Send($TargetPassword) ;send Enter sleep(100) Send("{ENTER}") EndIf Func SessionWizzard() Sleep(100) Send("{tab}") Send("{tab}") Sleep(100) Send("{ENTER}") Sleep(100) send($address) sleep(100) Send("{TAB}") Send("{TAB}") sleep(100) send("{ENTER}") Send("{TAB}") Send("{TAB}") sleep(100) send("{ENTER}") Send("{TAB}") Send("{TAB}") sleep(100) send("{ENTER}") Send($address) Send("{TAB}") Send("{TAB}") send("{ENTER}") send("{ENTER}") Local $hWnD = WinWaitActive("[TITLE:Connect; CLASS:#32770]") If(WinGetTitle($hWnd)=="Connect") Then Sleep(100) send("{ENTER}") EndIf EndFunc
  12. @corgano From http://chromedriver.chromium.org/capabilities -- I haven't actually done this, so you will need to work out the correct way to implement in Autoit. I know this is possible in Firefox, but unsure if you can do this in Chrome. Please report back if you successfully find a way to do this.
  13. This may have something to do about it. Adam
  14. If Else Statements

    There's not enough of your script to identify an issue. Although, $hWnd will not have a handle in it if the window title doesn't exist, so the first part of the If statement will not work, and it should go to the Else because the window doesn't exist. This section is pointless because you would already know that the title equals Connect at that point because your WinWaitActive won't proceed if it can't find a window with that title. If (WinGetTitle($hWnd) == "Connect") Then ; <<<<<<<<<<<<<<<<<<< Sleep(100) Send("{ENTER}") EndIf ; <<<<<<<<<<<<<<<<<<<< Maybe explain where it's failing with better code that runs?
  15. Thanks for the fast reply. I didnt compiled my script. But indeed the AutoIt3.exe, the ad udf and the au3 file is stored on a Turnkey based Network drive. I try it out with a local copy tomorrow. But its strange that everything works perfectly on 1709 and all perivous builds until the automatic windows update installed the 1803 build. I will give an update tomorrow.
  16. Traytip not working in Windows 10

    I ran it, works ok for me
  17. Can someone help me out with this. I for the life of me don't have any idea why this if then else statement won't work. local $hWnd $hWnd = WinWaitActive("[TITLE:New Session Wizard; CLASS:#32770;]") If (WinGetTitle($hWnd) == "New Session Wizard")Then SessionWizzard() ; functions that go through the new session wizard this is define elsewhere in my script. Else ; Thing is this will run correctly the 1st time but after the 1st time it will not switch over to the else statement. $hWnD = WinWaitActive("[TITLE:Connect; CLASS:#32770;]") If(WinGetTitle($hWnd)=="Connect") Then Sleep(100) send("{ENTER}") EndIf EndIf
  18. i just did. that one liner i posted should produce a line appearing at the system tray, should it not? yet it does nothing.
  19. AutoItObject Pure AutoIt

    I think i understand it better. $this or $self is probably better given the name $property in getter setter function and $property.parent is then most logically comparable with self, me, this in other oo syntax.
  20. I have two questions (Chromedriver) 1: working off the example provided in the main thread, I can have it open chrome, log into a page (say google). The problem is when I re-start, it doesn't save the password or cookies so i have to log in every time. Is there a way to make user data persistant? 2: Every time I test my code it needs to open a new window. Is there a way to have it keep the same window between tests? So I can kill my script, start it, and just attach to chrome and continue on? Akin to _IE_Create() with tryattach set to 1. Basic attach if exists, else create new tab and navigate functionality.
  21. Honestly I've never encountered such a need in any development context I know of. Of course languages Lisp-based often use deep introspection but we aren't there here. Also I see no possible relationship between subprograms and your practice. Perhaps we would understand each other a bit more if you could post a real-world simple example of what you have in mind and why this way is the only solution from your point of view.
  22. Welcome @soheil1234, Wondering why you elected to post in this thread as well? Have you actually read through the thread and seen it is only some 13 years old and focused on WinXP? Jos
  23. Start VPN network connection

    hi all you can use Rasdial.exe "Connection name" username password /PHONEBOOK:"THE PBK FILE FULL PATH" this command try to connect you vpn saved on a pbk file How can create PBK File? send Rasphone.exe -f "THE PBK FILE FULL PATH" command on cmd this while show window you can create own vpn config and name and save this to disconnect: Rasdial.exe "Connection name" /DISCONNECT
  24. The comparison you make will have many exceptions and certainly I feel sleep is one of the last choices for an experienced developer. If you do GUI automation (end user testing) then the only most close way to enduser will be with active window (that's how the enduser is doing it). To easy developers say call the click event directly (having risk bypassing a disabled button) check an image exists instead of checking the actual pixels at a location (then you will observe the button is behind another image). A professional would make use of constants so when testing notepad thru GUI in different languages you can directly change it at 1 place instead of scattered around. Please also check FAQ 31 to see the other spying tools around and ways of automating thru AutoIt (FAQ 4x I believe)
  25. UIA_TextControlTypeID condition

    yes, however I do not understand the relation with getting a name property value that will not find you the element First post has all actions you can do including setvalue, setvalue using keys, sendkeys, ...... So flow is Use simplespy to give you the base source code for testing on your element First try your element to highlight and "fix" the hierarchy Then change your action to: click, setvalue, setvalue using keys, ......... Tweak the code to speed up your code (worst case fallback to the raw interfaces instead of _UIA_Action($element, "youraction")
  1. Load more activity
×