{"id":7804,"date":"2024-03-01T07:00:05","date_gmt":"2024-03-01T10:00:05","guid":{"rendered":"https:\/\/blog.botcity.dev\/?p=7804"},"modified":"2024-04-25T03:00:27","modified_gmt":"2024-04-25T06:00:27","slug":"como-construir-uma-automacao-desktop-em-python-para-acessar-vms-por-conexao-rdp","status":"publish","type":"post","link":"https:\/\/blog.botcity.dev\/pt-br\/2024\/03\/01\/como-construir-uma-automacao-desktop-em-python-para-acessar-vms-por-conexao-rdp\/","title":{"rendered":"Como construir uma automa\u00e7\u00e3o desktop em Python para acessar VMs por conex\u00e3o RDP?"},"content":{"rendered":"<p><span style=\"font-weight: 400;\">Em algumas ocasi\u00f5es, temos a necessidade de construir automa\u00e7\u00f5es RPA para atender processos que acontecem em VMs (Virtual Machines, ou seja, M\u00e1quinas Virtuais) diferentes. Neste artigo, vamos entender melhor o que \u00e9 conex\u00e3o RDP e como utilizar a seu favor no momento de acessar sistemas em <\/span><a href=\"https:\/\/blog.botcity.dev\/pt-br\/2023\/11\/27\/maquina-virtual\/\"><span style=\"font-weight: 400;\">m\u00e1quinas virtuais<\/span><\/a><span style=\"font-weight: 400;\"> para que seu processo seja automatizado.<\/span><\/p>\n<h2><span style=\"font-weight: 400;\">O que \u00e9 conex\u00e3o RDP?<\/span><\/h2>\n<p><span style=\"font-weight: 400;\">Conex\u00e3o RDP, ou Remote Desktop Protocol, que significa Protocolo de \u00c1rea de Trabalho Remota, trata-se de um protocolo que foi desenvolvido pela Microsoft para controlar remotamente um computador por uma interface gr\u00e1fica, fornecendo acesso remoto pelo sistema operacional Windows de maneira segura e eficiente.<\/span><\/p>\n<h2><span style=\"font-weight: 400;\">Como se conectar em uma VM pela conex\u00e3o RDP?<\/span><\/h2>\n<p><span style=\"font-weight: 400;\">Para que voc\u00ea possa se conectar a um computador remoto utilizando o protocolo RDP, \u00e9 necess\u00e1rio saber o endere\u00e7o IP ou o nome deste computador, o usu\u00e1rio e a senha. Se o processo fosse manual, voc\u00ea precisaria seguir os seguintes passos:<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">No computador local, pesquise por \u201cConex\u00e3o de \u00c1rea de Trabalho Remota\u201d no menu Iniciar do Windows e clique no aplicativo sugerido;<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Insira no campo \u201cComputador\u201d o nome do computador ou ent\u00e3o seu endere\u00e7o IP;<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Em seguida, clique em \u201cConectar\u201d e, quando solicitado, insira as credenciais com nome de usu\u00e1rio e senha para que a autentica\u00e7\u00e3o aconte\u00e7a com sucesso;<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Ap\u00f3s a autentica\u00e7\u00e3o, voc\u00ea poder\u00e1 ter acesso normalmente ao computador remoto.<\/span><\/li>\n<\/ul>\n<p><span style=\"font-weight: 400;\">Mas, como vamos construir uma automa\u00e7\u00e3o RPA para acessar um computador de outro, vamos utilizar o poder da <\/span><a href=\"https:\/\/blog.botcity.dev\/pt-br\/2023\/11\/28\/visao-computacional\/\"><span style=\"font-weight: 400;\">vis\u00e3o computacional<\/span><\/a><span style=\"font-weight: 400;\"> para fazer todo esse processo de maneira automatizada.<\/span><\/p>\n<h2><span style=\"font-weight: 400;\">O que saber antes de construir sua automa\u00e7\u00e3o RPA<\/span><\/h2>\n<p><span style=\"font-weight: 400;\">Para que sua automa\u00e7\u00e3o consiga fazer os processos necess\u00e1rios, \u00e9 importante garantir que o seu computador local, ou a VM que vai executar o rob\u00f4 para acessar a outra VM onde os sistemas est\u00e3o, tenha os permissionamentos necess\u00e1rios para executar comandos em powershell, scripts etc.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Tamb\u00e9m \u00e9 importante que identifique quais s\u00e3o as tarefas a serem automatizadas e valide todas as credenciais que ser\u00e3o necess\u00e1rias para acessar as VMs e os sistemas envolvidos. Al\u00e9m disso, considere guardar essas credenciais de maneira segura. No passo a passo, vamos entender como fazer isso pelo <\/span><a href=\"https:\/\/blog.botcity.dev\/pt-br\/2023\/11\/13\/orquestracao\/\"><span style=\"font-weight: 400;\">BotCity Orquestrador<\/span><\/a><span style=\"font-weight: 400;\">.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Outro cuidado importante ser\u00e1 a quest\u00e3o das resolu\u00e7\u00f5es da VM. Isto porque vamos utilizar a vis\u00e3o computacional para procurar pelos recortes das telas, visto que todas as etapas ser\u00e3o pela \u00e1rea de trabalho. Ent\u00e3o, durante o processo de desenvolvimento, vamos considerar a configura\u00e7\u00e3o fixa das resolu\u00e7\u00f5es.<\/span><\/p>\n<h2><span style=\"font-weight: 400;\">Por que utilizar conex\u00e3o RDP para sua automa\u00e7\u00e3o?<\/span><\/h2>\n<p><span style=\"font-weight: 400;\">Essa abordagem pode ser bastante \u00fatil em casos nos quais n\u00e3o temos a possibilidade de executar scripts e comandos diretamente no computador alvo.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Al\u00e9m disso, tamb\u00e9m pode ser um grande apoio para sua automa\u00e7\u00e3o, caso s\u00f3 exista a possibilidade de acessar o software que ser\u00e1 automatizado, atrav\u00e9s de uma conex\u00e3o remota.<\/span><\/p>\n<h2><span style=\"font-weight: 400;\">Exemplo de desenvolvimento\u00a0<\/span><\/h2>\n<p><span style=\"font-weight: 400;\">Nossa automa\u00e7\u00e3o dever\u00e1 acessar uma m\u00e1quina virtual por uma conex\u00e3o RDP do Windows para cadastrar produtos de um arquivo do tipo .json no sistema <\/span><a href=\"https:\/\/www.fakturama.info\/\"><span style=\"font-weight: 400;\">Fakturama<\/span><\/a><span style=\"font-weight: 400;\">, software desktop gratuito para gerenciamento de produtos e notas fiscais.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Segue o exemplo de arquivo com os produtos chamado payload.json para serem cadastrados:<\/span><\/p>\n<pre><span style=\"font-weight: 400;\">{<\/span>\r\n\r\n<span style=\"font-weight: 400;\">    \"load\": {<\/span>\r\n<span style=\"font-weight: 400;\">        \"customer\": \"BOTTEST\",<\/span>\r\n<span style=\"font-weight: 400;\">        \"products\": [<\/span>\r\n<span style=\"font-weight: 400;\">            {<\/span>\r\n<span style=\"font-weight: 400;\">                \"item_number\": \"0000000000001\",<\/span>\r\n<span style=\"font-weight: 400;\">                \"name\": \"PRODUCT DEMO 1\",<\/span>\r\n<span style=\"font-weight: 400;\">                \"category\": \"ELECTRONICS\",<\/span>\r\n<span style=\"font-weight: 400;\">                \"gtin\": \"0000000000123\",<\/span>\r\n<span style=\"font-weight: 400;\">                \"supplier_code\": \"SUPPLIER1\",<\/span>\r\n<span style=\"font-weight: 400;\">                \"description\": \"PRODUCT DEMO 1\",<\/span>\r\n<span style=\"font-weight: 400;\">                \"price\": \"100.00\",<\/span>\r\n<span style=\"font-weight: 400;\">                \"cost\": \"50.00\",<\/span>\r\n<span style=\"font-weight: 400;\">                \"allowance\": \"0.00\",<\/span>\r\n<span style=\"font-weight: 400;\">                \"vat\": \"Free of Tax\",<\/span>\r\n<span style=\"font-weight: 400;\">                \"stock\": \"100\"<\/span>\r\n<span style=\"font-weight: 400;\">            },<\/span>\r\n<span style=\"font-weight: 400;\">            {<\/span>\r\n<span style=\"font-weight: 400;\">                \"item_number\": \"0000000000002\",<\/span>\r\n<span style=\"font-weight: 400;\">                \"name\": \"PRODUCT DEMO 2\",<\/span>\r\n<span style=\"font-weight: 400;\">                \"category\": \"ELECTRONICS\",<\/span>\r\n<span style=\"font-weight: 400;\">                \"gtin\": \"0000000000124\",<\/span>\r\n<span style=\"font-weight: 400;\">                \"supplier_code\": \"SUPPLIER1\",<\/span>\r\n<span style=\"font-weight: 400;\">                \"description\": \"PRODUCT DEMO 2\",<\/span>\r\n<span style=\"font-weight: 400;\">                \"price\": \"94.90\",<\/span>\r\n<span style=\"font-weight: 400;\">                \"cost\": \"47.50\",<\/span>\r\n<span style=\"font-weight: 400;\">                \"allowance\": \"1.90\",<\/span>\r\n<span style=\"font-weight: 400;\">                \"vat\": \"Free of Tax\",<\/span>\r\n<span style=\"font-weight: 400;\">                \"stock\": \"143\"<\/span>\r\n<span style=\"font-weight: 400;\">            }<\/span>\r\n<span style=\"font-weight: 400;\">        ]<\/span>\r\n<span style=\"font-weight: 400;\">    }<\/span>\r\n<span style=\"font-weight: 400;\">}\r\n<\/span><\/pre>\n<p><span style=\"font-weight: 400;\">Al\u00e9m disso, seguem um modelo de arquitetura para o nosso caso de exemplo com o BotCity Orchestrator, que precisa ser atendido:<\/span><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" data-attachment-id=\"7808\" data-permalink=\"https:\/\/blog.botcity.dev\/pt-br\/2024\/03\/01\/como-construir-uma-automacao-desktop-em-python-para-acessar-vms-por-conexao-rdp\/arquitetura\/\" data-orig-file=\"https:\/\/blog.botcity.dev\/wp-content\/uploads\/2024\/02\/arquitetura.png\" data-orig-size=\"911,540\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"arquitetura\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/blog.botcity.dev\/wp-content\/uploads\/2024\/02\/arquitetura.png\" class=\"aligncenter wp-image-7808 size-full\" src=\"https:\/\/blog.botcity.dev\/wp-content\/uploads\/2024\/02\/arquitetura.png\" alt=\"mostrando como funcionar\u00e1 a arquitetura. Do lado esquerdo um servidor representando o Orquestrador. E ele se conecta a um grupo de computadores. Nesse grupo tem uma VM Windows com o BotCity Runner e outtra VM com o Fakturama. Essas duas VMs tem uma seta conectando-as com o texto RDP Connection.\" width=\"911\" height=\"540\" srcset=\"https:\/\/blog.botcity.dev\/wp-content\/uploads\/2024\/02\/arquitetura.png 911w, https:\/\/blog.botcity.dev\/wp-content\/uploads\/2024\/02\/arquitetura-300x178.png 300w\" sizes=\"auto, (max-width: 911px) 100vw, 911px\" \/><\/p>\n<p>&nbsp;<\/p>\n<h2><span style=\"font-weight: 400;\">Como acessar um computador remoto pela automa\u00e7\u00e3o<\/span><\/h2>\n<p><span style=\"font-weight: 400;\">Para desenvolver essa automa\u00e7\u00e3o, vamos utilizar o framework Python para desktop. Voc\u00ea pode acompanhar os primeiros passos por este <\/span><a href=\"https:\/\/documentation.botcity.dev\/tutorials\/python-automations\/desktop\/\"><span style=\"font-weight: 400;\">tutorial em nossa documenta\u00e7\u00e3o<\/span><\/a><span style=\"font-weight: 400;\"> e tamb\u00e9m realizar a <\/span><a href=\"https:\/\/documentation.botcity.dev\/studio\/vscode\/\"><span style=\"font-weight: 400;\">instala\u00e7\u00e3o do plugin do BotCity Studio para Visual Studio Code<\/span><\/a><span style=\"font-weight: 400;\">, caso seja essa a IDE que voc\u00ea utilize.<\/span><\/p>\n<p>&nbsp;<\/p>\n<p><span style=\"font-weight: 400;\">Seguindo o passo a passo, voc\u00ea ter\u00e1 um projeto com a seguinte estrutura (estamos chamando o rob\u00f4 de BotRDP):<\/span><\/p>\n<p><span style=\"font-weight: 400;\">BotRDP<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u251c\u2500\u2500 bot.py: aqui \u00e9 onde iremos trabalhar e desenvolver nosso rob\u00f4.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u251c\u2500\u2500 resources: pasta contendo os arquivos auxiliares para o rob\u00f4.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u251c\u2500\u2500 build.bat: script em Batch para gerar o pacote.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u251c\u2500\u2500 build.ps1: script em PowerShell para gerar o pacote.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u251c\u2500\u2500 build.sh: shell script para gerar o pacote.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u251c\u2500\u2500 requirements.txt: arquivo descrevendo todas depend\u00eancias externas para seu rob\u00f4.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u2514\u2500\u2500 BotRDP.botproj: arquivo utilizado para carregar o projeto no BotStudio, caso n\u00e3o utilize pelo plugin do Visual Studio Code.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Dentro dessa estrutura, vamos adicionar na pasta resources, o arquivo payload.json que cont\u00e9m os produtos a serem cadastrados. Ou, caso prefira, voc\u00ea pode enviar o conte\u00fado do arquivo como par\u00e2metro para sua automa\u00e7\u00e3o.\u00a0<\/span><\/p>\n<p><b>Saiba mais<\/b><span style=\"font-weight: 400;\">: <\/span><a href=\"https:\/\/documentation.botcity.dev\/maestro\/features\/new-task\/#parameters\"><span style=\"font-weight: 400;\">Documenta\u00e7\u00e3o de par\u00e2metros da automa\u00e7\u00e3o<\/span><\/a><\/p>\n<h3><span style=\"font-weight: 400;\">Lendo o arquivo payload.json<\/span><\/h3>\n<pre># abrindo o arquivo .json\r\nwith open(r'resources\\payload.json') as json_file:\r\njson_data = json.load(json_file)\r\n\r\n# definindo um nome para poder buscar as credenciais de acordo com o nome do cliente\r\ncustomer_label = json_data[\"load\"][\"customer\"]\r\n\r\n# definindo um nome para a lista de produtos que consta no arquivo payload.json\r\nproducts = json_data[\"load\"][\"products\"]<\/pre>\n<h3><span style=\"font-weight: 400;\">Como adicionar as credenciais no BotCity Orquestrador<\/span><\/h3>\n<p><span style=\"font-weight: 400;\">Para seguran\u00e7a da sua automa\u00e7\u00e3o, voc\u00ea pode utilizar a funcionalidade de <\/span><a href=\"https:\/\/documentation.botcity.dev\/maestro\/features\/credentials\/\"><span style=\"font-weight: 400;\">Credenciais<\/span><\/a><span style=\"font-weight: 400;\"> que est\u00e1 dispon\u00edvel no BotCity Orquestrador.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">No menu da lateral esquerda do orquestrador, identifique a op\u00e7\u00e3o \u201cCredentials\u201d em \u201cOperation Tools\u201d. Clique em \u201cNew Credential\u201d e adicione as informa\u00e7\u00f5es solicitadas:<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Label: adicione o nome da credencial;<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Repository: insira o reposit\u00f3rio que poder\u00e1 ter acesso a essas credenciais;<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Secrets: clique em \u201cAdd\u201d para adicionar as informa\u00e7\u00f5es:<\/span>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"2\"><span style=\"font-weight: 400;\">Key: nome da chave da credencial;<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"2\"><span style=\"font-weight: 400;\">Value: o valor da credencial.<\/span><\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p><span style=\"font-weight: 400;\">Voc\u00ea pode adicionar quantas chave\/valor forem necess\u00e1rias.<\/span><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" data-attachment-id=\"7815\" data-permalink=\"https:\/\/blog.botcity.dev\/pt-br\/2024\/03\/01\/como-construir-uma-automacao-desktop-em-python-para-acessar-vms-por-conexao-rdp\/new-credential-2\/\" data-orig-file=\"https:\/\/blog.botcity.dev\/wp-content\/uploads\/2024\/02\/new-credential-1.png\" data-orig-size=\"1911,764\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"new credential\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/blog.botcity.dev\/wp-content\/uploads\/2024\/02\/new-credential-1-1024x409.png\" class=\"aligncenter wp-image-7815 size-full\" src=\"https:\/\/blog.botcity.dev\/wp-content\/uploads\/2024\/02\/new-credential-1.png\" alt=\"print da tela para criar nova credencial mostrando os campos citados no texto.\" width=\"1911\" height=\"764\" srcset=\"https:\/\/blog.botcity.dev\/wp-content\/uploads\/2024\/02\/new-credential-1.png 1911w, https:\/\/blog.botcity.dev\/wp-content\/uploads\/2024\/02\/new-credential-1-300x120.png 300w, https:\/\/blog.botcity.dev\/wp-content\/uploads\/2024\/02\/new-credential-1-1024x409.png 1024w, https:\/\/blog.botcity.dev\/wp-content\/uploads\/2024\/02\/new-credential-1-1536x614.png 1536w, https:\/\/blog.botcity.dev\/wp-content\/uploads\/2024\/02\/new-credential-1-1200x480.png 1200w\" sizes=\"auto, (max-width: 1911px) 100vw, 1911px\" \/><\/p>\n<p><span style=\"font-weight: 400;\">Em nosso exemplo vamos fazer da seguinte maneira:<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Label: BOTTEST;<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Repository: DEFAULT;<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Secrets:<\/span>\n<ul>\n<li style=\"font-weight: 400;\" aria-level=\"1\"><span style=\"font-weight: 400;\">Key: remote_ip;<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"2\"><span style=\"font-weight: 400;\">Key: username;<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"2\"><span style=\"font-weight: 400;\">Key: password;<\/span><\/li>\n<li style=\"font-weight: 400;\" aria-level=\"2\"><span style=\"font-weight: 400;\">E para cada uma das keys, adicione seus respectivos valores.<\/span><\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p><img loading=\"lazy\" decoding=\"async\" data-attachment-id=\"7817\" data-permalink=\"https:\/\/blog.botcity.dev\/pt-br\/2024\/03\/01\/como-construir-uma-automacao-desktop-em-python-para-acessar-vms-por-conexao-rdp\/credential-keys\/\" data-orig-file=\"https:\/\/blog.botcity.dev\/wp-content\/uploads\/2024\/02\/credential-keys.png\" data-orig-size=\"1906,771\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"credential keys\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/blog.botcity.dev\/wp-content\/uploads\/2024\/02\/credential-keys-1024x414.png\" class=\"aligncenter wp-image-7817 size-full\" src=\"https:\/\/blog.botcity.dev\/wp-content\/uploads\/2024\/02\/credential-keys.png\" alt=\"print da tela para criar nova credencial mostrando os campos citados no texto e com os dados preenchidos conforme descrito acima.\" width=\"1906\" height=\"771\" srcset=\"https:\/\/blog.botcity.dev\/wp-content\/uploads\/2024\/02\/credential-keys.png 1906w, https:\/\/blog.botcity.dev\/wp-content\/uploads\/2024\/02\/credential-keys-300x121.png 300w, https:\/\/blog.botcity.dev\/wp-content\/uploads\/2024\/02\/credential-keys-1024x414.png 1024w, https:\/\/blog.botcity.dev\/wp-content\/uploads\/2024\/02\/credential-keys-1536x621.png 1536w, https:\/\/blog.botcity.dev\/wp-content\/uploads\/2024\/02\/credential-keys-1200x485.png 1200w\" sizes=\"auto, (max-width: 1906px) 100vw, 1906px\" \/><\/p>\n<p><span style=\"font-weight: 400;\">No c\u00f3digo, voc\u00ea poder\u00e1 acessar as credenciais da seguinte forma:<\/span><\/p>\n<pre><span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0remote_ip = maestro.get_credential(customer_label, \"remote_ip\")<\/span>\r\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0username = maestro.get_credential(customer_label, \"username\")<\/span>\r\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0password = maestro.get_credential(customer_label, \"password\")<\/span><\/pre>\n<p><span style=\"font-weight: 400;\">Observa\u00e7\u00e3o: caso voc\u00ea queira executar o rob\u00f4 localmente, para que voc\u00ea consiga se conectar ao Orquestrador e validar que est\u00e1 conseguindo acessar a credencial, voc\u00ea precisa adicionar primeiro esse c\u00f3digo para fazer login na ferramenta:<\/span><span style=\"font-weight: 400;\"><br \/>\n<\/span><\/p>\n<pre><span style=\"font-weight: 400;\">maestro.login(<\/span>\r\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0server=\"adicione o server aqui\",\u00a0<\/span>\r\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0login=\"adicione o login aqui\",<\/span>\r\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0key=\"adicione a chave aqui\"<\/span>\r\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0)<\/span><\/pre>\n<p><span style=\"font-weight: 400;\">Para saber qual \u00e9 o login e a key para esse login ser feito com sucesso, voc\u00ea dever\u00e1 acessar a \u00e1rea chamada \u201cDev Environment\u201d pelo menu da lateral esquerda do seu orquestrador. Saiba mais em: <\/span><a href=\"https:\/\/documentation.botcity.dev\/maestro\/features\/dev-environment\/\"><span style=\"font-weight: 400;\">documenta\u00e7\u00e3o de Dev Environment<\/span><\/a><span style=\"font-weight: 400;\">.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u26a0\ufe0fLembre-se de que este trecho de c\u00f3digo servir\u00e1 apenas para executar localmente. Voc\u00ea deve retirar esse c\u00f3digo antes de disponibilizar o rob\u00f4 no orquestrador para ser executado automaticamente.<\/span><\/p>\n<h3><span style=\"font-weight: 400;\">Como criar uma fun\u00e7\u00e3o para conectar na VM por RDP<\/span><\/h3>\n<p><span style=\"font-weight: 400;\">Para nos conectarmos ao computador remoto, vamos utilizar a biblioteca subprocess do Python, que nos ajudar\u00e1 a executar o powershell, facilitando a abertura da conex\u00e3o. Entenda como fizemos o c\u00f3digo, criando um novo arquivo commands.py e adicionando o seguinte c\u00f3digo:<\/span><\/p>\n<pre><span style=\"font-weight: 400;\">import subprocess<\/span>\r\n\r\n<span style=\"font-weight: 400;\">def run_start_rdp(remote_ip: str, user: str, password: str):<\/span>\r\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0# comando para iniciar a sess\u00e3o: mstsc<\/span>\r\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0start_rdp_command = f'''<\/span>\r\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0cmdkey \/generic:\"{remote_ip}\" \/user:\"{user}\" \/pass:\"{password}\"<\/span>\r\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0mstsc \/v:{remote_ip} \/w:1600 \/h:900<\/span>\r\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0cmdkey \/delete:{remote_ip}'''<\/span>\r\n\r\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0# executando o powershell com o comando criado acima<\/span>\r\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0subprocess.run([\"powershell\", start_rdp_command])<\/span><\/pre>\n<p><span style=\"font-weight: 400;\">No comando, os itens \/w e \/h s\u00e3o para configurar de maneira fixa a resolu\u00e7\u00e3o da tela do computador remoto que voc\u00ea vai acessar. Fixar a resolu\u00e7\u00e3o e posicionamento, como faremos em outras partes do c\u00f3digo tamb\u00e9m, ajudar\u00e1 a garantir a execu\u00e7\u00e3o da automa\u00e7\u00e3o com sucesso.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">\u26a0\ufe0fObserve que nas primeiras execu\u00e7\u00f5es, podem ser que apare\u00e7am caixas de di\u00e1logo para algumas confirma\u00e7\u00f5es de certificado ou ainda de login e senha para a conex\u00e3o RDP. Voc\u00ea pode utilizar a vis\u00e3o computacional para interagir com essas caixas de di\u00e1logo ou ainda deixar um check na op\u00e7\u00e3o \u201cn\u00e3o aparecer novamente\u201d.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Ap\u00f3s isso, basta fazer a importa\u00e7\u00e3o deste arquivo no seu c\u00f3digo principal:<\/span><span style=\"font-weight: 400;\"><br \/>\n<\/span><\/p>\n<pre><span style=\"font-weight: 400;\">from commands import run_start_rdp<\/span><\/pre>\n<p><span style=\"font-weight: 400;\">E, depois, adicionar a chamada da fun\u00e7\u00e3o:<\/span><\/p>\n<pre><span style=\"font-weight: 400;\"># j\u00e1 possuir\u00e1 os par\u00e2metros por ter buscado a informa\u00e7\u00e3o nas credenciais do Orquestrador<\/span>\r\n<span style=\"font-weight: 400;\">run_start_rdp(remote_ip, username, password)<\/span><\/pre>\n<h3><span style=\"font-weight: 400;\">Como deixar a tela da VM em foco para a execu\u00e7\u00e3o da automa\u00e7\u00e3o\u00a0<\/span><\/h3>\n<p><span style=\"font-weight: 400;\">Vamos adicionar o seguinte trecho de c\u00f3digo:<\/span><span style=\"font-weight: 400;\"><br \/>\n<\/span><\/p>\n<pre><span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0bot.connect_to_app(best_match=\"Conex\u00e3o de \u00c1rea de Trabalho Remota\", timeout=30000)<\/span>\r\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0main_rdp_window = bot.app.top_window()<\/span>\r\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0main_rdp_window.set_focus()<\/span>\r\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0bot.wait(3000)<\/span><\/pre>\n<p><span style=\"font-weight: 400;\">Pode ser uma boa pr\u00e1tica em algumas etapas do c\u00f3digo, voc\u00ea utilizar a <\/span><a href=\"https:\/\/documentation.botcity.dev\/frameworks\/desktop\/waits\/\"><span style=\"font-weight: 400;\">fun\u00e7\u00e3o wait()<\/span><\/a><span style=\"font-weight: 400;\"> do framework da BotCity. Lembre-se de que voc\u00ea estar\u00e1 executando algo em uma m\u00e1quina virtual, que pode ser normalmente mais lenta que um computador local.<\/span><\/p>\n<h3><span style=\"font-weight: 400;\">Fakturama<\/span><\/h3>\n<p><span style=\"font-weight: 400;\">Para abrir o Fakturama, vamos fazer uma pesquisa na barra do menu Iniciar do Windows da m\u00e1quina virtual. Mas antes dessa pesquisa ser feita, vamos limitar a \u00e1rea em que ela deve acontecer, para que assim a vis\u00e3o computacional n\u00e3o confunda o recorte feito com o seu computador local ou com a VM incorreta.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Ent\u00e3o antes de abrir, vamos garantir a posi\u00e7\u00e3o da janela:<\/span><\/p>\n<pre><span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0main_rdp_window = bot.app.top_window()<\/span>\r\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0window_rect = main_rdp_window.client_rect()<\/span>\r\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0x, y, width, height = window_rect.left, window_rect.top, window_rect.width() + 50, window_rect.height() + 50<\/span><\/pre>\n<p><span style=\"font-weight: 400;\">Neste c\u00f3digo, x e y s\u00e3o a posi\u00e7\u00e3o da tela e width e height ser\u00e3o a garantia da resolu\u00e7\u00e3o da tela que, no in\u00edcio, para nos conectarmos ao computador remoto, deixamos configurado de maneira fixa como 1600 x 900. Ou seja, a consulta vai considerar apenas dentro dessa tela e n\u00e3o fora dela, evitando problemas de confundir em qual tela dever\u00e1 encontrar o que ser\u00e1 pedido.<\/span><\/p>\n<p><b>Mapeando a barra de pesquisa do menu iniciar da VM por vis\u00e3o computacional<\/b><\/p>\n<p><span style=\"font-weight: 400;\">Podemos seguir os pr\u00f3ximos passos utilizando o plugin do BotStudio para Visual Studio Code. Se quiser fazer dessa forma, lembre-se de que deve seguir o passo a passo da instala\u00e7\u00e3o e configura\u00e7\u00e3o da <\/span><a href=\"https:\/\/documentation.botcity.dev\/studio\/vscode\/\"><span style=\"font-weight: 400;\">documenta\u00e7\u00e3o do plugin do Studio<\/span><\/a><span style=\"font-weight: 400;\">.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Lembrando que, caso v\u00e1 utilizar o Fakturama para seguir o exemplo, ele dever\u00e1 ser instalado seguindo as instru\u00e7\u00f5es da <\/span><a href=\"https:\/\/www.fakturama.info\/\"><span style=\"font-weight: 400;\">documenta\u00e7\u00e3o do Fakturama<\/span><\/a><span style=\"font-weight: 400;\">.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">No Visual Studio Code, deixe o cursor no local onde o novo c\u00f3digo dever\u00e1 ser inserido automaticamente. Clique no plugin no menu lateral esquerdo e voc\u00ea ter\u00e1 a janela dispon\u00edvel para tirar os prints dos recortes que deseja mapear para a sua automa\u00e7\u00e3o.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Neste momento, vamos mapear o \u00edcone de pesquisa para digitarmos \u201cFaktumara.exe\u201d no menu Iniciar do Windows da m\u00e1quina virtual.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Deixe a tela do BotCity Studio em cima da tela que vamos tirar o print. Clique no \u00edcone que consta no menu da lateral esquerda identificado como \u201cScreenshot\u201d com o s\u00edmbolo de uma m\u00e1quina fotogr\u00e1fica. Isso far\u00e1 com que a tela seja printada.<\/span><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" data-attachment-id=\"7823\" data-permalink=\"https:\/\/blog.botcity.dev\/pt-br\/2024\/03\/01\/como-construir-uma-automacao-desktop-em-python-para-acessar-vms-por-conexao-rdp\/virtual-machine\/\" data-orig-file=\"https:\/\/blog.botcity.dev\/wp-content\/uploads\/2024\/02\/virtual-machine.png\" data-orig-size=\"1920,857\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"virtual machine\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/blog.botcity.dev\/wp-content\/uploads\/2024\/02\/virtual-machine-1024x457.png\" class=\"aligncenter wp-image-7823 size-full\" src=\"https:\/\/blog.botcity.dev\/wp-content\/uploads\/2024\/02\/virtual-machine.png\" alt=\"print da tela do plugin do Studio pelo VS Code com zoom na parte da VM que vamos mapear o \u00edcone de pesquisa do menu iniciar.\" width=\"1920\" height=\"857\" srcset=\"https:\/\/blog.botcity.dev\/wp-content\/uploads\/2024\/02\/virtual-machine.png 1920w, https:\/\/blog.botcity.dev\/wp-content\/uploads\/2024\/02\/virtual-machine-300x134.png 300w, https:\/\/blog.botcity.dev\/wp-content\/uploads\/2024\/02\/virtual-machine-1024x457.png 1024w, https:\/\/blog.botcity.dev\/wp-content\/uploads\/2024\/02\/virtual-machine-1536x686.png 1536w, https:\/\/blog.botcity.dev\/wp-content\/uploads\/2024\/02\/virtual-machine-1200x536.png 1200w\" sizes=\"auto, (max-width: 1920px) 100vw, 1920px\" \/><\/p>\n<p><span style=\"font-weight: 400;\">Ap\u00f3s isso, clique uma vez no \u00edcone de pesquisa do menu iniciar e, em seguida, clique e arraste o mouse, selecionando o \u00edcone correspondente. Caso voc\u00ea erre o clique, basta pressionar a tecla \u201cESC\u201d no seu teclado e clicar novamente onde deseja selecionar.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Ao selecionar o \u00edcone de pesquisa, adicione um nome para ele e a a\u00e7\u00e3o de \u201cClick\u201d, deixando o modo \u201cImage\u201d selecionado e clicando em \u201cSubmit\u201d.<\/span><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" data-attachment-id=\"7826\" data-permalink=\"https:\/\/blog.botcity.dev\/pt-br\/2024\/03\/01\/como-construir-uma-automacao-desktop-em-python-para-acessar-vms-por-conexao-rdp\/atributos-do-recorte\/\" data-orig-file=\"https:\/\/blog.botcity.dev\/wp-content\/uploads\/2024\/02\/atributos-do-recorte.png\" data-orig-size=\"1920,875\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"atributos do recorte\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/blog.botcity.dev\/wp-content\/uploads\/2024\/02\/atributos-do-recorte-1024x467.png\" class=\"aligncenter wp-image-7826 size-full\" src=\"https:\/\/blog.botcity.dev\/wp-content\/uploads\/2024\/02\/atributos-do-recorte.png\" alt=\"print da tela do plugin do Studio pelo VS Code com zoom na parte da VM que vamos mapear o \u00edcone de pesquisa do menu iniciar, mas com a tela em destaque de onde s\u00e3o preenchidos os campos conforme descrito no artigo.\" width=\"1920\" height=\"875\" srcset=\"https:\/\/blog.botcity.dev\/wp-content\/uploads\/2024\/02\/atributos-do-recorte.png 1920w, https:\/\/blog.botcity.dev\/wp-content\/uploads\/2024\/02\/atributos-do-recorte-300x137.png 300w, https:\/\/blog.botcity.dev\/wp-content\/uploads\/2024\/02\/atributos-do-recorte-1024x467.png 1024w, https:\/\/blog.botcity.dev\/wp-content\/uploads\/2024\/02\/atributos-do-recorte-1536x700.png 1536w, https:\/\/blog.botcity.dev\/wp-content\/uploads\/2024\/02\/atributos-do-recorte-1200x547.png 1200w\" sizes=\"auto, (max-width: 1920px) 100vw, 1920px\" \/><\/p>\n<p><span style=\"font-weight: 400;\">Ao retornar para o c\u00f3digo, voc\u00ea observar\u00e1 que um c\u00f3digo parecido com o trecho abaixo foi adicionado em seu projeto:<\/span><\/p>\n<pre><span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0if not bot.find(\"search_icon\", matching=0.97, waiting_time=10000):<\/span>\r\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0not_found(\"search_icon\")<\/span>\r\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0bot.click()<\/span><\/pre>\n<p><span style=\"font-weight: 400;\">Todos os recortes que voc\u00ea mapear ficar\u00e3o guardados dentro da pasta resources do seu projeto. Sem esses recortes, o c\u00f3digo n\u00e3o conseguir\u00e1 encontrar os itens na tela que voc\u00ea precisar\u00e1 ter para que a automa\u00e7\u00e3o seja executada corretamente.<\/span><\/p>\n<p>&nbsp;<\/p>\n<p><span style=\"font-weight: 400;\">Neste c\u00f3digo, na fun\u00e7\u00e3o find(), vamos adicionar como par\u00e2metros, a posi\u00e7\u00e3o e a resolu\u00e7\u00e3o configurada anteriormente. Ent\u00e3o o c\u00f3digo ficar\u00e1 assim:<\/span><\/p>\n<pre><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0if not bot.find(\"search_icon\", matching=0.97, waiting_time=10000, <\/span><b>x=x, y=y, width=width, height=height<\/b><span style=\"font-weight: 400;\">):<\/span>\r\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0not_found(\"search_icon\")<\/span>\r\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0bot.click()<\/span><\/pre>\n<p><span style=\"font-weight: 400;\">Ap\u00f3s isso, o rob\u00f4 dever\u00e1 escrever \u201cfakturama.exe\u201d na barra de pesquisa, em seguida dar \u201center\u201d para abrir o sistema. E, para garantir que dar\u00e1 tempo do software abrir antes dos pr\u00f3ximos passos, adicionaremos um tempo.<\/span><\/p>\n<pre><span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0bot.type_keys(\"fakturama.exe\")<\/span>\r\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0bot.enter()<\/span>\r\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0bot.wait(4000)<\/span><\/pre>\n<p><span style=\"font-weight: 400;\">Outra forma de adicionar o nome na pesquisa \u00e9 utilizar outra fun\u00e7\u00e3o, de acordo com as orienta\u00e7\u00f5es da <\/span><a href=\"https:\/\/documentation.botcity.dev\/frameworks\/desktop\/python\/?h=paste%28#botcity.core.bot.DesktopBot.paste\"><span style=\"font-weight: 400;\">documenta\u00e7\u00e3o do paste()<\/span><\/a><span style=\"font-weight: 400;\">.<\/span><\/p>\n<h3><span style=\"font-weight: 400;\">Cadastro de produtos no Fakturama<\/span><\/h3>\n<p><span style=\"font-weight: 400;\">Para garantir que estamos com a tela do Fakturama em destaque, podemos mapear o nome do sistema e considerar um tempo de espera maior, assim ele s\u00f3 prosseguir\u00e1 se encontrar o Fakturama em destaque na tela.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Seguindo o mesmo procedimento do mapeamento do recorte do \u00edcone de pesquisa, vamos mapear o nome do Fakturama. O c\u00f3digo poder\u00e1 ficar parecido com o abaixo:<\/span><\/p>\n<pre><span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0if not bot.find(\"label_fakturama\", matching=0.97, waiting_time=60000):<\/span>\r\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0not_found(\"label_fakturama\")<\/span><\/pre>\n<p><span style=\"font-weight: 400;\">Como temos uma lista de produtos dentro do arquivo payload.json na pasta resources, vamos utilizar o for para iterar dentro dessa lista e cadastrar todos os produtos. O c\u00f3digo poder\u00e1 ficar parecido com o que consta abaixo:<\/span><\/p>\n<pre><span style=\"font-weight: 400;\">for product in products:<\/span>\r\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0# precisamos primeiro clicar em \u201cNew Product\u201d<\/span>\r\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0if not bot.find(\"button_new_product\", matching=0.97, waiting_time=10000):<\/span>\r\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0not_found(\"button_new_product\")<\/span>\r\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0bot.click()<\/span><span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span>\r\n\r\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0# o pr\u00f3ximo passo \u00e9 adicionar os valores nos campos<\/span>\r\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0if not bot.find(\"label_item_number\", matching=0.97, waiting_time=10000):<\/span>\r\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0not_found(\"label_item_number\")<\/span>\r\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0bot.click_relative(84, 4)<\/span>\r\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0bot.type_keys(product[\"item_number\"])<\/span>\r\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0print(product[\"item_number\"])<\/span>\r\n\r\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0# voc\u00ea pode utilizar \u201ctab()\u201d ou ainda mapear cada um dos campos por vis\u00e3o computacional<\/span>\r\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0bot.tab()<\/span>\r\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0bot.type_keys(product[\"name\"])<\/span>\r\n\r\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0bot.tab()<\/span>\r\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0bot.type_keys(product[\"category\"])<\/span>\r\n\r\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0bot.tab()<\/span>\r\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0bot.type_keys(product[\"gtin\"])<\/span>\r\n\r\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0bot.tab()<\/span>\r\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0bot.type_keys(product[\"supplier_code\"])<\/span>\r\n\r\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0bot.tab()<\/span>\r\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0bot.type_keys(product[\"description\"])<\/span>\r\n\r\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0bot.tab()<\/span>\r\n<span style=\"font-weight: 400;\">\r\n \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0# como j\u00e1 fica com um n\u00famero 0 em alguns campos, podemos utilizar control_a() para selecionar todo o conte\u00fado e digitar em cima o valor correto<\/span>\r\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0bot.control_a()<\/span>\r\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0bot.type_keys(product[\"price\"])<\/span>\r\n\r\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0bot.tab()<\/span>\r\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0bot.control_a()<\/span>\r\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0bot.type_keys(product[\"cost\"])<\/span>\r\n\r\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0bot.tab()<\/span>\r\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0bot.control_a()<\/span>\r\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0bot.type_keys(product[\"allowance\"])<\/span>\r\n\r\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0# o campo vat n\u00e3o precisar\u00e1 ser alterado, ent\u00e3o vamos apenas utilizar tab() para ir para o pr\u00f3ximo<\/span>\r\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0bot.tab()<\/span>\r\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0bot.tab()\u00a0<\/span>\r\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0bot.control_a()<\/span>\r\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0bot.type_keys(product[\"stock\"])<\/span><\/pre>\n<p><span style=\"font-weight: 400;\">Mesmo ap\u00f3s preencher os dados do produto, podemos salvar o que foi criado e fechar a aba do produto. Para isso, mapeamos o bot\u00e3o save, ainda dentro do for:<\/span><\/p>\n<pre><span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0if not bot.find(\"button_save\", matching=0.97, waiting_time=10000):<\/span>\r\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0not_found(\"button_save\")<\/span>\r\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0bot.click()<\/span><\/pre>\n<p><span style=\"font-weight: 400;\">E tamb\u00e9m dentro do for, mapeamos o x da aba do produto para poder clicar nela para fech\u00e1-la:<\/span><span style=\"font-weight: 400;\"><br \/>\n<\/span><\/p>\n<pre><span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0if not bot.find(\"button_close_product\", matching=0.97, waiting_time=10000):<\/span>\r\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0not_found(\"button_close_product\")<\/span>\r\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0bot.click()<\/span><\/pre>\n<h3><span style=\"font-weight: 400;\">Como finalizar o Fakturama e a conex\u00e3o RDP<\/span><\/h3>\n<p><span style=\"font-weight: 400;\">Como boa pr\u00e1tica, podemos sempre fechar os sistemas e a conex\u00e3o utilizadas na automa\u00e7\u00e3o do processo. Uma das formas de se fazer isso, \u00e9 com o seguinte c\u00f3digo (j\u00e1 fora do for para que fechem apenas ap\u00f3s o t\u00e9rmino do cadastramento dos produtos):<\/span><span style=\"font-weight: 400;\"><br \/>\n<\/span><\/p>\n<pre><span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0# como a tela do Fakturama est\u00e1 em destaque, podemos apenas fechar pelo comando<\/span>\r\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0bot.alt_f4()<\/span>\r\n\r\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0# fechando a conex\u00e3o RDP<\/span>\r\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0main_rdp_window = bot.app.top_window()<\/span>\r\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0main_rdp_window.close()<\/span><\/pre>\n<p><span style=\"font-weight: 400;\">Como vamos executar nossa automa\u00e7\u00e3o pelo orquestrador, precisamos adicionar a finaliza\u00e7\u00e3o da tarefa. Aqui voc\u00ea tamb\u00e9m pode mapear outros tipos de situa\u00e7\u00f5es como erros e status diferentes, de acordo com o que acontecer com a automa\u00e7\u00e3o. Veja o exemplo abaixo e explore outras oportunidades em nossa <\/span><a href=\"https:\/\/documentation.botcity.dev\/maestro\/maestro-sdk\/task\/#finishing-a-task\"><span style=\"font-weight: 400;\">documenta\u00e7\u00e3o sobre as tarefas<\/span><\/a><span style=\"font-weight: 400;\">.<\/span><\/p>\n<pre><span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0maestro.finish_task(<\/span>\r\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0task_id=execution.task_id,<\/span>\r\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0status=AutomationTaskFinishStatus.SUCCESS,<\/span>\r\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0message=\"Task Finished OK.\"<\/span>\r\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0)<\/span><\/pre>\n<h3><span style=\"font-weight: 400;\">C\u00f3digo completo<\/span><\/h3>\n<p><span style=\"font-weight: 400;\">Entenda como poder\u00e1 ficar o c\u00f3digo principal completo:<\/span><span style=\"font-weight: 400;\"><br \/>\n<\/span><\/p>\n<pre><span style=\"font-weight: 400;\">from commands import run_start_rdp<\/span>\r\n<span style=\"font-weight: 400;\">from botcity.core import DesktopBot<\/span>\r\n<span style=\"font-weight: 400;\">from botcity.maestro import *<\/span>\r\n\r\n<span style=\"font-weight: 400;\"># Disable errors if we are not connected to Maestro<\/span>\r\n<span style=\"font-weight: 400;\">BotMaestroSDK.RAISE_NOT_CONNECTED = False<\/span>\r\n\r\n<span style=\"font-weight: 400;\">def main():<\/span>\r\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0maestro = BotMaestroSDK.from_sys_args()<\/span>\r\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0execution = maestro.get_execution()<\/span>\r\n\r\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0print(f\"Task ID is: {execution.task_id}\")<\/span>\r\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0print(f\"Task Parameters are: {execution.parameters}\")<\/span>\r\n<span style=\"font-weight: 400;\">\r\n \u00a0\u00a0\u00a0bot = DesktopBot()\u00a0\u00a0<\/span>\r\n<span style=\"font-weight: 400;\">\r\n \u00a0\u00a0\u00a0with open(r'botPython\\resources\\payload.json') as json_file:<\/span>\r\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0json_data = json.load(json_file)<\/span>\r\n\r\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0customer_label = json_data[\"load\"][\"customer\"]<\/span>\r\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0products = json_data[\"load\"][\"products\"]<\/span>\r\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<\/span>\r\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0remote_ip = maestro.get_credential(customer_label, \"remote_ip\")<\/span>\r\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0username = maestro.get_credential(customer_label, \"username\")<\/span>\r\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0password = maestro.get_credential(customer_label, \"password\")<\/span>\r\n<span style=\"font-weight: 400;\"> \u00a0\u00a0 <\/span>\r\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0run_start_rdp(remote_ip, username, password)<\/span>\r\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0bot.connect_to_app(best_match=\"Conex\u00e3o de \u00c1rea de Trabalho Remota\", timeout=30000)<\/span>\r\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0main_rdp_window = bot.app.top_window()<\/span>\r\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0main_rdp_window.set_focus()<\/span>\r\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0bot.wait(3000)<\/span>\r\n\r\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0main_rdp_window = bot.app.top_window()<\/span>\r\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0window_rect = main_rdp_window.client_rect()<\/span>\r\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0x, y, width, height = window_rect.left, window_rect.top, window_rect.width() + 50, window_rect.height() + 50<\/span>\r\n<span style=\"font-weight: 400;\">\r\n \u00a0\u00a0\u00a0if not bot.find(\"search_icon\", matching=0.97, waiting_time=10000, x=x, y=y, width=width, height=height):<\/span>\r\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0not_found(\"search_icon\")<\/span>\r\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0bot.click()<\/span>\r\n\r\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0bot.type_keys(\"fakturama.exe\")<\/span>\r\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0bot.enter()<\/span>\r\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0bot.wait(4000)<\/span>\r\n\r\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0if not bot.find(\"label_fakturama\", matching=0.97, waiting_time=60000):<\/span>\r\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0not_found(\"label_fakturama\")<\/span>\r\n\r\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0for product in products:<\/span>\r\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0if not bot.find(\"button_new_product\", matching=0.97, waiting_time=10000):<\/span>\r\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0not_found(\"button_new_product\")<\/span>\r\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0bot.click()<\/span>\r\n\r\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0if not bot.find(\"label_item_number\", matching=0.97, waiting_time=10000):<\/span>\r\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0not_found(\"label_item_number\")<\/span>\r\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0bot.click_relative(84, 4)<\/span>\r\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0bot.type_keys(product[\"item_number\"])<\/span>\r\n\r\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0bot.tab()<\/span>\r\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0bot.type_keys(product[\"name\"])<\/span>\r\n\r\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0bot.tab()<\/span>\r\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0bot.type_keys(product[\"category\"])<\/span>\r\n\r\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0bot.tab()<\/span>\r\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0bot.type_keys(product[\"gtin\"])<\/span>\r\n<span style=\"font-weight: 400;\">\r\n \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0bot.tab()<\/span>\r\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0bot.type_keys(product[\"supplier_code\"])<\/span>\r\n\r\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0bot.tab()<\/span>\r\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0bot.type_keys(product[\"description\"])<\/span>\r\n\r\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0bot.tab()<\/span>\r\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0bot.control_a()<\/span>\r\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0bot.type_keys(product[\"price\"])<\/span>\r\n\r\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0bot.tab()<\/span>\r\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0bot.control_a()<\/span>\r\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0bot.type_keys(product[\"cost\"])<\/span>\r\n\r\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0bot.tab()<\/span>\r\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0bot.control_a()<\/span>\r\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0bot.type_keys(product[\"allowance\"])<\/span>\r\n\r\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0bot.tab()<\/span>\r\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0bot.tab() <\/span>\r\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0bot.control_a()<\/span>\r\n\r\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0bot.type_keys(product[\"stock\"])<\/span>\r\n<span style=\"font-weight: 400;\">\r\n \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0if not bot.find(\"button_save\", matching=0.97, waiting_time=10000):<\/span>\r\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0not_found(\"button_save\")<\/span>\r\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0bot.click()<\/span>\r\n\r\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0if not bot.find(\"button_close_product\", matching=0.97, waiting_time=10000):<\/span>\r\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0not_found(\"button_close_product\")<\/span>\r\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0bot.click()<\/span>\r\n\r\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0bot.alt_f4()<\/span>\r\n\r\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0main_rdp_window = bot.app.top_window()<\/span>\r\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0main_rdp_window.close()<\/span>\r\n\r\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0maestro.finish_task(<\/span>\r\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0task_id=execution.task_id,<\/span>\r\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0status=AutomationTaskFinishStatus.SUCCESS,<\/span>\r\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0message=\"Task Finished OK.\"<\/span>\r\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0)<\/span>\r\n\r\n<span style=\"font-weight: 400;\">def not_found(label):<\/span>\r\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0print(f\"Element not found: {label}\")<\/span>\r\n\r\n<span style=\"font-weight: 400;\">if __name__ == '__main__':<\/span>\r\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0main()<\/span><\/pre>\n<p><span style=\"font-weight: 400;\">E aqui o c\u00f3digo do arquivo commands.py:<\/span><\/p>\n<pre><span style=\"font-weight: 400;\">import subprocess<\/span>\r\n\r\n<span style=\"font-weight: 400;\">def run_start_rdp(remote_ip: str, user: str, password: str):<\/span>\r\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0start_rdp_command = f'''<\/span>\r\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0cmdkey \/generic:\"{remote_ip}\" \/user:\"{user}\" \/pass:\"{password}\"<\/span>\r\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0mstsc \/v:{remote_ip} \/w:1600 \/h:900<\/span>\r\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0cmdkey \/delete:{remote_ip}'''<\/span>\r\n\r\n<span style=\"font-weight: 400;\">\u00a0\u00a0\u00a0\u00a0subprocess.run([\"powershell\", start_rdp_command])<\/span><\/pre>\n<h2><span style=\"font-weight: 400;\">Deploy e execu\u00e7\u00e3o da tarefa<\/span><\/h2>\n<p><span style=\"font-weight: 400;\">Antes de prosseguir para essa etapa, vale sempre testar o que voc\u00ea desenvolveu, localmente. E lembre-se de, antes do deploy no orquestrador, deletar o trecho de c\u00f3digo de login.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Para fazer o deploy, voc\u00ea pode seguir as orienta\u00e7\u00f5es neste artigo sobre <\/span><a href=\"https:\/\/blog.botcity.dev\/pt-br\/2023\/10\/24\/orquestracao-rpa-como-criar-e-executar-tarefas-da-sua-automacao-no-botcity-orquestrador\/\"><span style=\"font-weight: 400;\">como criar e executar tarefas da sua automa\u00e7\u00e3o no BotCity Orquestrador<\/span><\/a><span style=\"font-weight: 400;\"> ou ainda acompanhar o passo a passo em nossa <\/span><a href=\"https:\/\/documentation.botcity.dev\/maestro\/features\/easy-deploy\/\"><span style=\"font-weight: 400;\">documenta\u00e7\u00e3o sobre deploy<\/span><\/a><span style=\"font-weight: 400;\">.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Para executar a sua tarefa, voc\u00ea deve ter o <\/span><a href=\"https:\/\/documentation.botcity.dev\/getting-started\/botcity-studio-sdk\/\"><span style=\"font-weight: 400;\">BotCity SDK<\/span><\/a><span style=\"font-weight: 400;\"> instalado e abrir, atrav\u00e9s dele, o <\/span><a href=\"https:\/\/blog.botcity.dev\/pt-br\/2023\/10\/19\/guia-sobre-como-gerenciar-a-execucao-das-suas-automacoes-conheca-o-botcity-runner\/\"><span style=\"font-weight: 400;\">BotCity Runner<\/span><\/a><span style=\"font-weight: 400;\"> no computador que executar\u00e1 a automa\u00e7\u00e3o e que precisa abrir a VM para executar o sistema que consta nela.<\/span><\/p>\n<h2><span style=\"font-weight: 400;\">O que achou da possibilidade de automatizar processos em VMs por conex\u00e3o RDP?<\/span><\/h2>\n<p><span style=\"font-weight: 400;\">Para ir mais a fundo neste assunto, te convidamos a participar da nossa comunidade global de RPA, \u00e9 s\u00f3 entrar no nosso <\/span><a href=\"https:\/\/join.slack.com\/t\/communitybotcitydev\/shared_invite\/zt-xt5lu9bq-l2E1gcf9pZgr4UrnIRJMLw\"><span style=\"font-weight: 400;\">Slack<\/span><\/a><span style=\"font-weight: 400;\"> ou ainda entrar em contato pelo nosso <\/span><a href=\"https:\/\/community.botcity.dev\/\"><span style=\"font-weight: 400;\">f\u00f3rum<\/span><\/a><span style=\"font-weight: 400;\">. Qualquer d\u00favida, s\u00f3 chamar a gente! E n\u00e3o esque\u00e7a de <\/span><a href=\"https:\/\/developers.botcity.dev\/signup\"><span style=\"font-weight: 400;\">criar a sua conta gratuita<\/span><\/a><span style=\"font-weight: 400;\"> para testar as funcionalidades que estamos explorando em nossos conte\u00fados. Ao criar suas automa\u00e7\u00f5es para aprender como utilizar a ferramenta, lembre-se de compartilhar com a comunidade pelo <\/span><a href=\"https:\/\/repository.botcity.dev\/\"><span style=\"font-weight: 400;\">Reposit\u00f3rio de Bots<\/span><\/a><span style=\"font-weight: 400;\">.<\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Em algumas ocasi\u00f5es, temos a necessidade de construir automa\u00e7\u00f5es RPA para atender processos que acontecem em VMs (Virtual Machines, ou seja, M\u00e1quinas Virtuais) diferentes. Neste artigo, vamos entender melhor o que \u00e9 conex\u00e3o RDP e como utilizar a seu favor no momento de acessar sistemas em m\u00e1quinas virtuais para que seu processo seja automatizado. O<\/p>\n","protected":false},"author":214060721,"featured_media":7836,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_feature_clip_id":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"_wpas_customize_per_network":false,"jetpack_post_was_ever_published":false},"categories":[773019],"tags":[],"class_list":{"0":"post-7804","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"has-post-thumbnail","7":"category-nao-categorizado"},"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.5 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Conex\u00e3o RDP: como criar automa\u00e7\u00e3o desktop para acessar VMs<\/title>\n<meta name=\"description\" content=\"Aprenda a desenvolver uma automa\u00e7\u00e3o RPA desktop utilizando Python para acessar m\u00e1quinas virtuais por conex\u00e3o RDP.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/blog.botcity.dev\/pt-br\/2024\/03\/01\/como-construir-uma-automacao-desktop-em-python-para-acessar-vms-por-conexao-rdp\/\" \/>\n<meta property=\"og:locale\" content=\"pt_BR\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Conex\u00e3o RDP: como criar automa\u00e7\u00e3o desktop para acessar VMs\" \/>\n<meta property=\"og:description\" content=\"Aprenda a desenvolver uma automa\u00e7\u00e3o RPA desktop utilizando Python para acessar m\u00e1quinas virtuais por conex\u00e3o RDP.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/blog.botcity.dev\/pt-br\/2024\/03\/01\/como-construir-uma-automacao-desktop-em-python-para-acessar-vms-por-conexao-rdp\/\" \/>\n<meta property=\"og:site_name\" content=\"Blog BotCity - Conte\u00fado para Automa\u00e7\u00e3o e Governan\u00e7a\" \/>\n<meta property=\"article:published_time\" content=\"2024-03-01T10:00:05+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-04-25T06:00:27+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/blog.botcity.dev\/wp-content\/uploads\/2024\/03\/arquitetura.png\" \/>\n\t<meta property=\"og:image:width\" content=\"911\" \/>\n\t<meta property=\"og:image:height\" content=\"540\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Lorhan Caproni\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Escrito por\" \/>\n\t<meta name=\"twitter:data1\" content=\"Lorhan Caproni\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. tempo de leitura\" \/>\n\t<meta name=\"twitter:data2\" content=\"11 minutos\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/blog.botcity.dev\\\/pt-br\\\/2024\\\/03\\\/01\\\/como-construir-uma-automacao-desktop-em-python-para-acessar-vms-por-conexao-rdp\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/blog.botcity.dev\\\/pt-br\\\/2024\\\/03\\\/01\\\/como-construir-uma-automacao-desktop-em-python-para-acessar-vms-por-conexao-rdp\\\/\"},\"author\":{\"name\":\"Lorhan Caproni\",\"@id\":\"https:\\\/\\\/blog.botcity.dev\\\/pt-br\\\/#\\\/schema\\\/person\\\/c70dcd8d50fca4702dc06ce662e0f111\"},\"headline\":\"Como construir uma automa\u00e7\u00e3o desktop em Python para acessar VMs por conex\u00e3o RDP?\",\"datePublished\":\"2024-03-01T10:00:05+00:00\",\"dateModified\":\"2024-04-25T06:00:27+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/blog.botcity.dev\\\/pt-br\\\/2024\\\/03\\\/01\\\/como-construir-uma-automacao-desktop-em-python-para-acessar-vms-por-conexao-rdp\\\/\"},\"wordCount\":2364,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/blog.botcity.dev\\\/pt-br\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/blog.botcity.dev\\\/pt-br\\\/2024\\\/03\\\/01\\\/como-construir-uma-automacao-desktop-em-python-para-acessar-vms-por-conexao-rdp\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/blog.botcity.dev\\\/wp-content\\\/uploads\\\/2024\\\/02\\\/article.png\",\"articleSection\":[\"N\u00e3o categorizado\"],\"inLanguage\":\"pt-BR\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/blog.botcity.dev\\\/pt-br\\\/2024\\\/03\\\/01\\\/como-construir-uma-automacao-desktop-em-python-para-acessar-vms-por-conexao-rdp\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/blog.botcity.dev\\\/pt-br\\\/2024\\\/03\\\/01\\\/como-construir-uma-automacao-desktop-em-python-para-acessar-vms-por-conexao-rdp\\\/\",\"url\":\"https:\\\/\\\/blog.botcity.dev\\\/pt-br\\\/2024\\\/03\\\/01\\\/como-construir-uma-automacao-desktop-em-python-para-acessar-vms-por-conexao-rdp\\\/\",\"name\":\"Conex\u00e3o RDP: como criar automa\u00e7\u00e3o desktop para acessar VMs\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/blog.botcity.dev\\\/pt-br\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/blog.botcity.dev\\\/pt-br\\\/2024\\\/03\\\/01\\\/como-construir-uma-automacao-desktop-em-python-para-acessar-vms-por-conexao-rdp\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/blog.botcity.dev\\\/pt-br\\\/2024\\\/03\\\/01\\\/como-construir-uma-automacao-desktop-em-python-para-acessar-vms-por-conexao-rdp\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/blog.botcity.dev\\\/wp-content\\\/uploads\\\/2024\\\/02\\\/article.png\",\"datePublished\":\"2024-03-01T10:00:05+00:00\",\"dateModified\":\"2024-04-25T06:00:27+00:00\",\"description\":\"Aprenda a desenvolver uma automa\u00e7\u00e3o RPA desktop utilizando Python para acessar m\u00e1quinas virtuais por conex\u00e3o RDP.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/blog.botcity.dev\\\/pt-br\\\/2024\\\/03\\\/01\\\/como-construir-uma-automacao-desktop-em-python-para-acessar-vms-por-conexao-rdp\\\/#breadcrumb\"},\"inLanguage\":\"pt-BR\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/blog.botcity.dev\\\/pt-br\\\/2024\\\/03\\\/01\\\/como-construir-uma-automacao-desktop-em-python-para-acessar-vms-por-conexao-rdp\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"pt-BR\",\"@id\":\"https:\\\/\\\/blog.botcity.dev\\\/pt-br\\\/2024\\\/03\\\/01\\\/como-construir-uma-automacao-desktop-em-python-para-acessar-vms-por-conexao-rdp\\\/#primaryimage\",\"url\":\"https:\\\/\\\/blog.botcity.dev\\\/wp-content\\\/uploads\\\/2024\\\/02\\\/article.png\",\"contentUrl\":\"https:\\\/\\\/blog.botcity.dev\\\/wp-content\\\/uploads\\\/2024\\\/02\\\/article.png\",\"width\":1400,\"height\":800,\"caption\":\"pessoa fazendo conex\u00e3o entre dois notebooks\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/blog.botcity.dev\\\/pt-br\\\/2024\\\/03\\\/01\\\/como-construir-uma-automacao-desktop-em-python-para-acessar-vms-por-conexao-rdp\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/blog.botcity.dev\\\/pt-br\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Como construir uma automa\u00e7\u00e3o desktop em Python para acessar VMs por conex\u00e3o RDP?\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/blog.botcity.dev\\\/pt-br\\\/#website\",\"url\":\"https:\\\/\\\/blog.botcity.dev\\\/pt-br\\\/\",\"name\":\"Blog BotCity\",\"description\":\"Explore o blog BotCity com conte\u00fados para automatizar e governar em Python. Mantenha-se informado e melhore o desempenho tecnol\u00f3gico, a seguran\u00e7a e o ROI da sua empresa.\",\"publisher\":{\"@id\":\"https:\\\/\\\/blog.botcity.dev\\\/pt-br\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/blog.botcity.dev\\\/pt-br\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"pt-BR\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/blog.botcity.dev\\\/pt-br\\\/#organization\",\"name\":\"BotCity\",\"url\":\"https:\\\/\\\/blog.botcity.dev\\\/pt-br\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"pt-BR\",\"@id\":\"https:\\\/\\\/blog.botcity.dev\\\/pt-br\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"http:\\\/\\\/blog.botcity.dev\\\/wp-content\\\/uploads\\\/2025\\\/09\\\/logo_botcity_2024_black.png\",\"contentUrl\":\"http:\\\/\\\/blog.botcity.dev\\\/wp-content\\\/uploads\\\/2025\\\/09\\\/logo_botcity_2024_black.png\",\"width\":1611,\"height\":384,\"caption\":\"BotCity\"},\"image\":{\"@id\":\"https:\\\/\\\/blog.botcity.dev\\\/pt-br\\\/#\\\/schema\\\/logo\\\/image\\\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/blog.botcity.dev\\\/pt-br\\\/#\\\/schema\\\/person\\\/c70dcd8d50fca4702dc06ce662e0f111\",\"name\":\"Lorhan Caproni\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"pt-BR\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/a4f02f5e361046d8a6d852df16da98ddff27755dc746d7151c3b577231cbf3ba?s=96&d=identicon&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/a4f02f5e361046d8a6d852df16da98ddff27755dc746d7151c3b577231cbf3ba?s=96&d=identicon&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/a4f02f5e361046d8a6d852df16da98ddff27755dc746d7151c3b577231cbf3ba?s=96&d=identicon&r=g\",\"caption\":\"Lorhan Caproni\"},\"description\":\"BotCity Cofounder and CEO\",\"sameAs\":[\"http:\\\/\\\/botcitydev.wordpress.com\"],\"url\":\"https:\\\/\\\/blog.botcity.dev\\\/pt-br\\\/author\\\/lorhanb8c3fbc9af\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Conex\u00e3o RDP: como criar automa\u00e7\u00e3o desktop para acessar VMs","description":"Aprenda a desenvolver uma automa\u00e7\u00e3o RPA desktop utilizando Python para acessar m\u00e1quinas virtuais por conex\u00e3o RDP.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/blog.botcity.dev\/pt-br\/2024\/03\/01\/como-construir-uma-automacao-desktop-em-python-para-acessar-vms-por-conexao-rdp\/","og_locale":"pt_BR","og_type":"article","og_title":"Conex\u00e3o RDP: como criar automa\u00e7\u00e3o desktop para acessar VMs","og_description":"Aprenda a desenvolver uma automa\u00e7\u00e3o RPA desktop utilizando Python para acessar m\u00e1quinas virtuais por conex\u00e3o RDP.","og_url":"https:\/\/blog.botcity.dev\/pt-br\/2024\/03\/01\/como-construir-uma-automacao-desktop-em-python-para-acessar-vms-por-conexao-rdp\/","og_site_name":"Blog BotCity - Conte\u00fado para Automa\u00e7\u00e3o e Governan\u00e7a","article_published_time":"2024-03-01T10:00:05+00:00","article_modified_time":"2024-04-25T06:00:27+00:00","og_image":[{"width":911,"height":540,"url":"https:\/\/blog.botcity.dev\/wp-content\/uploads\/2024\/03\/arquitetura.png","type":"image\/png"}],"author":"Lorhan Caproni","twitter_card":"summary_large_image","twitter_misc":{"Escrito por":"Lorhan Caproni","Est. tempo de leitura":"11 minutos"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/blog.botcity.dev\/pt-br\/2024\/03\/01\/como-construir-uma-automacao-desktop-em-python-para-acessar-vms-por-conexao-rdp\/#article","isPartOf":{"@id":"https:\/\/blog.botcity.dev\/pt-br\/2024\/03\/01\/como-construir-uma-automacao-desktop-em-python-para-acessar-vms-por-conexao-rdp\/"},"author":{"name":"Lorhan Caproni","@id":"https:\/\/blog.botcity.dev\/pt-br\/#\/schema\/person\/c70dcd8d50fca4702dc06ce662e0f111"},"headline":"Como construir uma automa\u00e7\u00e3o desktop em Python para acessar VMs por conex\u00e3o RDP?","datePublished":"2024-03-01T10:00:05+00:00","dateModified":"2024-04-25T06:00:27+00:00","mainEntityOfPage":{"@id":"https:\/\/blog.botcity.dev\/pt-br\/2024\/03\/01\/como-construir-uma-automacao-desktop-em-python-para-acessar-vms-por-conexao-rdp\/"},"wordCount":2364,"commentCount":0,"publisher":{"@id":"https:\/\/blog.botcity.dev\/pt-br\/#organization"},"image":{"@id":"https:\/\/blog.botcity.dev\/pt-br\/2024\/03\/01\/como-construir-uma-automacao-desktop-em-python-para-acessar-vms-por-conexao-rdp\/#primaryimage"},"thumbnailUrl":"https:\/\/blog.botcity.dev\/wp-content\/uploads\/2024\/02\/article.png","articleSection":["N\u00e3o categorizado"],"inLanguage":"pt-BR","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/blog.botcity.dev\/pt-br\/2024\/03\/01\/como-construir-uma-automacao-desktop-em-python-para-acessar-vms-por-conexao-rdp\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/blog.botcity.dev\/pt-br\/2024\/03\/01\/como-construir-uma-automacao-desktop-em-python-para-acessar-vms-por-conexao-rdp\/","url":"https:\/\/blog.botcity.dev\/pt-br\/2024\/03\/01\/como-construir-uma-automacao-desktop-em-python-para-acessar-vms-por-conexao-rdp\/","name":"Conex\u00e3o RDP: como criar automa\u00e7\u00e3o desktop para acessar VMs","isPartOf":{"@id":"https:\/\/blog.botcity.dev\/pt-br\/#website"},"primaryImageOfPage":{"@id":"https:\/\/blog.botcity.dev\/pt-br\/2024\/03\/01\/como-construir-uma-automacao-desktop-em-python-para-acessar-vms-por-conexao-rdp\/#primaryimage"},"image":{"@id":"https:\/\/blog.botcity.dev\/pt-br\/2024\/03\/01\/como-construir-uma-automacao-desktop-em-python-para-acessar-vms-por-conexao-rdp\/#primaryimage"},"thumbnailUrl":"https:\/\/blog.botcity.dev\/wp-content\/uploads\/2024\/02\/article.png","datePublished":"2024-03-01T10:00:05+00:00","dateModified":"2024-04-25T06:00:27+00:00","description":"Aprenda a desenvolver uma automa\u00e7\u00e3o RPA desktop utilizando Python para acessar m\u00e1quinas virtuais por conex\u00e3o RDP.","breadcrumb":{"@id":"https:\/\/blog.botcity.dev\/pt-br\/2024\/03\/01\/como-construir-uma-automacao-desktop-em-python-para-acessar-vms-por-conexao-rdp\/#breadcrumb"},"inLanguage":"pt-BR","potentialAction":[{"@type":"ReadAction","target":["https:\/\/blog.botcity.dev\/pt-br\/2024\/03\/01\/como-construir-uma-automacao-desktop-em-python-para-acessar-vms-por-conexao-rdp\/"]}]},{"@type":"ImageObject","inLanguage":"pt-BR","@id":"https:\/\/blog.botcity.dev\/pt-br\/2024\/03\/01\/como-construir-uma-automacao-desktop-em-python-para-acessar-vms-por-conexao-rdp\/#primaryimage","url":"https:\/\/blog.botcity.dev\/wp-content\/uploads\/2024\/02\/article.png","contentUrl":"https:\/\/blog.botcity.dev\/wp-content\/uploads\/2024\/02\/article.png","width":1400,"height":800,"caption":"pessoa fazendo conex\u00e3o entre dois notebooks"},{"@type":"BreadcrumbList","@id":"https:\/\/blog.botcity.dev\/pt-br\/2024\/03\/01\/como-construir-uma-automacao-desktop-em-python-para-acessar-vms-por-conexao-rdp\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/blog.botcity.dev\/pt-br\/"},{"@type":"ListItem","position":2,"name":"Como construir uma automa\u00e7\u00e3o desktop em Python para acessar VMs por conex\u00e3o RDP?"}]},{"@type":"WebSite","@id":"https:\/\/blog.botcity.dev\/pt-br\/#website","url":"https:\/\/blog.botcity.dev\/pt-br\/","name":"Blog BotCity","description":"Explore o blog BotCity com conte\u00fados para automatizar e governar em Python. Mantenha-se informado e melhore o desempenho tecnol\u00f3gico, a seguran\u00e7a e o ROI da sua empresa.","publisher":{"@id":"https:\/\/blog.botcity.dev\/pt-br\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/blog.botcity.dev\/pt-br\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"pt-BR"},{"@type":"Organization","@id":"https:\/\/blog.botcity.dev\/pt-br\/#organization","name":"BotCity","url":"https:\/\/blog.botcity.dev\/pt-br\/","logo":{"@type":"ImageObject","inLanguage":"pt-BR","@id":"https:\/\/blog.botcity.dev\/pt-br\/#\/schema\/logo\/image\/","url":"http:\/\/blog.botcity.dev\/wp-content\/uploads\/2025\/09\/logo_botcity_2024_black.png","contentUrl":"http:\/\/blog.botcity.dev\/wp-content\/uploads\/2025\/09\/logo_botcity_2024_black.png","width":1611,"height":384,"caption":"BotCity"},"image":{"@id":"https:\/\/blog.botcity.dev\/pt-br\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/blog.botcity.dev\/pt-br\/#\/schema\/person\/c70dcd8d50fca4702dc06ce662e0f111","name":"Lorhan Caproni","image":{"@type":"ImageObject","inLanguage":"pt-BR","@id":"https:\/\/secure.gravatar.com\/avatar\/a4f02f5e361046d8a6d852df16da98ddff27755dc746d7151c3b577231cbf3ba?s=96&d=identicon&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/a4f02f5e361046d8a6d852df16da98ddff27755dc746d7151c3b577231cbf3ba?s=96&d=identicon&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/a4f02f5e361046d8a6d852df16da98ddff27755dc746d7151c3b577231cbf3ba?s=96&d=identicon&r=g","caption":"Lorhan Caproni"},"description":"BotCity Cofounder and CEO","sameAs":["http:\/\/botcitydev.wordpress.com"],"url":"https:\/\/blog.botcity.dev\/pt-br\/author\/lorhanb8c3fbc9af\/"}]}},"jetpack_publicize_connections":[],"jetpack_featured_media_url":"https:\/\/blog.botcity.dev\/wp-content\/uploads\/2024\/02\/article.png","jetpack_likes_enabled":true,"jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/pdx8c3-21S","_links":{"self":[{"href":"https:\/\/blog.botcity.dev\/pt-br\/wp-json\/wp\/v2\/posts\/7804","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.botcity.dev\/pt-br\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.botcity.dev\/pt-br\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.botcity.dev\/pt-br\/wp-json\/wp\/v2\/users\/214060721"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.botcity.dev\/pt-br\/wp-json\/wp\/v2\/comments?post=7804"}],"version-history":[{"count":22,"href":"https:\/\/blog.botcity.dev\/pt-br\/wp-json\/wp\/v2\/posts\/7804\/revisions"}],"predecessor-version":[{"id":8092,"href":"https:\/\/blog.botcity.dev\/pt-br\/wp-json\/wp\/v2\/posts\/7804\/revisions\/8092"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blog.botcity.dev\/pt-br\/wp-json\/wp\/v2\/media\/7836"}],"wp:attachment":[{"href":"https:\/\/blog.botcity.dev\/pt-br\/wp-json\/wp\/v2\/media?parent=7804"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.botcity.dev\/pt-br\/wp-json\/wp\/v2\/categories?post=7804"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.botcity.dev\/pt-br\/wp-json\/wp\/v2\/tags?post=7804"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}