r0ash Posted July 12, 2017 Posted July 12, 2017 Hi guys, I am trying to backup Skype contacts when the Skype window is minimized or machine is locked. But ControlSend is not working. However when I run program, when Skype is active & focused, same program works. #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_UseX64=n #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** $pid = Run("skype.exe") $hWnd = WinWait("[CLASS:tSkMainForm]", "", 10) WinSetState($hWnd, "", @SW_SHOW) Sleep( 1000 ) ControlSend($hWnd,"","TConversationsControl1", "!cdb") If I change WinSetState($hWnd, "", @SW_SHOW) to WinSetState($hWnd, "", @SW_MINIMIZE) The file dialog to save contact as file will never appear. Where FAQs says ControlSend() instead of Send() will work even computer is locked. Thanks for your time. P.S: I've tried to find if backing up Skype contacts violate any EULA but do not find anything. Kindly enlighten me if this post is against forum rules in any sense.
Neutro Posted July 12, 2017 Posted July 12, 2017 (edited) Hello r0ash and welcome to the AutoIT forums Skype contacts are linked to the skype account they were added to. Skype accounts details including contacts are saved in Microsoft's cloud. This means if the computer where skype is installed is completely destroyed, just setup a new computer, install skype, log in with the same skype user ID and password and the contacts will still be there. So why do you try to backup the contacts manually? Anyway if you still need to do it you just have to backup the file main.db located in %appdata%/roaming/skype/<user skype ID>/main.db It contains all contacts and all chat log. You can view what's inside with http://sqlitebrowser.org/ or any other SQL lite database viewer. Here is an example of how to backup the main.db file automaticly with AutoIT: #include <File.au3> $save_location = "C:\" ;change this to anywhere you want the file to be saved ; find the main.db in the user profile $database_filepath = _FileListToArrayrec(@UserProfileDir & "\AppData\roaming\skype", "main.db", 5, 1) if IsArray($database_filepath) Then ;if the file main.db was found then we save it $database_filepath = @UserProfileDir & "\AppData\roaming\skype\" & $database_filepath[1] filecopy($database_filepath, $save_location, 1) EndIf PS: When a computer is locked, any GUI interaction like ControlSend() will most likely fail because the Windows lock is kinda made to disable them as a security system. So it's better to use another way when you want to automate things (like the example above). Edited July 12, 2017 by Neutro r0ash 1 Identify active network connections and change DNS server - Easily export Windows network settings Clean temporary files from Windows users profiles directories - List Active Directory Groups members Export content of an Outlook mailbox to a PST file - File patch manager - IRC chat connect example Thanks again for your help Water!
r0ash Posted July 12, 2017 Author Posted July 12, 2017 Thanks a bunch mate @Neutro 2 hours ago, Neutro said: Hello r0ash and welcome to the AutoIT forums Thanks a bunch mate 2 hours ago, Neutro said: So why do you try to backup the contacts manually? My employer have comparatively large list of contacts (5000+) contacts in his list keep adding & blocking, he wants to accept new contacts automatically, thats why. 2 hours ago, Neutro said: Anyway if you still need to do it you just have to backup the file main.db located in %appdata%/roaming/skype/<user skype ID>/main.db Neat! Thanks a bunch 2 hours ago, Neutro said: PS: When a computer is locked, any GUI interaction like ControlSend() will most likely fail because the Windows lock is kinda made to disable them as a security system. So it's better to use another way when you want to automate things (like the example above). As posted under FAQs; Quote In Windows locked state applications runs hidden (behind that visible dialog) and haven't focus and active status. So generally don't use Send() MouseClick() WinActivate() WinWaitActive() WinActive() etc. Instead use ControlSend() ControlSetText() ControlClick() WinWait() WinExists() WinMenuSelectItem() etc. This way you may have your script resistive against another active windows. and it's possibe to run such script from scheduler on locked Windows station. Does this mean, its outdated? or the @Zedna got covered because he said *may*?
Neutro Posted July 12, 2017 Posted July 12, 2017 (edited) You're welcome Locked or not it's never a good idea to use control interactions as it's not very reliable. Always try to find a way to do what you want with a reliable method (command line, file copy, ect...). Use control interaction as a last resort if you really have no other way to do it Edited July 12, 2017 by Neutro r0ash 1 Identify active network connections and change DNS server - Easily export Windows network settings Clean temporary files from Windows users profiles directories - List Active Directory Groups members Export content of an Outlook mailbox to a PST file - File patch manager - IRC chat connect example Thanks again for your help Water!
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