Author Topic: Find my phone  (Read 6204 times)

0 Members and 1 Guest are viewing this topic.

lanos

  • Jr. Member
  • **
  • Posts: 9
  • Karma: 1
    • View Profile
Find my phone
« on: July 11, 2016, 12:50:58 AM »
Been using VC for little while now and finally did something I think is worth contributing
I recently found out that if your PC and phone are signed into the same google/gmail account and you google search I lost my phone from the PC you can not only locate your phone but have your PC make it ring. Now I for one lose my phone all the time,  bed, car, couch, that one time it was in the fridge, so i figured why not have VC help me out.
I probably over complicated it (It worked that was good enough I guess) but i made a command that makes it so all you have to do is say something like "I can't find my phone" and VC makes your phone ring.
Problem with the whole "lost my phone" thing on google is the first time you run it or if haven't run it in a while or you've run it to much google makes you re-sign in for security. so my way around that is to make VC sign into google every time BEFORE it goes to the lost my phone search that way the search doesn't ask u to log in. Now I have this working (for now) on two PC's but that doesn't mean I did it right so no guarantees but here's the xml I'm using. Just log into google with IExplorer/Robo and have it set to stay logged in on that PC (that way when you go to the login page again all it'll ask for is the password not the email) then put you google password in the password spot on the xml and you should be all set
If anybody else finds an easier/less complicated way to pull this off please post

Code: [Select]
<?xml version="1.0" encoding="utf-16"?>
<!--VoxCommando 2.2.1.7-->
<command id="315" name="Lost phone" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
  <action>
    <cmdType>RoboB.Show</cmdType>
    <params />
    <cmdRepeat>0</cmdRepeat>
  </action>
  <action>
    <cmdType>RoboB.Wait</cmdType>
    <params />
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>RoboB.Navigate</cmdType>
    <params>
      <param>google.com</param>
    </params>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>RoboB.Wait</cmdType>
    <params />
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>RoboB.ElementByTag</cmdType>
    <params>
      <param>A</param>
      <param>26</param>
    </params>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>RoboB.Wait</cmdType>
    <params />
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>RoboB.Click</cmdType>
    <params />
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>RoboB.Wait</cmdType>
    <params />
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>RoboB.ElementByTag</cmdType>
    <params>
      <param>INPUT</param>
      <param>16</param>
    </params>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>RoboB.Wait</cmdType>
    <params />
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>RoboB.Wait</cmdType>
    <params />
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>SendKeys</cmdType>
    <params>
      <param>YOUR PASSWORD HERE</param>
    </params>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>RoboB.Wait</cmdType>
    <params />
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>RoboB.Wait</cmdType>
    <params />
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>RoboB.ElementByID</cmdType>
    <params>
      <param>signIn</param>
    </params>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>RoboB.Click</cmdType>
    <params />
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>RoboB.Navigate</cmdType>
    <params>
      <param>https://www.google.com/?gws_rd=ssl#q=i+lost+my+phone</param>
    </params>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>RoboB.Wait</cmdType>
    <params />
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>RoboB.Wait</cmdType>
    <params />
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>RoboB.ElementByTag</cmdType>
    <params>
      <param>DIV</param>
      <param>334</param>
    </params>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>RoboB.Wait</cmdType>
    <params />
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>RoboB.Click</cmdType>
    <params />
    <cmdRepeat>1</cmdRepeat>
  </action>
  <phrase>where's my phone, find my phone, no clue where my phone is, </phrase>
</command>

NightSpeed

  • Jr. Member
  • **
  • Posts: 35
  • Karma: 0
    • View Profile
Re: Find my phone
« Reply #1 on: July 11, 2016, 09:04:02 PM »
Will test and get back Thank you :D

NightSpeed

  • Jr. Member
  • **
  • Posts: 35
  • Karma: 0
    • View Profile
Re: Find my phone
« Reply #2 on: July 11, 2016, 09:42:00 PM »
For me once I logged in it displayed a location of where my phone was pinged to but nothing as far as a call. I will keep testing.

