Différences entre versions de « Tutorial Plugin : 6 - Liste des commandes »

De Wiki Francophone de Maxthon
Sauter à la navigation Sauter à la recherche
Ligne 32 : Ligne 32 :
 
&quot;Test plugin&quot;,&quot;export.txt&quot;)</pre>
 
&quot;Test plugin&quot;,&quot;export.txt&quot;)</pre>
 
   </li>
 
   </li>
  <li>
+
 
 +
<li>
 
<B>writeFile( security_id, plugin_name, file_name, content )</B>
 
<B>writeFile( security_id, plugin_name, file_name, content )</B>
  
Write a text file.<br> Ecrire un fihcier texte.
+
Write a text file.<br> Ecrire un fichier texte.
 
<pre>external.writeFile(%max_security_id,
 
<pre>external.writeFile(%max_security_id,
 
&quot;Test plugin&quot;,&quot;export.txt&quot;, &quot;Some Data.&quot;)</pre>
 
&quot;Test plugin&quot;,&quot;export.txt&quot;, &quot;Some Data.&quot;)</pre>
 
   </li>
 
   </li>
 +
 
<li>
 
<li>
 
<B>m2_readIni( security_id, plugin_name , file_name , section_name , key , default_value)</B>
 
<B>m2_readIni( security_id, plugin_name , file_name , section_name , key , default_value)</B>
Ligne 46 : Ligne 48 :
 
&quot;testplugin&quot;,&quot;settings.ini&quot;,&quot;general&quot;,&quot;save&quot;,&quot;0&quot;)</pre>
 
&quot;testplugin&quot;,&quot;settings.ini&quot;,&quot;general&quot;,&quot;save&quot;,&quot;0&quot;)</pre>
 
   </li>
 
   </li>
  <li>
+
 
 +
<li>
 
<B>m2_writeIni( security_id , plugin_name , file_name , section_name , key , value )</B>
 
<B>m2_writeIni( security_id , plugin_name , file_name , section_name , key , value )</B>
  
Write an ini-file. <br>Erire dans un fixhier 'ini'.
+
Write an ini-file. <br>Ecrire dans un fichier 'ini'.
 
<pre>external.m2_writeIni(%max_security_id,
 
<pre>external.m2_writeIni(%max_security_id,
 
&quot;testplugin&quot;,&quot;settings.ini&quot;,&quot;general&quot;,&quot;save&quot;,&quot;true&quot;)</pre>
 
&quot;testplugin&quot;,&quot;settings.ini&quot;,&quot;general&quot;,&quot;save&quot;,&quot;true&quot;)</pre>
 
   </li>
 
   </li>
  <li>
+
 
 +
<li>
 
<B>tab_count</B>
 
<B>tab_count</B>
  
Ligne 59 : Ligne 63 :
 
<pre>var total_tab = external.tab_count</pre>
 
<pre>var total_tab = external.tab_count</pre>
 
   </li>
 
   </li>
  <li>
+
 
 +
<li>
 
<B>activate_tab( security_id , index )</B>
 
<B>activate_tab( security_id , index )</B>
  
Activate tab number (starting from zero).
+
Activate tab number (starting from zero).<br>Activer le numéro d'un onglet (commence à zéro).
 
<pre>external.activate_tab(%max_security_id,2)</pre>
 
<pre>external.activate_tab(%max_security_id,2)</pre>
 
   </li>  
 
   </li>  
  <li><B>close_tab( security_id , index )</B>
+
 
 +
<li>
 +
<B>close_tab( security_id , index )</B>
  
 
Close a tab. <br>Fermer un onglet.
 
Close a tab. <br>Fermer un onglet.
 
<pre>external.close_tab(%max_security_id,2)</pre>
 
<pre>external.close_tab(%max_security_id,2)</pre>
 
   </li>
 
   </li>
  <li>
+
 
 +
<li>
 
<B>get_tab( security_id , index )</B>
 
<B>get_tab( security_id , index )</B>
  
Get the webpage object from tab 'index'
+
Get the webpage object from tab 'index'.<br>Obtenir de l'index des onglets la variable objet d'une page web.
 +
 
 
<pre>var doc = external.get_tab(%max_security_id,2).document</pre>
 
<pre>var doc = external.get_tab(%max_security_id,2).document</pre>
 
   </li>
 
   </li>
  <li>
+
 
 +
<li>
 
<B> cur_sel</B>
 
<B> cur_sel</B>
  
