Difference between revisions of "Repositorio de Custom Commands"
(→Generar CPF) |
|||
(11 intermediate revisions by 5 users not shown) | |||
Line 1: | Line 1: | ||
+ | {{Idiomas | ||
+ | | Repositorio de Custom Commands | ||
+ | | Custom Commands Repository | ||
+ | | カスタムコマンドのサンプル集 | ||
+ | }} | ||
+ | == Generar CNPJ == | ||
+ | '''Tipo''': Acción <br> | ||
+ | '''Descripción''': no tiene parametros (salida en variable &_resultCC) | ||
+ | |||
+ | <pre> | ||
+ | var n = 9; | ||
+ | var n1 = Math.round(Math.random()*n); | ||
+ | var n2 = Math.round(Math.random()*n); | ||
+ | var n3 = Math.round(Math.random()*n); | ||
+ | var n4 = Math.round(Math.random()*n); | ||
+ | var n5 = Math.round(Math.random()*n); | ||
+ | var n6 = Math.round(Math.random()*n); | ||
+ | var n7 = Math.round(Math.random()*n); | ||
+ | var n8 = Math.round(Math.random()*n); | ||
+ | var n9 = 0; | ||
+ | var n10 = 0; | ||
+ | var n11 = 0; | ||
+ | var n12 = 1; | ||
+ | var d1 = n12*2+n11*3+n10*4+n9*5+n8*6+n7*7+n6*8+n5*9+n4*2+n3*3+n2*4+n1*5; | ||
+ | d1 = 11 - ( Math.round(d1 - (Math.floor(d1/11)*11)) ); | ||
+ | if (d1>=10) d1 = 0; | ||
+ | var d2 = d1*2+n12*3+n11*4+n10*5+n9*6+n8*7+n7*8+n6*9+n5*2+n4*3+n3*4+n2*5+n1*6; | ||
+ | d2 = 11 - ( Math.round(d2 - (Math.floor(d2/11)*11)) ); | ||
+ | if (d2>=10) d2 = 0; | ||
+ | retorno = ''+n1+n2+n3+n4+n5+n6+n7+n8+n9+n10+n11+n12+d1+d2; | ||
+ | return retorno; | ||
+ | |||
+ | </pre> | ||
+ | |||
+ | == Generar CPF == | ||
+ | '''Tipo''': Acción <br> | ||
+ | '''Descripción''': no tiene parametros (salida en variable &_resultCC) | ||
+ | |||
+ | <pre> | ||
+ | |||
+ | var n = 9; | ||
+ | var n1 = Math.round(Math.random()*n); | ||
+ | var n2 = Math.round(Math.random()*n); | ||
+ | var n3 = Math.round(Math.random()*n); | ||
+ | var n4 = Math.round(Math.random()*n); | ||
+ | var n5 = Math.round(Math.random()*n); | ||
+ | var n6 = Math.round(Math.random()*n); | ||
+ | var n7 = Math.round(Math.random()*n); | ||
+ | var n8 = Math.round(Math.random()*n); | ||
+ | var n9 = Math.round(Math.random()*n); | ||
+ | var d1 = n9*2+n8*3+n7*4+n6*5+n5*6+n4*7+n3*8+n2*9+n1*10; | ||
+ | d1 = 11 - ( Math.round(d1 - (Math.floor(d1/11)*11)) ); | ||
+ | |||
+ | if (d1>=10) d1 = 0; | ||
+ | var d2 = d1*2+n9*3+n8*4+n7*5+n6*6+n5*7+n4*8+n3*9+n2*10+n1*11; | ||
+ | d2 = 11 - ( Math.round(d2 - (Math.floor(d2/11)*11)) ); | ||
+ | if (d2>=10) d2 = 0; | ||
+ | retorno = ''+n1+n2+n3+n4+n5+n6+n7+n8+n9+d1+d2; | ||
+ | return retorno; | ||
+ | |||
+ | </pre> | ||
+ | |||
== Go To Object == | == Go To Object == | ||
'''Tipo''': Evento <br> | '''Tipo''': Evento <br> | ||
Line 70: | Line 132: | ||
} | } | ||
</pre> | </pre> | ||
+ | |||
+ | |||
+ | |||
+ | == ClickConfirmPanelDVelop== | ||
+ | '''Tipo''': Acción <br> | ||
+ | '''Descripción''': Hace clic en un botón del UserControl DVelopConfirmPanel. Se debe especificar el texto del botón que se desea presionar (por ejemplo "Yes", o "No"). | ||
+ | |||
+ | <pre> | ||
+ | |||
+ | function CustomCommand (paramJS, currentGXVersion, currentLanguage) | ||
+ | { | ||
+ | var button=paramJS; | ||
+ | var buttons = window.document.getElementById('DVELOP_CONFIRMPANEL1Container_ConfirmPanel').children[2].children[0].children; | ||
+ | var selected = -1; | ||
+ | var i = 0; | ||
+ | while (i<buttons.length && selected==-1) { | ||
+ | if (buttons[i].innerHTML==button) { | ||
+ | selected = i; } | ||
+ | i++; | ||
+ | } | ||
+ | if (selected>-1) | ||
+ | { | ||
+ | buttons[selected].click(); | ||
+ | result = "OK"; | ||
+ | } | ||
+ | else | ||
+ | { | ||
+ | result = "The button " + button + " could not be found"; | ||
+ | } | ||
+ | return result; | ||
+ | |||
+ | } | ||
+ | </pre> | ||
+ | |||
+ | |||
+ | |||
+ | == ClickChangeImage == | ||
+ | '''Tipo''': Acción <br> | ||
+ | '''Descripción''': Hace clic en un botón Change de un campo multimedia (por ejemplo image), para GeneXus Ev2. Se debe especificar el nombre del atributo o variable de tipo multimedia.<br> | ||
+ | '''Ejemplo''': ClickChangeImage("ATTRACTIONPHOTO").<br> | ||
+ | |||
+ | [[Image:GXEv2ImageChangeDelete.png]] | ||
+ | |||
+ | <pre> | ||
+ | |||
+ | function CustomCommand (paramJS, currentGXVersion, currentLanguage) | ||
+ | { | ||
+ | |||
+ | window.document.getElementById(paramJS + '_ct').childNodes[0].focus(); | ||
+ | window.document.getElementById(paramJS + '_ct').childNodes[0].click(); | ||
+ | |||
+ | result = "OK"; | ||
+ | return result; | ||
+ | } | ||
+ | |||
+ | </pre> | ||
+ | |||
+ | |||
+ | == ClickDeleteImage == | ||
+ | '''Tipo''': Acción <br> | ||
+ | '''Descripción''': Hace clic en un botón Delete de un campo multimedia (por ejemplo image), para GeneXus Ev2. Se debe especificar el nombre del atributo o variable de tipo multimedia.<br> | ||
+ | '''Ejemplo''': ClickDeleteImage("ATTRACTIONPHOTO").<br> | ||
+ | |||
+ | [[Image:GXEv2ImageChangeDelete.png]] | ||
+ | |||
+ | <pre> | ||
+ | |||
+ | function CustomCommand (paramJS, currentGXVersion, currentLanguage) | ||
+ | { | ||
+ | |||
+ | window.document.getElementById(paramJS + '_ct').childNodes[1].focus(); | ||
+ | window.document.getElementById(paramJS + '_ct').childNodes[1].click(); | ||
+ | |||
+ | result = "OK"; | ||
+ | return result; | ||
+ | } | ||
+ | |||
+ | </pre> | ||
+ | |||
+ | |||
+ | == ClickSubMenuGXUI == | ||
+ | '''Tipo''': Evento <br> | ||
+ | '''Descripción''': Hace clic en un menú tree de gxui, sobre menús que tengan definido submenús y optiones dentro de éstos. <br> | ||
+ | '''Ejemplo''': ClickSubMenuGXUI("Gestión Unificada de Clientes/Prospecto Incompleto").<br> | ||
+ | |||
+ | [[Image:EjemplogxuiSubmenu.PNG]] | ||
+ | |||
+ | <pre> | ||
+ | function CustomCommand (paramJS, currentGXVersion, currentLanguage) | ||
+ | { | ||
+ | var submenu = paramJS.split('/')[0]; | ||
+ | var opcion = paramJS.split('/')[1]; | ||
+ | var subMenuid = 'ob'+submenu; | ||
+ | while(subMenuid.indexOf(' ')>0) | ||
+ | subMenuid = subMenuid.replace(' ',''); | ||
+ | window.document.getElementById(subMenuid).childNodes[0].click(); | ||
+ | |||
+ | var rows = window.document.getElementById(subMenuid+"-body").childNodes[0].childNodes[0].rows; | ||
+ | |||
+ | for(i=0; i<rows.length; i++) { | ||
+ | if (rows[i].childNodes[0].childNodes[0]!=undefined && rows[i].childNodes[0].childNodes[0].innerText==opcion ) { | ||
+ | rows[i].childNodes[0].childNodes[0].click(); | ||
+ | } | ||
+ | } | ||
+ | |||
+ | result = "OK"; | ||
+ | /* It must be returned in result variable the value "OK" if the command executed successufuly, or an error description in other case*/ | ||
+ | return result; | ||
+ | } | ||
+ | </pre> | ||
+ | |||
+ | |||
+ | Ejemplo: | ||
+ | |||
+ | |||
+ | [[Image:ClickSubMenugxui.PNG]] |
Latest revision as of 19:01, 1 March 2017
Contents |
Generar CNPJ
Tipo: Acción
Descripción: no tiene parametros (salida en variable &_resultCC)
var n = 9; var n1 = Math.round(Math.random()*n); var n2 = Math.round(Math.random()*n); var n3 = Math.round(Math.random()*n); var n4 = Math.round(Math.random()*n); var n5 = Math.round(Math.random()*n); var n6 = Math.round(Math.random()*n); var n7 = Math.round(Math.random()*n); var n8 = Math.round(Math.random()*n); var n9 = 0; var n10 = 0; var n11 = 0; var n12 = 1; var d1 = n12*2+n11*3+n10*4+n9*5+n8*6+n7*7+n6*8+n5*9+n4*2+n3*3+n2*4+n1*5; d1 = 11 - ( Math.round(d1 - (Math.floor(d1/11)*11)) ); if (d1>=10) d1 = 0; var d2 = d1*2+n12*3+n11*4+n10*5+n9*6+n8*7+n7*8+n6*9+n5*2+n4*3+n3*4+n2*5+n1*6; d2 = 11 - ( Math.round(d2 - (Math.floor(d2/11)*11)) ); if (d2>=10) d2 = 0; retorno = ''+n1+n2+n3+n4+n5+n6+n7+n8+n9+n10+n11+n12+d1+d2; return retorno;
Generar CPF
Tipo: Acción
Descripción: no tiene parametros (salida en variable &_resultCC)
var n = 9; var n1 = Math.round(Math.random()*n); var n2 = Math.round(Math.random()*n); var n3 = Math.round(Math.random()*n); var n4 = Math.round(Math.random()*n); var n5 = Math.round(Math.random()*n); var n6 = Math.round(Math.random()*n); var n7 = Math.round(Math.random()*n); var n8 = Math.round(Math.random()*n); var n9 = Math.round(Math.random()*n); var d1 = n9*2+n8*3+n7*4+n6*5+n5*6+n4*7+n3*8+n2*9+n1*10; d1 = 11 - ( Math.round(d1 - (Math.floor(d1/11)*11)) ); if (d1>=10) d1 = 0; var d2 = d1*2+n9*3+n8*4+n7*5+n6*6+n5*7+n4*8+n3*9+n2*10+n1*11; d2 = 11 - ( Math.round(d2 - (Math.floor(d2/11)*11)) ); if (d2>=10) d2 = 0; retorno = ''+n1+n2+n3+n4+n5+n6+n7+n8+n9+d1+d2; return retorno;
Go To Object
Tipo: Evento
Descripción: se pasa por parámetro un nombre de un objeto GeneXus y navega a la url de dicho objeto.
if (currentLanguage=="java") { window.location=paramJS; } else if (currentLanguage=="net") { window.location=paramJS+".aspx"; } else { window.alert("language: " + currentLanguage); } result = "OK"; return result;
VerifyUrl
Tipo: Validacion
Descripción: se pasa por parámetro una url y valida que la url del browser coincida con dicha url
var url=window.document.location.href; if(url.indexOf(paramJS)==-1) result = "OK"; else result="falla";
VerifyTitle
Tipo: Validacion
Descripción: se pasa por parámetro un titulo y valida que el titulo del browser coincida con el pasado como parámetro.
if (document.location.href.indexOf(paramJS)!=-1) { result = "OK"; } else { result= "The string ("+paramJS+") is not in the url ("+document.location.href+")"; }
ClickGridButtons
Tipo: Acción
Descripción: Hace click en el paginado automático de una grid de Evolution, se pasa por parámetro "First", "Previous", "Next" o "Last".
function CustomCommand (paramJS, currentGXVersion, currentLanguage) { windows.document.getElementsByClassName("PagingButtons" + paramJS)[0].click(); result = "OK"; return result; }
ClickConfirmPanelDVelop
Tipo: Acción
Descripción: Hace clic en un botón del UserControl DVelopConfirmPanel. Se debe especificar el texto del botón que se desea presionar (por ejemplo "Yes", o "No").
function CustomCommand (paramJS, currentGXVersion, currentLanguage) { var button=paramJS; var buttons = window.document.getElementById('DVELOP_CONFIRMPANEL1Container_ConfirmPanel').children[2].children[0].children; var selected = -1; var i = 0; while (i<buttons.length && selected==-1) { if (buttons[i].innerHTML==button) { selected = i; } i++; } if (selected>-1) { buttons[selected].click(); result = "OK"; } else { result = "The button " + button + " could not be found"; } return result; }
ClickChangeImage
Tipo: Acción
Descripción: Hace clic en un botón Change de un campo multimedia (por ejemplo image), para GeneXus Ev2. Se debe especificar el nombre del atributo o variable de tipo multimedia.
Ejemplo: ClickChangeImage("ATTRACTIONPHOTO").
function CustomCommand (paramJS, currentGXVersion, currentLanguage) { window.document.getElementById(paramJS + '_ct').childNodes[0].focus(); window.document.getElementById(paramJS + '_ct').childNodes[0].click(); result = "OK"; return result; }
ClickDeleteImage
Tipo: Acción
Descripción: Hace clic en un botón Delete de un campo multimedia (por ejemplo image), para GeneXus Ev2. Se debe especificar el nombre del atributo o variable de tipo multimedia.
Ejemplo: ClickDeleteImage("ATTRACTIONPHOTO").
function CustomCommand (paramJS, currentGXVersion, currentLanguage) { window.document.getElementById(paramJS + '_ct').childNodes[1].focus(); window.document.getElementById(paramJS + '_ct').childNodes[1].click(); result = "OK"; return result; }
ClickSubMenuGXUI
Tipo: Evento
Descripción: Hace clic en un menú tree de gxui, sobre menús que tengan definido submenús y optiones dentro de éstos.
Ejemplo: ClickSubMenuGXUI("Gestión Unificada de Clientes/Prospecto Incompleto").
function CustomCommand (paramJS, currentGXVersion, currentLanguage) { var submenu = paramJS.split('/')[0]; var opcion = paramJS.split('/')[1]; var subMenuid = 'ob'+submenu; while(subMenuid.indexOf(' ')>0) subMenuid = subMenuid.replace(' ',''); window.document.getElementById(subMenuid).childNodes[0].click(); var rows = window.document.getElementById(subMenuid+"-body").childNodes[0].childNodes[0].rows; for(i=0; i<rows.length; i++) { if (rows[i].childNodes[0].childNodes[0]!=undefined && rows[i].childNodes[0].childNodes[0].innerText==opcion ) { rows[i].childNodes[0].childNodes[0].click(); } } result = "OK"; /* It must be returned in result variable the value "OK" if the command executed successufuly, or an error description in other case*/ return result; }
Ejemplo: