Jump to content

StringInStr - (Moved)


stiv
 Share

Recommended Posts

Buen Dia compañeros de Autoit,

soy nuevo en este lenguaje y quiero saber si hay alguna forma que cuando se copie  una variable con mouseclip o sellecionar una variable de un block de notas (contrl C ), se  pueda comparar con  una columna de excel para realizar un condicional siendo igual a un mismo valor.

Estaré atento 

Gracias

lo interpreto algo asi.

Translation:

Good morning, colleagues from Autoit,

I am new to this language and I want to know if there is any way that when copying a variable with mouseclip or selecting a variable from a notepad (contrl C), it can be compared to an excel column to perform a conditional being equal to a same value.

I am waiting

Thanks

I interpret it something like this.

WinActivate("notas pendientes: Bloc de notas")
Sleep(500)
Send("{CTRLDOWN}e{CTRLUP}")
Sleep(500)
Send("{CTRLDOWN}c{CTRLUP}")
Local $sData2 = ClipGet()
;---------------------------------

With $oExcel
.Range("F1:F10").Select     ;Select F1:F10  COLUMNA QUE QUIERO COMPARAR 
.Selection.FormatConditions.Delete  ;Delete Existing FormatConditions
EndWith

Send("{CTRLDOWN}c{CTRLUP}")
Local $sData2 = ClipGet()

If StringInstr($Copy,$oExcel,0) then 

PROCESO A REALIZAR 

 

Edited by Melba23
Added trans and code tags
Link to comment
Share on other sites

  • Moderators

Moved to the appropriate forum.

Moderation Team

P.S.

1.  I can understand your Spanish, but this is an English-speaking forum - please use a translation website before posting in future.

2.  When you post code in future please use Code tags - see here how to do it.  Then you get a scrolling box and syntax colouring as you can see above now I have added the tags.

Thanks in advance for your cooperation in these matters.

 

Edited by Melba23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

Hello. I think you want to do something like this:

Hola. Creo que quieres hacer algo como esto:

#include <Misc.au3>
#include <MsgBoxConstants.au3>

HotKeySet("{ESC}", "_Exit")
Global Const $g_hDLL = DllOpen("user32.dll")


_Main()

Func _Main()
    While Sleep(30)
        If _IsPressed("11", $g_hDLL) Then
            If _IsPressed("43", $g_hDLL) Then
                _DoSomething()
            EndIf
        EndIf
    WEnd
EndFunc   ;==>_Main


Func _Exit()
    DllClose($g_hDLL)
EndFunc


Func _DoSomething()
    Local $sTextoCopiado = ClipGet()
    ConsoleWrite($sTextoCopiado & @CRLF)
    ClipPut("")
    Sleep(1000)
EndFunc   ;==>_DoSomething

 

PD: If It's not what you're trying to do, send me a PM and explain in Spanish It's my native language.

PD Spanish: Si no es lo que estas tratando de hacer enviame un mensaje privado en Español. Es mi lenguaje nativo.

 

Saludos

 

 

Link to comment
Share on other sites

Hola Dany,

No, básicamente lo que quiero es que la variable que yo guarde con ClipGet, la pueda comparar con una variable igual en una columna excel donde debe estar ese mismo valor.

Trans:

No, basically what I want is that the variable that I save with ClipGet, I can compare it with an equal variable in an excel column where that same value must be. 

Edited by Melba23
Translation added
Link to comment
Share on other sites

  • Moderators

stiv,

I told you above that this is an English speaking forum - please stop posting in Spanish or you may find you cannot post at all.

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

@stiv :

Since you are a new member, you may be unfamiliar with what is meant by PM.

PM (abbreviation for Personal or Private Message) is a feature of the forum to have a private conversation with one (or more) members. Such a conversation, as the name already indicates, does not appear as a public post, and there you can use whatever language you prefer.

To start a private conversation, use the "Envelope Button" from the website header :

PM.jpg.200edd025e09ab171cba573e8198ad6d.jpg

However, you should consider the following excerpt from the forum rules :

Quote

5. Do not PM other users asking for support - that is why the forum exists, so post there instead.

 

On 9/17/2021 at 4:11 AM, Danyfirex said:

If It's not what you're trying to do, send me a PM and explain in Spanish It's my native language.

In this case it is fine, because @Danyfirex was so kind to offer you additional help.

EDIT A good translation tool for your future contributions can be found e.g. here :  https://www.deepl.com/translate

 

Edited by Musashi

Musashi-C64.png

"In the beginning the Universe was created. This has made a lot of people very angry and been widely regarded as a bad move."

Link to comment
Share on other sites

On 9/23/2021 at 3:44 PM, stiv said:

compare it with an equal variable in an excel column where that same value must be. 

Hi @stiv

you need to do two things. First copy the data. 2nd compare. I don't know what your data look like. A simple Excel VLOOKUP should do what you want.

The alternative is always SQL and do a SELECT there.

S

Skysnake

Why is the snake in the sky?

Link to comment
Share on other sites

Hi there. @Skysnake
Of course, I did, as a solution, was to filter the excel file (column), and perform a copy and paste process in another row so that I took the initial variables. however it is more process.

func pasar()
 
 
Global $oExcel = _Excel_Open()
    Global $oWorkbook = _Excel_BookOpen($oExcel".\probar.xlsx" )
    Sleep(5000)
     
;---------------recort func------------
    WinWaitActive("Microsoft Excel - probar")
    
    Send("{CTRLDOWN}{HOME}{CTRLUP}";casilla principal
    Sleep(3000)
    send("{TAB 5}")
    Send("{ALTDOWN}{DOWN}{ALTUP}")
    send("{TAB 7}")
    Sleep(3000)
    Send("^v";Pega la variable
 
    Send ("{ENTER}")
    Sleep(9000)
   
Local $aResult = _Excel_RangeRead($oWorkbookDefault"G2")
 
Local $sData = ClipGet() ; Cluck Obtiene la variable 
 
;ClipPut($sResult)
$sData = ClipGet() ; Envia La variable obtenida
    
   
    Sleep(3000; tiempo
    Send("^C"; Pega la variable
    $Copy = ClipGet() ;
 
WinActivate("Reserva de Citas ")
MouseClick("left",893,50,2)
 
    If StringInstr ($Copy,"confirmacion",0then  ;Cuando el archivo excel termine su recorrido, realiza una validacion de la casilla G para dar por terminado el robot 
    
    WinActivate("Reserva de Citas ")
    Sleep(2000)
    ;Correo()
    EndIf
EndFunc
Link to comment
Share on other sites

I think you are making this more complicated than it really is.

  1. You have data. Where does it originate? Is it a one time or repetitive event? This needs to be read
  2. This data needs to placed somewhere, where it can be manipulated. Excel, CSV, or memory Array
  3. Once the data store has been selected, use the appropriate tool to find matched.

 

  • I would write the data to disk. SQLite or CSV so that it is available for inspection and troubleshooting
  • I would loop the data through an array, because it probably is faster and more versatile that Excel.
  • If your SQL is OKish, then simply running repeat SELECT loops on the data may also work

See this Comparing Arrays

 

Skysnake

Why is the snake in the sky?

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...