Ligne 82 : Ligne 92 :
 
<pre>var cur_tab = external.cur_sel</pre>
 
<pre>var cur_tab = external.cur_sel</pre>
 
   </li>
 
   </li>
  <li><B>m2_plugin_folder( security_id , plugin_name )</B>
+
 
 +
<li>
 +
<B>m2_plugin_folder( security_id , plugin_name )</B>
  
 
The local path of the plugin.<br>Le chemin local du plugin.
 
The local path of the plugin.<br>Le chemin local du plugin.
Ligne 88 : Ligne 100 :
 
&quot;ViewSource!&quot;)</pre>
 
&quot;ViewSource!&quot;)</pre>
 
   </li>
 
   </li>
  <li>
+
 
 +
<li>
 
<B>m2_run_cmd( security_id , id )</B>
 
<B>m2_run_cmd( security_id , id )</B>
  
Call a Maxthon command with the specified ID.<br>Appeler une commande de Maxthon avec une ID specifiée.
+
Call a Maxthon command with the specified ID.<br>Appeler une commande de Maxthon avec une ID spécifiée.
 
<pre>external.m2_run_cmd(%max_security_id,32772)</pre>This will open a blank page.
 
<pre>external.m2_run_cmd(%max_security_id,32772)</pre>This will open a blank page.
 
   </li>
 
   </li>
  <li>
+
 
 +
<li>
 
<B>m2_callerName( security_id, plugin_name)</B>
 
<B>m2_callerName( security_id, plugin_name)</B>
  
This function tells Maxthon the call is made from a Plugin.<br>Cette fonction indique à Maxthon l'appel effectué d'un plugin.
+
This function tells Maxthon the call is made from a Plugin.<br>Cette fonction indique à Maxthon l'appel effectué à partir d'un plugin.
 
<pre>external.m2_callerName(%max_security_id,&quot;ViewSource!&quot;)</pre>
 
<pre>external.m2_callerName(%max_security_id,&quot;ViewSource!&quot;)</pre>
 
   </li>
 
   </li>
  <li>
+
 
 +
<li>
 
<B>max_showConfig( security_id, plugin_name)</B>
 
<B>max_showConfig( security_id, plugin_name)</B>
  
Show the plugin's config dialog.<br>Montre la boite de dialogue de configuration du plugin.
+
Show the plugin's config dialog.
 +
<br>Montre la boite de dialogue de configuration du plugin.
 
<pre>external.max_showConfig(%max_security_id,&quot;ViewSource!&quot;)</pre>
 
<pre>external.max_showConfig(%max_security_id,&quot;ViewSource!&quot;)</pre>
 
</li>
 
</li>
<li><b>max_activex(security_id, prog_id)</b>
+
 
 +
<li>
 +
<b>max_activex(security_id, prog_id)</b>
  
 
Create an ActiveX object.<br> Crée un objet ActiveX.
 
Create an ActiveX object.<br> Crée un objet ActiveX.
Ligne 115 : Ligne 133 :
 
tempwin.close()</pre>
 
tempwin.close()</pre>
 
   </li>
 
   </li>
  <li>
+
 
 +
<li>
 
<B>max_modelessDialog( security_id , url , option , attr , window )</B>
 
<B>max_modelessDialog( security_id , url , option , attr , window )</B>
  
Ligne 123 : Ligne 142 :
 
'status:no;help:no;resizable:yes;scroll:yes;',window)</pre>
 
'status:no;help:no;resizable:yes;scroll:yes;',window)</pre>
 
   </li>
 
   </li>
  <li><b>max_language_id</b>  
+
 
 +
<li>
 +
<b>max_language_id</b>  
  
 
The user's current selected language.<br>Le langage en cours sélectionné par l'utiisateur.
 
The user's current selected language.<br>Le langage en cours sélectionné par l'utiisateur.
 
<pre>var language=external.max_language_id</pre>
 
<pre>var language=external.max_language_id</pre>
 
</li>
 
</li>
 +
 
<li>
 
<li>
 
<B>max_actSideBarItem( plugin_name )</B>
 
<B>max_actSideBarItem( plugin_name )</B>
  
This function will activate the sidebar plugin named as 'plugin_name'.<br>Cette fonction activera le plugin de barre latérale dont le nom est "pluginname".
+
This function will activate the sidebar plugin named as 'plugin_name'.
 +
<br>Cette fonction activera le plugin de barre latérale dont le nom est "pluginname".
 