For some odd reason its routing to my google drive and then routs it to the find my phone
« Last Edit: July 11, 2016, 09:57:23 PM by NightSpeed »

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7714
  • Karma: 116
    • View Profile
    • VoxCommando
Re: Find my phone
« Reply #3 on: July 12, 2016, 10:16:29 AM »
This command did not work for me.

I think different users may get different results depending on what country you are in and maybe which operating system you are using.  You may also see different things depending on how your google account(s) are set up.

A few things you did wrong or could do better though.

First, you should always start your commands which use RoboB with a RoboB.Select action.  This is an error to leave it out.

The rest is more down to what's the best method as opposed to being right or wrong.  The first potential problem is that you are using a web search as your URL instead of going directly to the correct URL and this may be part of why your command does not work for other users.  As far as I can tell you can navigate directly to https://www.google.com/android/devicemanager and if you are logged in it's pretty easy to use after that.

The other problem is that when you use RoboB.ElementByTag with A 26 you can get very unpredictable results if the page changes or if you end up on a different page because it will just select the 26th link on the page.  If the element you are trying to target does not have a unique name or ID then it is usually better to use RegEx.

Here's my command for doing it this way, assuming you are logged in:
Code: [Select]
<?xml version="1.0" encoding="utf-16"?>
<!--VoxCommando 2.2.2.2-->
<command id="365" name="Lost phone" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
  <action>
    <cmdType>RoboB.Select</cmdType>
    <params>
      <param>FindMyPhone</param>
    </params>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>RoboB.Show</cmdType>
    <params />
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>RoboB.Navigate</cmdType>
    <params>
      <param>https://www.google.com/android/devicemanager</param>
    </params>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>RoboB.Wait</cmdType>
    <params />
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>RoboB.ElementRegex</cmdType>
    <params>
      <param>div</param>
      <param>^&lt;div.class="ring-device"&gt;&lt;/div&gt;</param>
    </params>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>RoboB.Click</cmdType>
    <params />
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>RoboB.Wait</cmdType>
    <params />
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>RoboB.ElementByName</cmdType>
    <params>
      <param>ok</param>
    </params>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>RoboB.Click</cmdType>
    <params />
    <cmdRepeat>1</cmdRepeat>
  </action>
  <phrase>where's my phone, find my phone, no clue where my phone is, </phrase>
</command>

It's also possible to write commands in a similar manner to log you in but this will vary depending on how many google accounts you have logged into from that machine in the past.  It is also a bit insecure to keep your google password in command xml so I think it's better if you do this part manually when necessary.
« Last Edit: July 12, 2016, 10:36:40 AM by nime5ter »

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7714
  • Karma: 116
    • View Profile
    • VoxCommando
Re: Find my phone
« Reply #4 on: July 12, 2016, 10:25:31 AM »


The other problem is that when you use RoboB.ElementByTag with A 26 you can get very unpredictable results if the page changes or if you end up on a different page because it will just select the 26th link on the page.

This is particularly important because in this case you might actually lock or erase your phone by accident!

nime5ter

  • Administrator
  • Hero Member
  • *****
  • Posts: 1999
  • Karma: 61
    • View Profile
    • Getting Started with VoxCommando
Re: Find my phone
« Reply #5 on: July 12, 2016, 10:35:02 AM »
@Ianos, thanks for your post.

If anybody else finds an easier/less complicated way to pull this off please post

I haven't tested this recently, but another option is to install the free Where's My Droid app, and then use the solution discussed here:

http://voxcommando.com/forum/index.php?topic=1662.0

We can send emails from VC using the SMTP actions. Be sure to first enter your SMTP info under the Options > Email tab, if you haven't yet.

Not everyone will want to have an extra app running on their phone, but personally I prefer this method because it avoids having to enter unencrypted password info in VC commands. It was also extremely reliable when I tested it a few years ago.

