Sign in to follow this  
Followers 0
saio

Looping And Reading Clipboard Text

19 posts in this topic

#1 ·  Posted (edited)

I need autoit to read the text that I have copied ,add it to variable and if it contains text "152t34" to do action

and Repeat it Self Forever

all other comands have been made but I cant do those ones...

Edited by saio

Share this post


Link to post
Share on other sites



ClipGet?


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

ClipGet?

Local $text = ClipGet()

Share this post


Link to post
Share on other sites

Looks good. Is your problem solved now?


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

Looks good. Is your problem solved now?

no it get's it but I wanna make action if it finds text containing "152t34" to do action else to do another action

Share this post


Link to post
Share on other sites

If StringInStr($text, "152t34") > 0 Then
  ; Action 1
Else
  ; Action 2
EndIf


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

yea now check works but it alays go to Action 2

Share this post


Link to post
Share on other sites

Then the string "152t34" was not found in the clipboard.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

i think I got it now how to get it to go back to my first line and repeat forever?

can't find command loop....

Edited by saio

Share this post


Link to post
Share on other sites

#10 ·  Posted

Check While/WEnd.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

#11 ·  Posted

Ok What I do Wrong The Text is there it goes to Action 2 on the if and it stays active and does not start again...

$i = 7
$lookfor = ("152t34")
ShellExecute ("C:Program FilesMozilla Firefoxfirefox.exe", "MyURL.com" )
Sleep(10000)
Send("{CTRLDOWN}")
Send("{A down}")
Send("{CTRLUP}")
Send("{A UP}")
Send("{CTRLDOWN}")
Send("{C down}")
Send("{CTRLUP}")
Send("{C UP}")
Local $text = ClipGet()
If StringInStr($text, $lookfor) > 0 Then
   ProcessClose ("C:Program FilesMozilla Firefoxfirefox.exe")
Else
Send("{CTRLDOWN}")
Send("{W down}")
Send("{CTRLUP}")
Send("{W UP}")
EndIf
Local $i = 0
While $i <= 10
   wend

Share this post


Link to post
Share on other sites

#12 ·  Posted (edited)

Haven't tested the code. Hit Escape to quit.

HotKeySet("{Esc}", "_Exit")

;$i = 7
$lookfor = ("152t34")
ShellExecute ("C:Program FilesMozilla Firefoxfirefox.exe", "MyURL.com" )
Sleep(10000)

While 1
    Send("^a")
    ;Send("{CTRLDOWN}")
    ;Send("{A down}")
    ;Send("{CTRLUP}")
    ;Send("{A UP}")
    
    Send("^c")
    ;Send("{CTRLDOWN}")
    ;Send("{C down}")
    ;Send("{CTRLUP}")
    ;Send("{C UP}")

    $text = ClipGet()
    If StringInStr($text, $lookfor) Then
       ProcessClose ("C:Program FilesMozilla Firefoxfirefox.exe")
       ExitLoop
   Else
        Send("^w")
        ;Send("{CTRLDOWN}")
        ;Send("{W down}")
        ;Send("{CTRLUP}")
        ;Send("{W UP}")
    EndIf
    Sleep(3000) ; Repeats action every three seconds.
;Local $i = 0
;While $i <= 10
WEnd

Func _Exit()
    Exit
EndFunc

I have slowed this script right down so you can see if it is really what you want. All it does for me is close all firefox tabs. You may wish to exit the script when all Firefox tabs have closed. Look at WinExisits in the help file.

Edited by czardas

Share this post


Link to post
Share on other sites

#13 ·  Posted

Haven't tested the code. Hit Escape to quit.

HotKeySet("{Esc}", "_Exit")

;$i = 7
$lookfor = ("152t34")
ShellExecute ("C:Program FilesMozilla Firefoxfirefox.exe", "MyURL.com" )
Sleep(10000)

While 1
    Send("^a")
    ;Send("{CTRLDOWN}")
    ;Send("{A down}")
    ;Send("{CTRLUP}")
    ;Send("{A UP}")
    
    Send("^c")
    ;Send("{CTRLDOWN}")
    ;Send("{C down}")
    ;Send("{CTRLUP}")
    ;Send("{C UP}")

    $text = ClipGet()
    If StringInStr($text, $lookfor) Then
       ProcessClose ("C:Program FilesMozilla Firefoxfirefox.exe")
       ExitLoop
   Else
        Send("^w")
        ;Send("{CTRLDOWN}")
        ;Send("{W down}")
        ;Send("{CTRLUP}")
        ;Send("{W UP}")
    EndIf
    Sleep(3000) ; Repeats action every three seconds.
;Local $i = 0
;While $i <= 10
WEnd

Func _Exit()
    Exit
EndFunc

I have slowed this script right down so you can see if it is really what you want. All it does for me is close all firefox tabs. You may wish to exit the script when all Firefox tabs have closed. Look at WinExisits in the help file.

Nop Same Result...

Share this post


Link to post
Share on other sites

#14 ·  Posted (edited)

Hmm, I don't get what you mean? The result is not the same. It either closes all firefox tabs one after the other, or it closes the current tab when the text 152t34 is encountered. This was the result of fixing most of the errors I found in your code. That is probably not what you want it to do, but I'm unable to guess that part.

Edited by czardas

Share this post


Link to post
Share on other sites

#15 ·  Posted

it closes the tab only and does nothing else the idea is to kill the proces firefox instantly but it does not do it....

Share this post


Link to post
Share on other sites

#16 ·  Posted

If what you want to do is just see if a certain string is in a certain page, get it (the page source) with this - _INetGetSource, and process it with this - StringInStr, like in the other example.


- Bruce /*somdcomputerguy */  If you change the way you look at things, the things you look at change.

Share this post


Link to post
Share on other sites

#17 ·  Posted

Okay I don't get it CTRL + W closes a tab in firefox. That was in the code you gave. Anyway you can test the loop is working like this. Run the code and then copy it to the clipboard again. See what happens.

HotKeySet("{Esc}", "_Exit")

ClipPut("") ; First empty the clipboard.
$lookfor = ("152t34")
$iLoopCount = 0
While 1
    $text = ClipGet()
    If StringInStr($text, $lookfor) Then
        ExitLoop
    Else
        $iLoopCount += 1
    EndIf
    Sleep(100) ; Repeats actions 10 times per second.
WEnd

MsgBox(0,"152t34", "Found after " & @LF & $iLoopCount & " loops")

Func _Exit()
    Exit
EndFunc

Share this post


Link to post
Share on other sites

#18 ·  Posted (edited)

10x for the help you allso had error and I did not see it until now ;) it's done!

Edited by saio

Share this post


Link to post
Share on other sites

#19 ·  Posted (edited)

I have to fix errors in my code all the time. Anyway, I'm glad you got it workiing. ;)

Edited by czardas

Share this post


Link to post
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
Sign in to follow this  
Followers 0