jonai Posted November 16, 2015 Share Posted November 16, 2015 Hello, it's posible to use a function as piece of autoit code to use it more than one time. And if it's posible, how can i call the function is the above code ok ???expandcollapse popup#include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <MsgBoxConstants.au3> #include <IE.au3> WinSetState ( "pruebas.txt: Bloc de notas", "", @SW_MAXIMIZE ) ; SOLO PARA PRUEBAS EN CASA WinActivate ( "pruebas.txt: Bloc de notas" ) ; SOLO PARA PRUEBAS EN CASA Func copiocomparo() ; txtprueba Send ("{ALT}+{e}") ;Sleep(10) Send ("{t}") ;Sleep(10) Send ("{ALT}+{e}") ;Sleep(10) Send ("{ALT}+{o}") ;Sleep(10) $comparativo = ClipGet() EndFunc Local $i = 0 Local $times = 0 Do Call ("copiocomparo") ; Hemos copiado la pantalla y comparamos si existe Si es asi estamos en la pantalla correcta y seguimos enviando el dni ; Lo intentara 10 veces para ver si es la pantalla correcta pero tambien por si el sistema está muy lento If StringRegExp($comparativo, "texto que debe existir para lanzar los comandos") Then Send("{TAB}") Send("{TAB}") Send ( $lprevio ) Send ( $data1 ) Send("{TAB}") Send ( $data11 ) Send ("{ENTER}") ; envio dni $i = 1 Else ;MsgBox(0, "test", "No Coincide") Sleep(100) $times = $times + 1 EndIf Until $i = 1 Or $times = 10; Increase the value of $i until it equals the value of 10. If $times = 10 Then MsgBox(0, "INFO", "No estás en la pantalla adecuada o el Sistema está muy lento") Continueloop EndIfThanks in advanced Link to comment Share on other sites More sharing options...
Danyfirex Posted November 16, 2015 Share Posted November 16, 2015 I don't understand :S (No entiendo :S)Saludos Danysys.com AutoIt... UDFs: VirusTotal API 2.0 UDF - libZPlay UDF - Apps: Guitar Tab Tester - VirusTotal Hash Checker Examples: Text-to-Speech ISpVoice Interface - Get installed applications - Enable/Disable Network connection PrintHookProc - WINTRUST - Mute Microphone Level - Get Connected NetWorks - Create NetWork Connection ShortCut Link to comment Share on other sites More sharing options...
jonai Posted November 16, 2015 Author Share Posted November 16, 2015 (edited) I try to explain better.Imagine my need to copy the contents of a window that is continuously changing.To copy I have to use a particular sequence (always the same). But that is not the typical control c. And the content is copied converted into variable to compare it with some text and do something.Function copiocomparo() ?????My question is: Can I convert this sequence into a function and call it when I need it? (Code reuse)And if so, how do I do?Call ("copiocomparo") ??????Thanks Edited November 16, 2015 by jonai Link to comment Share on other sites More sharing options...
Danyfirex Posted November 16, 2015 Share Posted November 16, 2015 Yes you can. you can create a funtion and assign to a hotkey using HotKeySet then you can call that funtion when you need it simple pressing you hot key.Saludos Danysys.com AutoIt... UDFs: VirusTotal API 2.0 UDF - libZPlay UDF - Apps: Guitar Tab Tester - VirusTotal Hash Checker Examples: Text-to-Speech ISpVoice Interface - Get installed applications - Enable/Disable Network connection PrintHookProc - WINTRUST - Mute Microphone Level - Get Connected NetWorks - Create NetWork Connection ShortCut Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now