<pre>external.max_actSideBarItem(&quot;Calculator++&quot)</pre>
 
<pre>external.max_actSideBarItem(&quot;Calculator++&quot)</pre>
 
   </li>
 
   </li>
 +
 
<li>
 
<li>
 
<b>addFavorite( url , title ) , addFavorite( url )</b>
 
<b>addFavorite( url , title ) , addFavorite( url )</b>
Ligne 143 : Ligne 167 :
 
&quot;This is google&quot;)</pre>
 
&quot;This is google&quot;)</pre>
 
   </li>
 
   </li>
  <li>
+
 
 +
<li>
 
<B>addProxy (name, address, speed, is_web_proxy)</B>
 
<B>addProxy (name, address, speed, is_web_proxy)</B>
  
Call Maxthon's add proxy dialog.<br>Appelle la boite de dialogue "Ajouter un proxy".
+
Call Maxthon's add proxy dialog.
 +
<br>Appelle la boite de dialogue "Ajouter un proxy".
 
<pre>external.addProxy(&quot;My proxy&quot;,
 
<pre>external.addProxy(&quot;My proxy&quot;,
 
&quot;192.168.1.0:8080&quot;,1,0)</pre>
 
&quot;192.168.1.0:8080&quot;,1,0)</pre>
 
   </li>
 
   </li>
  <li>
+
 
 +
<li>
 
<B>addFilter( address ) , addFilter( address, is_pop_filter )</B>
 
<B>addFilter( address ) , addFilter( address, is_pop_filter )</B>
  
Call Maxthon's add filter dialog.<br>Appelle la boite de dialogue "Ajouter un filtre".
+
Call Maxthon's add filter dialog.
 +
<br>Appelle la boite de dialogue "Ajouter un filtre".
 
<pre>
 
<pre>
 
