Hi Mauricio<br>
<br>
I tried with your files. The problem is that your not doing
setcontext() before calling remap() which you have to do. Infact you
have commented the setcontext() there (line no 53). And when doing the
setcontext() u should not hard code the path that will be displayed in
the title bar. you have to include a logic that will do it
appropriately. Please check the following code snippet, I think it will
do it. <br>
<br>
.......<br>
default_dir = os.getcwd() + '/txt_files'<br>
#This can be any name that you choose for the file to be saaved<br>
filename = 'sample.txt'<br>
mo = re.match (os.path.expandvars ('$HOME'), default_dir)<br>
if str(mo) != &quot;&lt;type 'NoneType'&gt;&quot;:<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; newcontext = '~' + default_dir [mo.end():]<br>
&nbsp;else:<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; newcontext = default_dir<br>
setcontext ('Unsaved Document 1 - gedit', filename + '(' + newcontext&nbsp; + ') - gedit')<br>
......<br><br>
FYI, the reason to include setcontext() is that, then only ldtp engine
will be able to locate the window on which remap() should be performed
(since we get the window handle based on the label (title) of the
window).<br>
<br>
After this remap() should work.<br>
<br>
Thanks<br>
Premkumar J<br>
<br><div><span class="gmail_quote">On 11/24/05, <b class="gmail_sendername">Mauricio Lin</b> &lt;<a href="mailto:mauriciolin@gmail.com">mauriciolin@gmail.com</a>&gt; wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hi Premkumar,<br><br>
I am trying to use remap() function in my gedit script but no success so far.<span class="q"><br>
<br>
Look the error:<br>
<br>
Traceback (most recent call last):<br></span>
&nbsp; File &quot;./gedit_2.py&quot;, line 65, in ?<br>
&nbsp;&nbsp;&nbsp; appendtext('frmUnsavedDocument1-gedit', 'txt0', chr(number))<br>
ldtp.error: Window: frmUnsavedDocument1-gedit not opened<br>
<br>
I am attaching the script and map files, so you can check them for more
details. You have to create a directory named as &quot;txt_files&quot; in the
same place you are going to run the script.<br>
<br>
Basically the first time I save the file, widgets are changed, so I need to handle them afterwards.<br>
&nbsp;<br>
After using remap() function as below:<br>
<br>
remap('gedit', 'frmUnsavedDocument1-gedit')<br>
<br>
I print the names of windows currently available -&gt; print getwindowlist()<br>
<br>
The printed list is the windows of the original map file and not the map file got in runtime.<br>
<br>
Is there anything wrong?<br>
<br>
BR,<br><span class="sg">
<br>
Mauricio Lin.</span><div><span class="e" id="q_107bed6b2114b6da_4"><br>
<br><div><span class="gmail_quote">On 11/15/05, <b class="gmail_sendername">Premkumar Jothimani</b> &lt;<a href="mailto:prem.jothimani@gmail.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">prem.jothimani@gmail.com
</a>&gt; wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hi Mauricio,<br>
<br>
You can use the second map file only while writing scripts. Because
whatever you see in the second map file is what will be present in
appmap at runtime after you do <span name="st">remap</span>. So you can use the second map
file just for reference while writing automation scripts. You can check
the correctness of the script by executing the corresponding statement
after a <span name="st">remap</span> from a python prompt.<br>
<br>
Also you can make use of the following component functions.
Unfortunately they havent been documented yet. I will try to give a
brief note on them. You please try these and get back if you have any
queries.<br>
<br>
The following component functions help in retrieving values from appmap
at runtime. You can use them from python prompts (especially after a
<span name="st">remap</span>) to know the current contents of appmap.<br>
<br>
getwindowlist () - Returns the names of windows currently available in appmap as a python list object.<br>
<br>
getobjectlist ('window name') - Returns the names of objects currently
available in appmap under the given 'window name' as a python list
object. Please remember that the parameter window name should be one
from the list obtained from getwindowlist()<br>
<br>
getobjectinfo ('window name','object name') - Returns the properties that the given object posses at runtime. <br>
<br>
getobjectproperty ('window name','object name') - Returns the values of the properties of the given object name.<br>
<br>
For example, for the following entry in appmap,<br>
[frmInformation]<br>
...<br>
btnOK={class=push_button,parent=flr0,child_index=1,label=OK}<br>
<br>
getobjectinfo('frmInformation','btnOK') will return ['class', 'parent', 'child_index', 'label']<br>
getobjectproperty ('frmInformation','btnOK') will return ['push_button', 'flr0', '1', 'OK']<br>
<br>
FYI, Most of the names generated for widgets will be straight forward
from their appearance in the window (like from their label/label by
values). Also remeber to do a undoremap () between successive <span name="st">remap</span>
calls.<br>
<br>
Regards<br>
Premkumar J<div><span><br><br><div><span class="gmail_quote">On 11/15/05, <b class="gmail_sendername">Mauricio Lin</b> &lt;<a href="mailto:mauriciolin@gmail.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">

