Jump to content
Sign in to follow this  
Wolfshare

Sleep untill text pupop

Recommended Posts

Wolfshare

Hey, i want to make everything sleep till text this will show up

9bx6.png

 

i tried this.

 Do
$text = ControlGetText("[CLASS:tooltips_class32]", "", "")
$text2 = StringTrimRight($text, 29)
$t = $t + 1
sleep(100)
Until $text2 = "Connected to USA" or $t >= 70
Until $text2 = "Connected to USA"
run("C:\Documents and Settings\Administrator\Desktop\random.exe")

but nothing happens, it does not detect's this text just simply repeating the process, why it does not detect's those text?

Edited by Wolfshare

Share this post


Link to post
Share on other sites
Wolfshare

I have tried changing 

$text2 = StringTrimRight($text, 29)

number 29 to 28 but nothing :) hm.. strange, how can i done this script sucessful?

Share this post


Link to post
Share on other sites
water

Why do you have two "Until" statements in your code? The snippet you posted will just return an syntax error.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (2018-06-01 - Version 1.4.9.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2018-09-01 - Version 1.3.4.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Share this post


Link to post
Share on other sites
Wolfshare

Why do you have two "Until" statements in your code? The snippet you posted will just return an syntax error.

Yep, two untill, full code looks:

 

 

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <FF.au3>
Global $a;
Global $text;
Global $text2
Global $t
Opt("WinTitleMatchMode", 2)


Sleep(15000)
Do
    MouseMove(602, 587)
    MouseMove(794, 587)
    $text = 0
    $text2 = 0
    $t = 0
    ProcessClose("StrongDial.exe")
    Run("C:\Program Files\StrongVPN\StrongDial.exe")
    WinWaitActive("StrongVPN Client (email@gmail.com", "", 180)
    WinActivate("StrongVPN Client (ema@gmail.com")
    Sleep(2000)
    ControlClick("StrongVPN Client (email@gmail.com)", "", "[CLASS:WindowsForms10.BUTTON.app.0.37a0697]")
    Do
        $text = ControlGetText("[CLASS:tooltips_class32]", "", "")
        $text2 = StringTrimRight($text, 28)
        $t = $t + 1
        Sleep(100)
    Until $text2 = "You have been connected" Or $t >= 70
Until $text2 = "You have been connected"
Run("C:\Documents and Settings\Administrator\Desktop\random.exe")
Edited by Melba23
Added code tags and fixed indentation

Share this post


Link to post
Share on other sites
water

Add some debugging code to see what you get.

Means: Insert the following code after the StringTrimRight statement:

ConsoleWrite(">" & $text2 & "<" & @CRLF)

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (2018-06-01 - Version 1.4.9.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2018-09-01 - Version 1.3.4.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Share this post


Link to post
Share on other sites
Melba23

Wolfshare,

When you post code 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 - and you keep the indentation. ;)

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______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

 

Share this post


Link to post
Share on other sites
Wolfshare

 

Add some debugging code to see what you get.

Means: Insert the following code after the StringTrimRight statement:

ConsoleWrite(">" & $text2 & "<" & @CRLF)

added.. does not work :/

Whole code:

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <FF.au3>
Global $a;
Global $text;
Global $text2
Global $t
Opt("WinTitleMatchMode", 2)


Sleep(15000)
Do
    MouseMove(602, 587)
    MouseMove(794, 587)
    $text = 0
    $text2 = 0
    $t = 0
   ; ProcessClose("StrongDial.exe")
  ;  Run("C:\Program Files\StrongVPN\StrongDial.exe")
  ;  WinWaitActive("StrongVPN Client (email@gmail.com", "", 180)
  ;  WinActivate("StrongVPN Client (ema@gmail.com")
  ;  Sleep(2000)
  ;  ControlClick("StrongVPN Client (email@gmail.com)", "", "[CLASS:WindowsForms10.BUTTON.app.0.37a0697]")
    Do
        $text = ControlGetText("[CLASS:tooltips_class32]", "", "")
        $text2 = StringTrimRight($text, 28)
        ConsoleWrite(">" & $text2 & "<" & @CRLF)
        $t = $t + 1
        Sleep(100)
    Until $text2 = "Connected to USA" Or $t >= 70
Until $text2 = "Connected to USA"
Run("C:\Documents and Settings\Administrator\Desktop\random.exe")
Edited by Wolfshare

Share this post


Link to post
Share on other sites
water

Sure it doesn't work! We didn't change your code or remove errors but simply added a ConsoleWrite.

What do you see in the SciTE output pane?


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (2018-06-01 - Version 1.4.9.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2018-09-01 - Version 1.3.4.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Share this post


Link to post
Share on other sites
Wolfshare

Sure it doesn't work! We didn't change your code or remove errors but simply added a ConsoleWrite.

What do you see in the SciTE output pane?

                       Ultimate Packer for eXecutables
                          Copyright © 1996 - 2010
UPX 3.07w       Markus Oberhumer, Laszlo Molnar & John Reiser   Sep 08th 2010
 
        File size         Ratio      Format      Name
   --------------------   ------   -----------   -----------
    649216 ->    301568   46.45%    win32/pe     New AutoIt v3 Script.exe
 
Packed 1 file.
>Exit code: 0    Time: 3.959
 

 

 

Share this post


Link to post
Share on other sites
water

The ConsoleWrite statement only works when you execute your script from SciTE pressing F5. The compiled version of your script has no Console to write the output to.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (2018-06-01 - Version 1.4.9.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2018-09-01 - Version 1.3.4.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Share this post


Link to post
Share on other sites
Wolfshare

The ConsoleWrite statement only works when you execute your script from SciTE pressing F5. The compiled version of your script has no Console to write the output to.

>"C:Program FilesAutoIt3SciTE..autoit3.exe" /ErrorStdOut "C:Documents and SettingsAdministratorDesktopNew AutoIt v3 Script.au3"
>Connected to USA, New York<
>Connected to USA, New York<
>Connected to USA, New York<
>Connected to USA, New York<
>Connected to USA, New York<
>Connected to USA, New York<
>Connected to USA, New York<
>Connected to USA, New York<
>Connected to USA, New York<
>Connected to USA, New York<
>Connected to USA, New York<
>Connected to USA, New York<
>Connected to USA, New York<
>Connected to USA, New York<
>Connected to USA, New York<
>Connected to USA, New York<
>Connected to USA, New York<
><
><
><
><
><

 

 

Share this post


Link to post
Share on other sites
water

Now it is easy!

Change lines

Until $text2 = "Connected to USA" Or $t >= 70
Until $text2 = "Connected to USA"

to

Until $text2 = "Connected to USA, New York" Or $t >= 70
Until $text2 = "Connected to USA, New York"

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (2018-06-01 - Version 1.4.9.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2018-09-01 - Version 1.3.4.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Share this post


Link to post
Share on other sites
Wolfshare

 

Now it is easy!

Change lines

Until $text2 = "Connected to USA" Or $t >= 70
Until $text2 = "Connected to USA"

to

Until $text2 = "Connected to USA, New York" Or $t >= 70
Until $text2 = "Connected to USA, New York"

Wow, thanks for your help! You have teached me useful thing!

Share this post


Link to post
Share on other sites
water

Hope you've learned something about debugging so you can help yourself next time ;)


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (2018-06-01 - Version 1.4.9.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2018-09-01 - Version 1.3.4.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Share this post


Link to post
Share on other sites
Wolfshare

Hope you've learned something about debugging so you can help yourself next time ;)

Yep, i have learned about debugging, thanks again!!!

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  

×