I use RoboB a lot because it's a powerful tool. But I try to avoid storing important private info in VC maps or command xml.

TIPS: POST VC VERSION #. Explain what you want VC to do. Say what you've tried & what happened, or post a video demo. Attach VC log. Link to instructions followed.  Post your command (xml)

nime5ter

  • Administrator
  • Hero Member
  • *****
  • Posts: 1999
  • Karma: 61
    • View Profile
    • Getting Started with VoxCommando
Re: Find my phone
« Reply #6 on: July 12, 2016, 03:31:15 PM »
Here is a variation on the Android Device Manager solution that James posted above.

In this version, I check whether the login page loads rather than the Device Manager locator screen. If it does, the command will show the login window and a TTS message tells you that you'll need to log in. That's it.

If the RoboB doesn't find a login field, then it assumes you're already logged in and it will initiate the phone locator/ring function -- but with the browser window hidden. (Of course if you want to see the browser page you could always add a RoboB.Show action in the Else.)

Code: [Select]
<?xml version="1.0" encoding="utf-16"?>
<!--VoxCommando 2.2.1.9-->
<commandGroup open="True" name="Lost phone with login check" enabled="True" prefix="" priority="0" requiredProcess="" description="">
  <command id="373" name="++Lost phone" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="I destroy this RoboB after 2 minutes so that it's not running hidden in the background after the phone is found.">
    <action>
      <cmdType>RoboB.Select</cmdType>
      <params>
        <param>FindMyPhone</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>RoboB.Navigate</cmdType>
      <params>
        <param>https://www.google.com/android/devicemanager</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>RoboB.Wait</cmdType>
      <params />
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>RoboB.ElementByID</cmdType>
      <params>
        <param>Passwd</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <if ifBlockDisabled="False" ifNot="False">
      <ifType>LastActionSuccess</ifType>
      <ifParams>&amp;&amp;</ifParams>
      <then>
        <action>
          <cmdType>TTS.Speak</cmdType>
          <params>
            <param>Looks like you'll need to enter your password.</param>
          </params>
          <cmdRepeat>1</cmdRepeat>
        </action>
        <action>
          <cmdType>RoboB.Show</cmdType>
          <params />
          <cmdRepeat>1</cmdRepeat>
        </action>
      </then>
      <else>
        <action>
          <cmdType>TTS.SpeakSync</cmdType>
          <params>
            <param>OK. I'll try to ring your phone now.</param>
          </params>
          <cmdRepeat>1</cmdRepeat>
        </action>
        <action>
          <cmdType>RoboB.ElementRegex</cmdType>
          <params>
            <param>div</param>
            <param>^&lt;div.class="ring-device"&gt;&lt;/div&gt;</param>
          </params>
          <cmdRepeat>1</cmdRepeat>
        </action>
        <action>
          <cmdType>RoboB.Click</cmdType>
          <params />
          <cmdRepeat>1</cmdRepeat>
        </action>
        <action>
          <cmdType>RoboB.Wait</cmdType>
          <params />
          <cmdRepeat>1</cmdRepeat>
        </action>
        <action>
          <cmdType>RoboB.ElementByName</cmdType>
          <params>
            <param>ok</param>
          </params>
          <cmdRepeat>1</cmdRepeat>
        </action>
        <action>
          <cmdType>RoboB.Click</cmdType>
          <params />
          <cmdRepeat>1</cmdRepeat>
        </action>
        <action>
          <cmdType>VC.SetEventTimer</cmdType>
          <params>
            <param>2m</param>
            <param>KillPhoneFinder</param>
          </params>
          <cmdRepeat>1</cmdRepeat>
        </action>
      </else>
    </if>
    <phrase>where's my phone, find my phone, no clue where my phone is </phrase>
  </command>
  <command id="374" name="Kill the phone finder robobrowser" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
    <action>
      <cmdType>RoboB.Select</cmdType>
      <params>
        <param>FindMyPhone</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>RoboB.Dispose</cmdType>
      <params />
      <cmdRepeat>1</cmdRepeat>
    </action>
    <phrase>Kill the phone finder robo browser</phrase>
    <event>KillPhoneFinder</event>
  </command>
