littlebigman Posted February 10, 2023 Share Posted February 10, 2023 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. Link to comment Share on other sites More sharing options...
Solution ioa747 Posted February 10, 2023 Solution Share Posted February 10, 2023 for shorter interaction time copy to clipboard first and then paste pixelsearch 1 I know that I know nothing Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted February 10, 2023 Moderators Share Posted February 10, 2023 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. 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 columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
littlebigman Posted February 10, 2023 Author Share Posted February 10, 2023 (edited) 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 February 10, 2023 by littlebigman Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted February 10, 2023 Moderators Share Posted February 10, 2023 littlebigman, Fine - thread open to suggestions. M23 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 columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Nine Posted February 10, 2023 Share Posted February 10, 2023 Send (same for ControlSend) is a blocking function. Why do you need to check if all characters have been sent ? “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
SOLVE-SMART Posted February 10, 2023 Share Posted February 10, 2023 (edited) 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 February 10, 2023 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 More sharing options...
littlebigman Posted February 11, 2023 Author Share Posted February 11, 2023 (edited) Thanks for the tip. I (obviously) didn't know send() is a blocking function. So pasting via CTRL+V does the job. Edited February 11, 2023 by littlebigman Link to comment Share on other sites More sharing options...
ioa747 Posted February 11, 2023 Share Posted February 11, 2023 20 hours ago, SOLVE-SMART said: Something like this: I know that I know nothing Link to comment Share on other sites More sharing options...
littlebigman Posted February 11, 2023 Author Share Posted February 11, 2023 Yes, I misunderstood the sentence "for shorter interaction, time copy (?) to clipboard first and then paste" instead of "for shorter interaction time, copy to clipboard first and then paste" Link to comment Share on other sites More sharing options...
Nine Posted February 11, 2023 Share Posted February 11, 2023 If the body is a known control, you should use ControlSetText, it will send text instantly... “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
littlebigman Posted February 11, 2023 Author Share Posted February 11, 2023 Yes, but… it's a web-based forum, so Control*() won't do. It's not worth learning how to use WebDriver + CSS for that job. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now