Jump to content

How to know when AutoIT is done sending text?


Go to solution Solved by ioa747,

Recommended Posts

Hello,

I need to write a script to automate posting to a web forum.

As a quicker way to learning how to use WebDriver + CSS, I tried the plain send() + sleep().

Problem is, the text body could take several seconds to post, so sleep() isn't a viable way to tell AutoIT to pause before proceeding.

Is there a way to tell when it's done posting before clicking on the Submit button?

Thank you.

edu_phpbb_general_new-topic_create-topic.png.129aab5ec98bb3e3327204682e8bfc48.png

Link to comment
Share on other sites

  • Moderators

litttlebigman,

Quote

I need to write a script to automate posting to a web forum

Otherwise known as "spamming". Just exactly why do you need to automate this process?

M23

P.S. And just to be absolutely clear - this is the Mod team determining the legality of the thread, so everyone else please keep out.

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

Thanks for the info on using the clipboard() instead.

I happen to have admin rights on the forum + database, and have a perfectly valid reason to need to add posts through the web interface (importing archives from another, old software.)

---

Edit: I just had another idea to make sure the body was filled: Wait a few seconds, hash the text, compare it with the original,  if NOK try again a few times before giving up with an error.

Edited by littlebigman
Link to comment
Share on other sites

  • Moderators

littlebigman,

Fine - thread open to suggestions.

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

Hi @littlebigman,

like @ioa747 already suggested:

8 hours ago, ioa747 said:

for shorter interaction time copy to clipboard first and then paste  ;)

Something like this:

Global Const $sText = _
    'Tempora earum et nostrum qui ab repellendus hic. Unde exercitationem accusamus qui accusamus quod aut. ' & _
    'Expedita repellat quia expedita et eveniet. Omnis nulla ducimus. Officia eum sequi esse dolor rerum. ' & _
    'Ut delectus magni animi. Quisquam eius neque omnis doloribus pariatur voluptatem doloribus. Odio occaecati ' & _
    'ut qui placeat doloremque qui similique dolor rerum. Totam optio in voluptas voluptatem qui quas. ' & _
    'In atque voluptatem. Quis incidunt vel consequuntur assumenda beatae id et. Voluptas architecto aut ' & _
    'excepturi occaecati earum sint dolorum officiis. Minus ut voluptatem eius id aut. Repellat vero rerum aut.'

ClipPut($sText)

Send('^v')

And yes, like @Nine mentioned, Send() will block other actions from being executed until it's done. At least as far as I know there shouldn't be any problem with it?!

Best regards
Sven

Edited by SOLVE-SMART

Stay innovative!

Spoiler

🌍 Au3Forums

🎲 AutoIt (en) Cheat Sheet

📊 AutoIt limits/defaults

💎 Code Katas: [...] (comming soon)

🎭 Collection of GitHub users with AutoIt projects

🐞 False-Positives

🔮 Me on GitHub

💬 Opinion about new forum sub category

📑 UDF wiki list

✂ VSCode-AutoItSnippets

📑 WebDriver FAQs

👨‍🏫 WebDriver Tutorial (coming soon)

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