mauriciolin@gmail.com</a>&gt; wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hi Premkumar,<br><br><div><span><span class="gmail_quote">On 11/11/05, <b class="gmail_sendername">Premkumar Jothimani</b> &lt;<a href="mailto:prem.jothimani@gmail.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">


prem.jothimani@gmail.com</a>&gt; wrote:</span></span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hi Mauricio,<br>
<span><br>
I got the point. But I am puzzled as why setcontext does not work (!!?!).<br>
<br>
Also I am worried that you will have to send the
advanced-linux-programming.pdf file along with your map file for things
to work as your map file expects that file to be opened initially. I
dont think it is such a good idea. An alternative solution would be to
generate the map file with none of the files open and use remap() at
runtime. This would make the map file look logical and simple.</span></blockquote><div><br>
The problem is if you generate a map file (first map file) from a gpdf
with no files loaded, gpdf does not display many widgets (buttons,
menus) and then map file does not contain these widgets names.<br>
<br>
By other hand, if you generate a map file (second map file) from a gdpf
with a file loaded as for instance advanced-linux-programming.pdf, your
map file probably will contain more widgets.<br>
<br>
So the two map files are not so similar, since there are more widgets names presented on the second map file.<br>
<br>
If I remap at runtime I have to know in advance the name of widgets that are not presented on the first map file, right?<br>
<br>
How can I know these widgets names in advance if the first map file does not present them?<br>
</div><br>
Try to generate 2 map files, the first one just open the gpdf and
appmap the application and the last one open gpdf with some pdf file
and appmap the application. Compare these 2 map files and you can check
they are different.<br>
<br>
I checked the remap function description, but how can I access
dynamically created widgets if I do not know their names in advance?<br>
<br>
<span style="font-style: italic;"></span>BR,<br><span>
<br>
Mauricio Lin.</span><span><br>
<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Regards<br><span>
Premkumar</span><div><span><br>
<br><br><div><span class="gmail_quote">On 11/10/05, <b class="gmail_sendername">Mauricio Lin</b> &lt;<a href="mailto:mauriciolin@gmail.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">mauriciolin@gmail.com
</a>&gt; wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hi Premkumar,<br><br><div><span><span class="gmail_quote">On 11/10/05, <b class="gmail_sendername">Premkumar Jothimani</b> &lt;<a href="mailto:prem.jothimani@gmail.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">




prem.jothimani@gmail.com</a>&gt; wrote:</span></span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hi Mauricio,<br>
<span><br>
Assuming that you use the map file that you sent me, I think your setcontext() call should look like<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; setcontext ('PDF Viewer', 'python.pdf')<br>The
point to note here is that the first parameter should always be the
value of the &quot;label&quot; field for that window name in the map file.</span></blockquote><div><br>
OK. But there is a small detail here. The map file I generated starts as:<br>
<br>
[frmadvanced-linux-programming]<br>
frmadvanced-linux-programming={class=frame,parent=gpdf,child_index=0,label=advanced-linux-programming.pdf}<br>
...<br>
<br>
Look the label field, it is not 'PDF Viewer'.&nbsp; The 'PDF Viewer'
just exists if you generated a map file from a gpdf with no pdf file
loaded.<br>
This map file was generated based on an open pdf file in the gpdf window.<br>
<br>
The reason I am generating the map file in this way is because a gpdf
application with a pdf file loaded displays more graphical components
(buttons, menu, menu options) that I want to manipulate.<br>
<br>
You can check that when you open a pdf file in gpdf, more buttons are displayed as well as more options in menu are created.<br>
Open the gpd application and afterward open a pdf file, you can notice that more buttons and menu options are displayed.<br>
<br>
BR,<br>
<br>
Mauricio Lin.<br>
</div></div><br>

</blockquote></div><br>

</span></div></blockquote></span></div><br>

</blockquote></div><br>

</span></div></blockquote></div><br>

</span></div><br clear="all"></blockquote></div><br>