johnmahugu

python windows - clear skype history

Jun 8th, 2015
568
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.84 KB | None | 0 0
  1. """The Python/Pywin32 Script collection - Other
  2.  
  3. This simple script enables you to delete one contact history from your Skype local database.
  4.  
  5. Let's say your contact display name in Skype is 'john_mahugu'.
  6.  
  7. I'm using vacuum statement to compact database, I believe it's more secure that way."""
  8. import sqlite3
  9.  
  10. conn = sqlite3.connect('C:\\Users\\your_user_name\\AppData\\Roaming\\Skype\\skype_account_name\\main.db')
  11. c = conn.cursor()
  12.  
  13. c.execute("SELECT DISTINCT convo_id FROM Messages WHERE from_dispname = 'john_mahugu';")
  14. result = c.fetchone()
  15. if result is not None:
  16.     convo_id = int(result[0])
  17.     c.execute("DELETE FROM Messages where convo_id = {}".format(convo_id))
  18.     deleted = int(conn.total_changes)
  19.     print("Deleted: {}".format(deleted))
  20.     c.execute("VACUUM;")
  21.     print("Vacuumed...")
  22. conn.close()
  23. print("Finished")
Advertisement
Add Comment
Please, Sign In to add comment