Jump to content
Sign in to follow this  
c.haslam

Multiple Copy and Paste with a Web-app Form with HotKeySet

Recommended Posts

c.haslam

I use a web app for data entry. Sometimes there are fields that need the same values in a new form as they have in an old form. So I wish to copy the values of these fields somewhere, and then paste them into the new form. Here is my code:

Opt("SendKeyDelay",200)
Opt("MustDeclareVars",1)

Global $data[5]
HotKeySet("^+{F2}","CopyData")
HotKeySet("^+{F4}","PasteData")
HotKeySet("{pause}","EndIt")
    
while True
    sleep (1000)
WEnd

Func CopyData()
local $ix,$i
    $ix = -1
    For  $i=0 to 10
        Switch $i
        case 0,3,6,7,10
            Send("^a^c")
            $ix += 1
            $data[$ix] = ClipGet()
        EndSwitch
        Send("{tab}")
    Next
EndFunc

Func PasteData()
local $ix,$i
    $ix = -1
    For $i = 0 to 10
        Switch $i
        case 0,3,6,7,10
            $ix += 1
            Send($data[$ix],1)  ; raw keystrokes
        EndSwitch
        Send("{Tab}")
    Next
EndFunc

Func EndIt()
    Exit
EndFunc

Press Ctrl_Shift_F2 to copy, and Ctrl_Alt_F4 to paste. I need to cut and paste fields 0,3,6,7, and 10.

Here's the problem: I run the script. I press Ctrl_Shift_F2. I see successive fields selected on the screen. But then (in SciTe) selecting with the mouse is odd. It's as though selection has already begun! For selection with a mouse to work OK again I have to reboot. Why?

Also, it seems that the keyboard doesn't work until I stop the script running. The webapp and script are running on XP SP2.

...chris


Spoiler

CDebug Dumps values of variables including arrays and DLL structs, to a GUI, to the Console, and to the Clipboard

 

Share this post


Link to post
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
Sign in to follow this  

×