Hello all,
I've searched this forum and could not find a way to
accomplish what I needed. I was trying to set an Application Profile and
then within that Profile, when the app was launched, wait for a
specific screen to open and then start a Task. After looking at the
documentation and looking through the posts in this "Forum" I couldn't
find exactly what I was looking for. However after some experimentation,
and seeing a Tip on
Ryoen Deprouw's Google+ Community, I was able to get my Task to work.
Basically I was trying to have a task wait for an App to open and then wait for a specific screen to show. At that point it would get the GPS location and put it in the Clipboard, %CLIP, to make it available to paste in the App. Then...I needed it to stay active and wait until that same screen in the App appeared again. Originally I was having a problem because the Task would work once and then just be done. However, using Ryoen's Tip I was able to finally figure out how to get this to work. Originally I tried using
AutoInput but I couldn't make that work, mainly due to limitations in the App I'm trying to put data into.
Anyway, I was still having a problem with the loop regardless and the Tip finally helped me figure it out myself. Since I couldn't find any examples of the type of Loop I was looking for I wanted to share my solution here so that other's who might need to loop within an app that doesn't have support for Tasker could benefit. I won't get into specifics, as Tasker users can probably figure this out. If someone needs more details please reply and I'll elaborate. I will say this uses an Application Profile, so it activates when the App is opened. For those wondering, the App is HanDBase, a Database app for Android. I did wind up having to create a HanDBase Form to get this to work though, because of the limitations of the app not sharing Field data with AutoInput.
Here is the XML for my Tasker script. Feel free to use it and modify it as needed. I'll attach it as well if anyone needs to download it.
<TaskerData sr="" dvi="1" tv="4.6u3">
<Task sr="task23">
<cdate>1425679052429</cdate>
<edate>1425793984993</edate>
<id>23</id>
<nme>GetGPSHanDBase</nme>
<pri>10</pri>
<Kid sr="Kid">
<feat0>android.hardware.location:y</feat0>
<feat1>android.hardware.location.gps:y</feat1>
<launchID>23</launchID>
<pkg>com.mobiledataconsultants.test</pkg>
<vnme>1.0</vnme>
<vnum>2</vnum>
</Kid>
<Action sr="act0" ve="7">
<code>30</code>
<Int sr="arg0" val="0"/>
<Int sr="arg1" val="3"/>
<Int sr="arg2" val="0"/>
<Int sr="arg3" val="0"/>
<Int sr="arg4" val="0"/>
</Action>
<Action sr="act1" ve="7">
<code>37</code>
<ConditionList sr="if">
<Condition sr="c0" ve="3">
<lhs>%WIN</lhs>
<op>3</op>
<rhs>GPS Data</rhs>
</Condition>
</ConditionList>
</Action>
<Action sr="act10" ve="7">
<code>38</code>
<on>false</on>
</Action>
<Action sr="act11" ve="7">
<code>135</code>
<Int sr="arg0" val="0"/>
<Int sr="arg1" val="2"/>
<Str sr="arg2" ve="3"/>
</Action>
<Action sr="act2" ve="7">
<code>35</code>
<Int sr="arg0" val="0"/>
<Int sr="arg1" val="1"/>
<Int sr="arg2" val="0"/>
<Int sr="arg3" val="0"/>
<Int sr="arg4" val="0"/>
<ConditionList sr="if">
<Condition sr="c0" ve="3">
<lhs>%WIN</lhs>
<op>2</op>
<rhs>GPS Data</rhs>
</Condition>
</ConditionList>
</Action>
<Action sr="act3" ve="7">
<code>43</code>
<ConditionList sr="if">
<Condition sr="c0" ve="3">
<lhs>%WIN</lhs>
<op>2</op>
<rhs>GPS Data</rhs>
</Condition>
</ConditionList>
</Action>
<Action sr="act4" ve="7">
<code>548</code>
<Str sr="arg0" ve="3">Getting GPS Coordinates</Str>
<Int sr="arg1" val="0"/>
</Action>
<Action sr="act5" ve="7">
<code>902</code>
<Int sr="arg0" val="0"/>
<Int sr="arg1" val="10"/>
<Int sr="arg2" val="1"/>
<Int sr="arg3" val="0"/>
</Action>
<Action sr="act6" ve="7">
<code>547</code>
<Str sr="arg0" ve="3">%hdbgps</Str>
<Str sr="arg1" ve="3">%LOC</Str>
<Int sr="arg2" val="0"/>
<Int sr="arg3" val="0"/>
</Action>
<Action sr="act7" ve="7">
<code>105</code>
<Str sr="arg0" ve="3">%hdbgps</Str>
<Int sr="arg1" val="0"/>
</Action>
<Action sr="act8" ve="7">
<code>548</code>
<Str sr="arg0" ve="3">You can now paste the GPS Data.</Str>
<Int sr="arg1" val="0"/>
</Action>
<Action sr="act9" ve="7">
<code>35</code>
<Int sr="arg0" val="0"/>
<Int sr="arg1" val="2"/>
<Int sr="arg2" val="0"/>
<Int sr="arg3" val="0"/>
<Int sr="arg4" val="0"/>
<ConditionList sr="if">
<Condition sr="c0" ve="3">
<lhs>%WIN</lhs>
<op>3</op>
<rhs>GPS Data</rhs>
</Condition>
</ConditionList>
</Action>
<Img sr="icn" ve="2">
<nme>hl_location_web_site</nme>
</Img>
</Task>
</TaskerData>
Unfortunately, when I tried to create it as a Standalone App, it didn't work, I guess I need to do some more studying on that.
I hope this helps.
David