Jump to content

Set Variable to what is on Clipboard


Recommended Posts

Hey there. I have been lurking for a while, and have normally been able to come up with the solution after some trial and error. Looked around for a while, with the search tool, and in the UDF ( thought the Excel portion might have something I could use), and I am stumped. 

I have a function that is going to run through a data base, and I need it to stop once it hits the last item out of the list I am coping.

$t =  "" 
   While $t <> "Last Value" 
      Send("{SPACE}")
      Local $checksum = PixelChecksum(316,303,437,368);)
      While $checksum = PixelChecksum(316,303,437,368);)loop to wait for the page to load
      WEnd 
      Send("{DOWN}")
      Send("{DOWN}")
      Send("{DOWN}")
      Send("{ENTER}")
      Send("^c")
      WinActivate("Untitled-Notepad")
      Send("^v")
      Send("{ENTER}")
      Mousemove(641,449)
      MouseClick("Left")
      Local $checksum = PixelChecksum(316,303,437,368);)
      While $checksum = PixelChecksum(316,303,437,368);)loop to wait for the page to load
      WEnd 
      $t = Send("^v")
      WEnd
      EndFunc
   
    

$t = Send("^v") is something I tried, just to see if it would work, and it did not.

The route I am trying to use right now it to get the string that I have copied, and set it to $t, then the while loop will continue until it hits the last string.

Open to new ideas.  

 
Link to comment
Share on other sites

You haven't given us a lot to go on.

What's this script being used for?

What would be the "Last Value" and where do you get it from etc?

Check out the clipboard commands.

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

i think it will be much easier to do what you r trying to do with the Firefox UDF or the IE functions. also, you can use FileOpen() and FileWrite() to your advantage. allows more consistent results since you dont have to wait for the file to open and close on the screen. 

note: make sure you look at the modes on FileOpen(). mode 1 or 2 is what you r probably going to be most interested in i think.

Link to comment
Share on other sites

I have to copy a list from a database off Citrix, that is 100,000 ish different names. I have access to the last string in the table, so knowing that I can test against that until that is true. 

At this point the code above is hitting a the space bar of the field, bring up their auto complete, (and because the space is at the end of the word, it just brings up where I left off in the list, so the down key strokes moves me to the next one). From there I just copy the text field, (it wont let me copy from the auto complete menu, or this would be much easier)  then paste, onto note pad. 

The checksums are just looking for screens to open/close, with citrix sometimes server lag messes up the whole process without them. 

Its working as intended, but it pretty slow 3-4 seconds per word, I am open to any way to speed this up. I will look into what you posted Kidney. 

Link to comment
Share on other sites

Short answer, instead of $t = Send("^v"), try $t=ClipGet().  That should fix what you have.

I think you will speed things up considerably if you learn how to use LoadWait.  I am not familar with the Firefox UDF, but I suspect it is the same.

If you are accessing this through an InternetExplorer page, it would be _IELoadWait($oIE), where $oIE is an object variable that you have set to the web browser.

something like this, assuming your browse page title starts with "citrix":

#include <IE.au3>

$oIE = _IEAttach("citrix")

Send("{SPACE}")

_IELoadWait($oIE)

Not knowing what you are trying to do, I can't recommend how to speed the other things up.

Why are you using Notepad?  I am not sure you need it.

It looks like your Down, Down, Down, Enter is trying to get to a specific field, if you know what the fieldname is, you could just get the contents or value of that field and do away with the other stuff.

Just another newbie trying to help.

Link to comment
Share on other sites

Using Autoit Window Info I do not get any info for any of the fields in the >Control< section, so I just went with the basic keyboard inputs. 

I am not using Firefox or IE, I am accessing a test DB through Cirtix, From reading the descriptions for the functions above, I would have to have the files localized on my machine. 

I am using notepad so at some point we can integrate the list into a web app allowing users the ability to select/add the needed information to a profile. 

I do have another issue, not sure if I should post it here, or in a new thread. 

Ill do it here unless the mod says other wise " He seems on top of everything!! Keep it up! "  :thumbsup:

I am still in Citrix, and I need to see if a box is "checked" or not. 

My approach is going to be use the PixelSearch again and test the area for the black check mark, and just use a if() statement. Does this seem as the most logical way, or am I over looking something. 

local $p = PixelSearch(402,246,406,251,0x000000); Looking for black pixel
Switch $p
case IsArray($p) = True ;if true then there is a check in the box
   Switch $CmdLine[1]
   Case $CmdLine[1] = "Primary" ;the user wants there to be a check in the box so leave it as is
      ;do nothing
   Case Else 
      Send("{SPACE}"); anything else from the command line removes the check mark
   EndSwitch
Case Else ; other than true, means no check mark in the box 
   Switch $CmdLine[1]
   Case $CmdLine[1] = "Primary" , checks to see if the user wanted a check mark
       Send("{SPACE}") ;puts a check mark in the box
   Case Else 
      ;do nothing ; User didnt want a check mark do nothing
   EndSwitch
EndSwitch

Well this is what I threw together. 

:thumbsup:  or  :thumbsdown:

After some testing, unmarking the box every time. I guess it has something to do with how I am using pixel search. 

Link to comment
Share on other sites

In this project we do not have direct access to the data base, only a "guest" access at this point so we don't have access to their tables directly. I'm going to be making a user friendly web app on the front end, and then autoit scripts will be called and doing a bulk of the grunt work on the back end. 

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