external.addFilter(&quot;http://www.yahoo.com/ad*&quot;)
 
external.addFilter(&quot;http://www.yahoo.com/ad*&quot;)
 
external.addFilter(&quot;http://www.yahoo.com/img/*&quot;, 0)</pre>
 
external.addFilter(&quot;http://www.yahoo.com/img/*&quot;, 0)</pre>
 
   </li>
 
   </li>
  <li>
+
 
 +
<li>
 
<B>m2_search_text( security_id )</B>
 
<B>m2_search_text( security_id )</B>
  
Ligne 164 : Ligne 193 :
 
<pre>var text = external.m2_search_text(%max_security_id)</pre>
 
<pre>var text = external.m2_search_text(%max_security_id)</pre>
 
   </li>
 
   </li>
 +
 
</ol>
 
</ol>
  
 
<p>In a sidebar plugin you can implement a script function called max_callback(status).<br>Dans un plugin de barre latérale vous pouvez ajouter une fonction script appelée : max_callback(status).<br>
 
<p>In a sidebar plugin you can implement a script function called max_callback(status).<br>Dans un plugin de barre latérale vous pouvez ajouter une fonction script appelée : max_callback(status).<br>
<ol><li>
+
<ol>
 +
 
 +
<li>
 
   Created: URL = FILENAME?maxcmd=init</li><li>
 
   Created: URL = FILENAME?maxcmd=init</li><li>
 
   Activated = max_callback('sidebar_activate')</li><li>
 
   Activated = max_callback('sidebar_activate')</li><li>
Ligne 180 : Ligne 212 :
  
 
These links are useful for reference and if you start learning HTML and Javascript.
 
These links are useful for reference and if you start learning HTML and Javascript.
<ul><li>[http://www.w3schools.com/js/default.asp W3School Javascript Tutorial] (Recommended for beginners)
+
<ul>
 +
<li>[http://www.w3schools.com/js/default.asp W3School Javascript Tutorial] (Recommended for beginners)
 +
 
 
<li>[http://www.w3schools.com/htmldom/dom_reference.asp W3School HTML DOM reference] (HTML DOM allows you to acces and modify HTML documents)
 
<li>[http://www.w3schools.com/htmldom/dom_reference.asp W3School HTML DOM reference] (HTML DOM allows you to acces and modify HTML documents)
 +
 
<li>[http://www.w3schools.com/html/html_reference.asp W3School HTML reference] (All HTML tags)
 
<li>[http://www.w3schools.com/html/html_reference.asp W3School HTML reference] (All HTML tags)
 +
 
<li>[http://msdn.microsoft.com/library/default.asp?url=/library/en-us/script56/html/js56jsoriJScript.asp Microsoft MSDN Javascript reference/guide]
 
<li>[http://msdn.microsoft.com/library/default.asp?url=/library/en-us/script56/html/js56jsoriJScript.asp Microsoft MSDN Javascript reference/guide]
 +
 
<li>[http://msdn.microsoft.com/library/default.asp?url=/workshop/author/dhtml/reference/dhtml_reference_entry.asp Microsoft MSDN HTML/DHTML reference]
 
<li>[http://msdn.microsoft.com/library/default.asp?url=/workshop/author/dhtml/reference/dhtml_reference_entry.asp Microsoft MSDN HTML/DHTML reference]
 +
 
<li>[http://www.devguru.com/Technologies/ecmascript/quickref/javascript_index.html Devguru Javascript reference]
 
<li>[http://www.devguru.com/Technologies/ecmascript/quickref/javascript_index.html Devguru Javascript reference]
 +
 
<li>[http://www.devguru.com/Technologies/vbscript/quickref/filesystemobject.html Devguru Scripting.FileSystemObject (ActiveX component) reference]
 
<li>[http://www.devguru.com/Technologies/vbscript/quickref/filesystemobject.html Devguru Scripting.FileSystemObject (ActiveX component) reference]
 +
 
<li>[http://www.webreference.com/js/column5/index.html Webreference Regular Expressions tutorial]
 
<li>[http://www.webreference.com/js/column5/index.html Webreference Regular Expressions tutorial]
 +
 
</ul>
 
</ul>
 +
 
Useful Maxthon Links:
 
Useful Maxthon Links:
<ul><li>[http://www.maxthon.com Maxthon.com]
+
 
 +
<ul>
 +
<li>[http://www.maxthon.com Maxthon.com]
 +
 
 
<li>[http://maxthon.tarapages.com/ TaraPages.com] (All Maxthon plugin can be found here)
 
<li>[http://maxthon.tarapages.com/ TaraPages.com] (All Maxthon plugin can be found here)
 +
 
<li>[http://skins.maxthon.com/ Maxthon Skins]
 
<li>[http://skins.maxthon.com/ Maxthon Skins]
 +
 
<li>[http://forum.maxthon.com/forum/index.php Maxthon Forum]
 
<li>[http://forum.maxthon.com/forum/index.php Maxthon Forum]
 +
 
</ul>
 
</ul>
  
 
<center> '''<''' [[Tutorial Plugin : 5 - Exemples|Partie 5 : Exemples]] | [[Tutorial Plugin|Sommaire Plugin]]</center>
 
<center> '''<''' [[Tutorial Plugin : 5 - Exemples|Partie 5 : Exemples]] | [[Tutorial Plugin|Sommaire Plugin]]</center>

Version du 9 octobre 2005 à 17:47

This is a short summary of all important Maxthon commands and links. You can [javascript:external.addFavorite(document.location.href,'Maxthon Plugins Quick List')">bookmark] this page so you can quickly lookup this information.

Voici un court sommaire des commandes et des liens utiles de Maxthon.
Vous pouvez ajouter cette page à vos [javascript:external.addFavorite(document.location.href="http://www.ldfa.net/wiki/index.php/Tutorial_Plugin_:_6_-_Liste_des_commandes), 'Liste rapide des plugins de Maxthon')" > Favoris].
Ainsi vous accéderez plus rapidement à ces informations.

Commandes de Maxthon

Security_id: For Toolbar Plugins: %max_security_id For Sidebar Plugins: Inside max.src, called max_security_id

Security_id :

  • Pour les plugins de barre d'outils : %max_security_id
  • Pour les plugins de barre latérale : Inside max.src, called max_security_id


These are the Maxthon DHTML commands:

Voici les commandes DHTML de Maxthon :


  1. readFile( security_id, plugin_name, file_name) Read a text file.
    Lire un fichier texte.
    var text = external.readFile(%max_security_id,
    "Test plugin","export.txt")
  2. writeFile( security_id, plugin_name, file_name, content ) Write a text file.
    Ecrire un fichier texte.
    external.writeFile(%max_security_id,
    "Test plugin","export.txt", "Some Data.")
  3. m2_readIni( security_id, plugin_name , file_name , section_name , key , default_value) Read an ini-file.
    Lire un fichier 'ini'.
    path = external.m2_readIni(%max_security_id,
    "testplugin","settings.ini","general","save","0")
  4. m2_writeIni( security_id , plugin_name , file_name , section_name , key , value ) Write an ini-file.
    Ecrire dans un fichier 'ini'.
    external.m2_writeIni(%max_security_id,
    "testplugin","settings.ini","general","save","true")
  5. tab_count Total number of tabs.
    Nombre total d'onglets.
    var total_tab = external.tab_count
  6. activate_tab( security_id , index ) Activate tab number (starting from zero).
    Activer le numéro d'un onglet (commence à zéro).
    external.activate_tab(%max_security_id,2)
  7. close_tab( security_id , index ) Close a tab.
    Fermer un onglet.
    external.close_tab(%max_security_id,2)
  8. get_tab( security_id , index ) Get the webpage object from tab 'index'.
    Obtenir de l'index des onglets la variable objet d'une page web.
    var doc = external.get_tab(%max_security_id,2).document
  9. cur_sel The number of the active tab.
    Le numéro de l'onglet actif.
    var cur_tab = external.cur_sel
  10. m2_plugin_folder( security_id , plugin_name ) The local path of the plugin.
    Le chemin local du plugin.
    var folder = external.m2_plugin_folder(%max_security_id,
    "ViewSource!")
  11. m2_run_cmd( security_id , id ) Call a Maxthon command with the specified ID.
    Appeler une commande de Maxthon avec une ID spécifiée.
    external.m2_run_cmd(%max_security_id,32772)
    This will open a blank page.
  12. m2_callerName( security_id, plugin_name) This function tells Maxthon the call is made from a Plugin.
    Cette fonction indique à Maxthon l'appel effectué à partir d'un plugin.
    external.m2_callerName(%max_security_id,"ViewSource!")
  13. max_showConfig( security_id, plugin_name) Show the plugin's config dialog.
    Montre la boite de dialogue de configuration du plugin.
    external.max_showConfig(%max_security_id,"ViewSource!")
  14. max_activex(security_id, prog_id) Create an ActiveX object.
    Crée un objet ActiveX.
    var tempwin = window.open()
    var XML=tempwin.external.max_activex(%max_security_id,
    "Microsoft.XMLDOM")
    tempwin.close()
  15. max_modelessDialog( security_id , url , option , attr , window ) Open a modelessDialog.
    Ouvre Une boite de dialogue modèle.
    external.max_modelessDialog(%max_security_id,
    'example.htm',window, 
    'status:no;help:no;resizable:yes;scroll:yes;',window)
  16. max_language_id The user's current selected language.
    Le langage en cours sélectionné par l'utiisateur.
    var language=external.max_language_id
  17. max_actSideBarItem( plugin_name ) This function will activate the sidebar plugin named as 'plugin_name'.
    Cette fonction activera le plugin de barre latérale dont le nom est "pluginname".
    external.max_actSideBarItem("Calculator++&quot)
  18. addFavorite( url , title ) , addFavorite( url ) Add the 'url' into favorites.
    Ajoute l'adresse URL aux favoris.
    external.addFavorite( "http://www.google.com" )
    external.addFavorite( "http://www.google.com",
    "This is google")
  19. addProxy (name, address, speed, is_web_proxy) Call Maxthon's add proxy dialog.
    Appelle la boite de dialogue "Ajouter un proxy".
    external.addProxy("My proxy",
    "192.168.1.0:8080",1,0)
  20. addFilter( address ) , addFilter( address, is_pop_filter ) Call Maxthon's add filter dialog.
    Appelle la boite de dialogue "Ajouter un filtre".
    external.addFilter("http://www.yahoo.com/ad*")
    external.addFilter("http://www.yahoo.com/img/*", 0)
  21. m2_search_text( security_id ) This property will return the text in Maxthon's search bar.
    Cette propriété renverra le texte dans la barre de recherche de Maxthon.
    var text = external.m2_search_text(%max_security_id)

In a sidebar plugin you can implement a script function called max_callback(status).
Dans un plugin de barre latérale vous pouvez ajouter une fonction script appelée : max_callback(status).

  1. Created: URL = FILENAME?maxcmd=init
  2. Activated = max_callback('sidebar_activate')
  3. Deactivated = max_callback('sidebar_deactivate')
  4. Tab Change=max_callback('sidebar_tab_change')
  5. Unload=max_callback('sidebar_unload')

Useful Links

Liens utiles

These links are useful for reference and if you start learning HTML and Javascript.

Useful Maxthon Links:

< Partie 5 : Exemples | Sommaire Plugin