Jump to content

Sleep untill text pupop


Wolfshare
 Share

Recommended Posts

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
Link to comment
Share on other sites

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 (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

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
Link to comment
Share on other sites

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 (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

  • Moderators

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

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

 

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
Link to comment
Share on other sites

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 (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

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
 

 

 

Link to comment
Share on other sites

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 (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

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<
><
><
><
><
><

 

 

Link to comment
Share on other sites

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 (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

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

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

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...