Maverick2002 Posted January 5, 2023 Posted January 5, 2023 I use autoit for repetitive tasks involving the copying and pasting from excel to our companies ERP system. I would always use ClipPut("") to clear my clipboard to prevent error, but recently it has not been clearing my clipboard. Now, if I run my script 5-10 times, I get the error that space can't be cleared on my clipboard.
SOLVE-SMART Posted January 5, 2023 Posted January 5, 2023 Hi @Maverick2002, please share your code. This way we can possibly identify the problem. Best regardsSven________________Stay innovative! ==> AutoIt related: 🔗 GitHub, 🔗 Discord Server, 🔗 Cheat Sheet 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)
Maverick2002 Posted January 5, 2023 Author Posted January 5, 2023 Opt("SendKeyDelay",40) ;milliseconds delay between key strokes Opt("SendKeyDownDelay",0) Local $i = 0 HotKeySet("{ESC}", "Terminate") Func Terminate() Exit EndFunc While $i <2 ;put total number of cells needing copied WinActivate("279.xlsx - Excel") ;Go to Excel ClipPut("") Send("^c") WinActivate("Session A - Genesis") ;Go to Genesis Send("{I}") ;Inquire Send("^v") Send("{ENTER}");Paste Send("C") Send("{TAB}") WinActivate("279.xlsx - Excel") Send("{RIGHT}") ClipPut("") Send("^c") Send("{DOWN}{LEFT}") WinActivate("Session A - Genesis") Send("^v") Send("{DOWN 2}{NUMPADADD}") Send("{ENTER 6}") $i = $i + 1 WEnd My hotkey stopped working as well
SOLVE-SMART Posted January 5, 2023 Posted January 5, 2023 Hi @Maverick2002, I only could modify your script and test the part about ClipPut("") which works like expected on my maschine. Did you change your AutoIt version? Which version do you have? Did you change anything else which could cause the strange behavior on your maschine? You could use the Excel_UDF instead of these Send() actions to recieve your data. Best regardsSven________________Stay innovative! ==> AutoIt related: 🔗 GitHub, 🔗 Discord Server, 🔗 Cheat Sheet 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)
Solution SOLVE-SMART Posted January 5, 2023 Solution Posted January 5, 2023 (edited) Hi @Maverick2002, definitely not nice, but please try this: expandcollapse popupHotKeySet("{ESC}", "_Terminate") Func _Terminate() Exit EndFunc Func _SendWithDelay($sKey, $iHowOften = 1, $iDelay = 120) For $i = 1 To $iHowOften Step 1 Send($sKey) Sleep($iDelay) Next EndFunc Global Const $sExcel = '279.xlsx - Excel' Global Const $sGenesis = 'Session A - Genesis' Global $i = 0 While $i < 2 ; Put total number of cells needing copied WinActivate($sExcel) ; Go to Excel ClipPut("") _SendWithDelay("^c") WinActivate($sGenesis) ; Go to Genesis _SendWithDelay("{I}") ; Inquire _SendWithDelay("^v") _SendWithDelay("{ENTER}") ; Paste _SendWithDelay("C") _SendWithDelay("{TAB}") WinActivate($sExcel) _SendWithDelay("{RIGHT}") ClipPut("") _SendWithDelay("^c") _SendWithDelay("{DOWN}{LEFT}") WinActivate($sGenesis) _SendWithDelay("^v") _SendWithDelay("{DOWN 2}{NUMPADADD}") _SendWithDelay("{ENTER 6}") $i = $i + 1 WEnd I just want to know if the following two lines, which are removed in my snippet above, cause your problem? Quote Opt("SendKeyDelay",40) ;milliseconds delay between key strokesOpt("SendKeyDownDelay",0) Best regardsSven________________Stay innovative! Edited January 5, 2023 by SOLVE-SMART Maverick2002 1 ==> AutoIt related: 🔗 GitHub, 🔗 Discord Server, 🔗 Cheat Sheet 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)
Maverick2002 Posted January 5, 2023 Author Posted January 5, 2023 I used your modified code and it seems to be working flawlessly. I have a very surface level understanding of this scripting language, so your modifications are extremely helpful. Thank you very much.
Moderators Melba23 Posted January 6, 2023 Moderators Posted January 6, 2023 Moved to the appropriate AutoIt General Help and Support forum, as the Developer General Discussion forum very clearly states: Quote General development and scripting discussions. Do not create AutoIt-related topics here, use the AutoIt General Help and Support or AutoIt Technical Discussion forums. Moderation Team 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
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