</commandGroup>

I also added a separate command that will dispose of this RoboB window after 2 minutes, so that the Android Device Manager is not left running hidden in the background. That command is triggered automatically using an event timer, but I did include a voice command as well just in case someone wants to execute the command manually.

[Edit: added ++ so that the command is threaded.]
« Last Edit: September 17, 2016, 09:42:33 AM by nime5ter »
TIPS: POST VC VERSION #. Explain what you want VC to do. Say what you've tried & what happened, or post a video demo. Attach VC log. Link to instructions followed.  Post your command (xml)

NightSpeed

  • Jr. Member
  • **
  • Posts: 35
  • Karma: 0
    • View Profile
Re: Find my phone
« Reply #7 on: July 26, 2016, 01:47:57 AM »
Is this broken for anyone else I just tried using this yesterday and It's not working

nime5ter

  • Administrator
  • Hero Member
  • *****
  • Posts: 1999
  • Karma: 61
    • View Profile
    • Getting Started with VoxCommando
Re: Find my phone
« Reply #8 on: July 26, 2016, 08:18:59 AM »
The commands are working fine for me.

"Not working" could of course mean many things. In what way is it not working?

http://voxcommando.com/mediawiki/index.php?title=Getting_support#Other_Specific_Tips
« Last Edit: July 26, 2016, 09:32:02 AM by nime5ter »
TIPS: POST VC VERSION #. Explain what you want VC to do. Say what you've tried & what happened, or post a video demo. Attach VC log. Link to instructions followed.  Post your command (xml)

NightSpeed

  • Jr. Member
  • **
  • Posts: 35
  • Karma: 0
    • View Profile
Re: Find my phone
« Reply #9 on: July 26, 2016, 07:34:25 PM »
It seems that something blew past me. It was unable to log into my gmail account because it didn't know my gmail account (was not saved) so I simply fixed this with showing robo.b window and then entering information works perfectly now sorry for the confusion.

nime5ter

  • Administrator
  • Hero Member
  • *****
  • Posts: 1999
  • Karma: 61
    • View Profile
    • Getting Started with VoxCommando
Re: Find my phone
« Reply #10 on: July 29, 2016, 05:33:18 PM »
Glad you were able to resolve the problem.

Were you using the xml I posted in 'reply #6' or the version James posted in 'reply #3'?

My #6 version is supposed to automatically alert the user and open the log-in browser window if a log-in is required. Just wondering if that's not working 100%, or if you are using the other xml.
TIPS: POST VC VERSION #. Explain what you want VC to do. Say what you've tried & what happened, or post a video demo. Attach VC log. Link to instructions followed.  Post your command (xml)

NightSpeed

  • Jr. Member
  • **
  • Posts: 35
  • Karma: 0
    • View Profile
Re: Find my phone
« Reply #11 on: July 31, 2016, 03:01:45 PM »
I used Your version It prompted me to login only after I added the Robo.b show window command to the beginning of the call in. After i did that i just skipped the command in the list and it works fine now. Weird glitch possible cache issues I really have no idea because im not tat inclined with code but I really do appreciate this xml has helped me countless a time! Keep up the good work :D 

NightSpeed

  • Jr. Member
  • **
  • Posts: 35
  • Karma: 0
    • View Profile
Re: Find my phone
« Reply #12 on: September 20, 2017, 12:43:24 AM »
Hi I used this command a while ago and I am looking to see if this is still working for other people the robo.b Does not seem to launch using vc2.2.3.2

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7714
  • Karma: 116
    • View Profile
    • VoxCommando
Re: Find my phone
« Reply #13 on: October 03, 2017, 06:53:15 PM »
Launch works fine, but Google has done something weird that seems to make it impossible to automate login.