Jump to content

PutClip help required


Recommended Posts

Hi

I have no idea why this code is not working. When I explicitly put a string into PutClip("adsgasdfgdfgsdf") the script compiles and runs. But when I try to use PutClip with an array a compile time error message is telling me the function is unknown.

I have only written stuff in C# so Autoit is very new to me and I am not used to datatypes being all the same like they are in autoit. Can someone see why this script is not working?

Also, I dont know anything about what is and what is not included in autoit. So I just  try to include everything i can think of lol. Is there some holy grail to include all?

#include <MsgBoxConstants.au3>
#include <Clipboard.au3>
#include <Array.au3>
#include <File.au3>
#include <AutoItConstants.au3>
#include <File.au3>
#include <String.au3>

sleep(1400)
Work()

Func Work()
    ; Read the current script file into an array using the filepath.
    Local $arr = FileReadToArray("C:\Users\BOSSMAN\Desktop\originslist.txt")
    If @error Then
        MsgBox($MB_SYSTEMMODAL, "", "There was an error reading the file. @error: " & @error) ; An error occurred reading the current script file.
    Else
        For $i = 0 To UBound($arr) - 1; Loop through the array.
            PutClip($arr[$i])
            Sleep(250)
            MouseClick($MOUSE_CLICK_LEFT, 2482, 359, 1)
            Sleep(100)
            Send("^v")
            Sleep(100)
            Send("{ENTER}")

        Next
    EndIf
EndFunc   

 

Edited by donater
Link to comment
Share on other sites

Ok, for some reason my script is only partially working. Everything works as planned except for the fact that the array is populated with only parts of my file. I looked through and it just randomly skips some entries. I tried working with the _FileReadToArray method instead of the FIleReadToArray and its confusing and i cant get it to comiple so i am going to stick with FileReadToArray for now.

My text file is delimited by line breaks and looks like this:

Jace, Vryn's Prodigy (ORI #60)
Nissa, Vastwood Seer (ORI #189)
Hangarback Walker
Liliana, Heretical Healer (ORI #106)
Kytheon, Hero of Akros (ORI #23)
Abbot of Keral Keep
Chandra, Fire of Kaladesh (ORI #135)
Archangel of Tithes
Day's Undoing
Exquisite Firecraft
Demonic Pact
Pyromancer's Goggles
Woodland Bellower
Languish (ORI #105)
Erebos's Titan
Starfield of Nyx
Shivan Reef (ORI #251)
Llanowar Wastes (ORI #248)
Alhammarret's Archive
Avaricious Dragon
Caves of Koilos (ORI #245)
Battlefield Forge (ORI #244)
The Great Aurora
Disciple of the Ring
Managorger Hydra
Yavimaya Coast (ORI #252)
Tragic Arrogance
Evolutionary Leap
Goblin Piledriver (ORI #151)
Pia and Kiran Nalaar (ORI #157)
Harbinger of the Tides
Sword of the Animist
Dwynen, Gilt-Leaf Daen (ORI #172)
Hallowed Moonlight
Scab-Clan Berserker
Thopter Spy Network
Knight of the White Orchid (ORI #21)
Molten Vortex
Dark Petition
Herald of the Pantheon
Gilt-Leaf Winnower
Vryn Wingmare
Sigil of the Empty Throne (ORI #31)

 

Anyone know why my script is only picking up some of the elements? Also I dont think it has anything to do with some entries have (OPI # ***), as some of those values post and some dont.

Link to comment
Share on other sites

Not sure why you would want to put an array as is on the Clipboard, and then attempt to paste it elsewhere.

If you are just after the text, with included separator character, then just use _ArrayToString command when placing on the clipboard.

Make sure brain is in gear before opening mouth!
Remember, what is not said, can be just as important as what is said.

Spoiler

What is the Secret Key? Life is like a Donut

If I put effort into communication, I expect you to read properly & fully, or just not comment.
Ignoring those who try to divert conversation with irrelevancies.
If I'm intent on insulting you or being rude, I will be obvious, not ambiguous about it.
I'm only big and bad, to those who have an over-active imagination.

I may have the Artistic Liesense ;) to disagree with you. TheSaint's Toolbox (be advised many downloads are not working due to ISP screwup with my storage)

userbar.png

Link to comment
Share on other sites

  • Moderators

donater,

Welcome to the AutoIt forums.

Looking at the content of that array, please take the time to read the Forum rules before you post again.

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

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