Giulio Posted May 15, 2017 Share Posted May 15, 2017 Hi guys, just for fun I wanted to make a script to log in my ts3 server automatically this to open the ts3 client ShellExecute( "C:\Program Files\TeamSpeak 3 Client\ts3client_win64.exe" ) then insert the comination CTRL+S to open the window with the server details Send("^s") but I noticed that the script complitely stops when the client runs up (without any error from AutoIt). To have a confirm I replaced the last string with MouseClick("left", 43, 34, 1, 100) (the button "connect"). Indeed, once the client is opened, the mouse stopped at the middle of the sceen instead of going at the button. Any solution to this? Link to comment Share on other sites More sharing options...
FrancescoDiMuro Posted May 16, 2017 Share Posted May 16, 2017 Hello Giulio Did you try to check if the Window lost focus? Can you please post the script? Click here to see my signature: Spoiler ALWAYS GOOD TO READ: Forum Rules Forum Etiquette Link to comment Share on other sites More sharing options...
Giulio Posted May 16, 2017 Author Share Posted May 16, 2017 3 hours ago, FrancescoDiMuro said: Can you please post the script? ShellExecute( "C:\Program Files\TeamSpeak 3 Client\ts3client_win64.exe" ) Sleep(3000) Send("^s") Sleep(500) Send("{ENTER}") But when the client opens nothing happens 3 hours ago, FrancescoDiMuro said: Did you try to check if the Window lost focus? yes I put Sleep(3000) to let him wait 3 seconds but my pc opens the client in 1 second, during the remaining 2 seconds I tried to click manually on the top on the window to make me sure that the window had focus on So I tried to replace the send() and sleep() with the MouseClick("left", 43, 34, 1, 100) and I noticed that the mouse (with speed at 100) stopped in the middle of the screen instead of going to the 43, 34 button, when the client was fully loaded Link to comment Share on other sites More sharing options...
FrancescoDiMuro Posted May 16, 2017 Share Posted May 16, 2017 3 minutes ago, Giulio said: ShellExecute( "C:\Program Files\TeamSpeak 3 Client\ts3client_win64.exe" ) Sleep(3000) Send("^s") Sleep(500) Send("{ENTER}") But when the client opens nothing happens yes I put Sleep(3000) to let him wait 3 seconds but my pc opens the client in 1 second, during the remaining 2 seconds I tried to click manually on the top on the window to make me sure that the window had focus on So I tried to replace the send() and sleep() with the MouseClick("left", 43, 34, 1, 100) and I noticed that the mouse (with speed at 100) stopped in the middle of the screen instead of going to the 43, 34 button, when the client was fully loaded I googled "automate teamspeak login", and I found this: http://forum.teamspeak.com/threads/66422-Auto-Login Maybe could help you Click here to see my signature: Spoiler ALWAYS GOOD TO READ: Forum Rules Forum Etiquette Link to comment Share on other sites More sharing options...
Giulio Posted May 16, 2017 Author Share Posted May 16, 2017 8 minutes ago, FrancescoDiMuro said: I googled "automate teamspeak login", and I found this: http://forum.teamspeak.com/threads/66422-Auto-Login Maybe could help you alright ahah thank you Link to comment Share on other sites More sharing options...
FrancescoDiMuro Posted May 16, 2017 Share Posted May 16, 2017 Try to move the mouse in another area... It's awkward that the mouse stops in the middle of the screen. And, you could try another thing: instead of moveing the mouse, could you arrive at the Server Details with keyboard? If so, you could use ; Use $n for specify the number of times the key has to be sent Local $n = 3 Send("{TAB $n}") to "arrive" to Server Details ( maybe ) Hope that helps Click here to see my signature: Spoiler ALWAYS GOOD TO READ: Forum Rules Forum Etiquette Link to comment Share on other sites More sharing options...
Giulio Posted May 16, 2017 Author Share Posted May 16, 2017 13 minutes ago, FrancescoDiMuro said: And, you could try another thing: instead of moveing the mouse, could you arrive at the Server Details with keyboard? Yes it's CTRL+S and it doesn't work 14 minutes ago, FrancescoDiMuro said: Try to move the mouse in another area... It's awkward that the mouse stops in the middle of the screen. Everywhere I chose the mouse to go it stops when the client finish' to open Link to comment Share on other sites More sharing options...
Giulio Posted May 16, 2017 Author Share Posted May 16, 2017 Just now, Giulio said: Yes it's CTRL+S and it doesn't work (works manually) Link to comment Share on other sites More sharing options...
232showtime Posted May 16, 2017 Share Posted May 16, 2017 ShellExecute( "C:\Program Files\TeamSpeak 3 Client\ts3client_win64.exe") WinActivate("Here goes the Title of TeamSpeak") Sleep(3000) Send("^s") Sleep(500) Send("{ENTER}") or Run("C:\Program Files\TeamSpeak 3 Client\ts3client_win64.exe") Sleep(1000) WinActivate("Here goes the Title of TeamSpeak") Sleep(1000) Send("^s") Sleep(500) Send("{ENTER}") ill get to that... i still need to learn and understand a lot of codes Correct answer, learn to walk before you take on that marathon. Link to comment Share on other sites More sharing options...
Giulio Posted May 16, 2017 Author Share Posted May 16, 2017 31 minutes ago, 232showtime said: ShellExecute( "C:\Program Files\TeamSpeak 3 Client\ts3client_win64.exe") WinActivate("Here goes the Title of TeamSpeak") Sleep(3000) Send("^s") Sleep(500) Send("{ENTER}") the script still blocks when the client is loaded 32 minutes ago, 232showtime said: Run("C:\Program Files\TeamSpeak 3 Client\ts3client_win64.exe") Sleep(1000) WinActivate("Here goes the Title of TeamSpeak") Sleep(1000) Send("^s") Sleep(500) Send("{ENTER}") with Run() it doesn't open the client neither ( I had already tried before putting ShellExecute() ) Link to comment Share on other sites More sharing options...
FrancescoDiMuro Posted May 16, 2017 Share Posted May 16, 2017 @Giulio Can you do what I've suggested before? Instead of clicking function, can you go to Server Details with TABs? Click here to see my signature: Spoiler ALWAYS GOOD TO READ: Forum Rules Forum Etiquette Link to comment Share on other sites More sharing options...
Giulio Posted May 16, 2017 Author Share Posted May 16, 2017 2 minutes ago, FrancescoDiMuro said: @Giulio Can you do what I've suggested before? Instead of clicking function, can you go to Server Details with TABs? It's with CTRL+S Link to comment Share on other sites More sharing options...
Subz Posted May 16, 2017 Share Posted May 16, 2017 Just add #RequireAdmin at the top of your script it will open the server properties after that, well it does for me anyway. Link to comment Share on other sites More sharing options...
FrancescoDiMuro Posted May 16, 2017 Share Posted May 16, 2017 (edited) 27 minutes ago, Giulio said: It's with CTRL+S Fixed buddy expandcollapse popup#include <MsgBoxConstants.au3> ; Name of the process you want to launch Local $sProcess = StringReplace(@AppDataDir, "Roaming", "Local") & "\TeamSpeak 3 Client\ts3client_win64.exe" ; Store the PID of the process to launch Local $iPID = ShellExecute($sProcess, "", "", "", @SW_SHOW) ; Retrieve the list of the windows opened, hide... Local $aWinList = WinList() ; Hwnd of the process Local $hProcess = "" Do For $i = 1 To $aWinList[0][0] If $aWinList[$i][0] <> "" Then ; If the Process stored in $aWinList[$i][1] is equals to $iPID, then, assign the hWnd of the $aWinList[$i][1] to $hProcess, and ExitLoop If WinGetProcess($aWinList[$i][1]) = $iPID Then $hProcess = $aWinList[$i][1] ExitLoop EndIf EndIf Next Until $hProcess = "" ; Activate the window ( TeamSpeak 3 ) WinActivate($hProcess, "TeamSpeak 3") ; Send TAB before doing anything else Send("{TAB}", 0) ; Send CTRL + s to open Server Details, and do whatever you want :) Send("^s", 0) Hope that helps Edited May 16, 2017 by FrancescoDiMuro Click here to see my signature: Spoiler ALWAYS GOOD TO READ: Forum Rules Forum Etiquette Link to comment Share on other sites More sharing options...
Giulio Posted May 16, 2017 Author Share Posted May 16, 2017 13 minutes ago, FrancescoDiMuro said: Fixed buddy expandcollapse popup#include <MsgBoxConstants.au3> ; Name of the process you want to launch Local $sProcess = StringReplace(@AppDataDir, "Roaming", "Local") & "\TeamSpeak 3 Client\ts3client_win64.exe" ; Store the PID of the process to launch Local $iPID = ShellExecute($sProcess, "", "", "", @SW_SHOW) ; Retrieve the list of the windows opened, hide... Local $aWinList = WinList() ; Hwnd of the process Local $hProcess = "" Do For $i = 1 To $aWinList[0][0] If $aWinList[$i][0] <> "" Then ; If the Process stored in $aWinList[$i][1] is equals to $iPID, then, assign the hWnd of the $aWinList[$i][1] to $hProcess, and ExitLoop If WinGetProcess($aWinList[$i][1]) = $iPID Then $hProcess = $aWinList[$i][1] ExitLoop EndIf EndIf Next Until $hProcess = "" ; Activate the window ( TeamSpeak 3 ) WinActivate($hProcess, "TeamSpeak 3") ; Send TAB before doing anything else Send("{TAB}", 0) ; Send CTRL + s to open Server Details, and do whatever you want :) Send("^s", 0) Hope that helps Ok. I can't understand this. By the way he can't find the file Link to comment Share on other sites More sharing options...
Subz Posted May 16, 2017 Share Posted May 16, 2017 @FrancescoDiMuro - Doesn't work for me unless I add #RequireAdmin to the top of your script. The following code works for me, prefer to use ControlSend then Send: #RequireAdmin ShellExecute( "C:\Program Files\TeamSpeak 3 Client\ts3client_win64.exe" ) Local $hWnd = WinWait('TeamSpeak 3', '') ControlSend($hWnd, "", "", "^s") ControlSend($hWnd, "", "", "{ENTER}") Link to comment Share on other sites More sharing options...
FrancescoDiMuro Posted May 16, 2017 Share Posted May 16, 2017 Just now, Subz said: @FrancescoDiMuro - Doesn't work for me unless I add #RequireAdmin to the top of your script. The following code works for me, prefer to use ControlSend then Send: #RequireAdmin ShellExecute( "C:\Program Files\TeamSpeak 3 Client\ts3client_win64.exe" ) Local $hWnd = WinWait('TeamSpeak 3', '') ControlSend($hWnd, "", "", "^s") ControlSend($hWnd, "", "", "{ENTER}") This work for me, without #RequireAdmin. Click here to see my signature: Spoiler ALWAYS GOOD TO READ: Forum Rules Forum Etiquette Link to comment Share on other sites More sharing options...
Giulio Posted May 16, 2017 Author Share Posted May 16, 2017 3 minutes ago, Subz said: #RequireAdmin ShellExecute( "C:\Program Files\TeamSpeak 3 Client\ts3client_win64.exe" ) Local $hWnd = WinWait('TeamSpeak 3', '') ControlSend($hWnd, "", "", "^s") ControlSend($hWnd, "", "", "{ENTER}") this works perfectly Link to comment Share on other sites More sharing options...
FrancescoDiMuro Posted May 16, 2017 Share Posted May 16, 2017 3 minutes ago, Giulio said: @Giulio Replace this: Quote ; Name of the process you want to launch Local $sProcess = StringReplace(@AppDataDir, "Roaming", "Local") & "\TeamSpeak 3 Client\ts3client_win64.exe" with this: Quote ; Name of the process you want to launch Local $sProcess = "C:\Program Files\TeamSpeak 3 Client\ts3client_win64.exe" Click here to see my signature: Spoiler ALWAYS GOOD TO READ: Forum Rules Forum Etiquette Link to comment Share on other sites More sharing options...
Giulio Posted May 16, 2017 Author Share Posted May 16, 2017 3 minutes ago, FrancescoDiMuro said: @Giulio Replace this: with this: tried but the script still blocks when the client is open, even with #requireadmin 9 minutes ago, Subz said: #RequireAdmin ShellExecute( "C:\Program Files\TeamSpeak 3 Client\ts3client_win64.exe" ) Local $hWnd = WinWait('TeamSpeak 3', '') ControlSend($hWnd, "", "", "^s") ControlSend($hWnd, "", "", "{ENTER}") this works for me 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