Jump to content
Sign in to follow this  
CuriousJ

Clipget problem

Recommended Posts

I'm having a problem with clipget.

With Autoit mouse mouvement, I copy into the clipboard "+14'973" from an application.

Using MSgbox, I check that the data in the clipboard is correct: "+14'973"

As soon as I past using clipget into Excel or Notepad, I get "+4'973"

The 10000 digit is missing.

I use MSSgbox after the past and again it is correct: "+14'973"

Finally, I paste directly into Excel and Notepad (without Autoit) using Ctrl+V and all is correct.

Why is the number pasting incorrectly ?

Just to security , I have added Sleep (1000) after each line.

Any idea ? Is this related to Windows 10 localization ? 

Share this post


Link to post
Share on other sites

Thanks.

 

Here is a simple version, in this case I manually do the "copy " into the clipboard, but the problem is the same.

The MsgBox is displaying correctly the number. It sound so simple but I have been on it for a long time.

I'm thinking this could be a Windows localization problem. It's always causing problems with ' and , in number format.

 

Opt("WinTitleMatchMode", 2)
#include <MsgBoxConstants.au3>

WinActivate ( "Untitled - Notepad" )
    Sleep (1000)
    MsgBox($MB_SYSTEMMODAL, "", Clipget())
    Sleep (1000)
    Send (Clipget())

    Sleep (1000)
    MsgBox($MB_SYSTEMMODAL, "", Clipget())
    Exit

Share this post


Link to post
Share on other sites

I did one more test.

Instead of using the clipboard, I placed a variable

Local $a = "+14'965"

and then used 

Send $a

Same problem. I get "+4'965"

If use this instead, it works correctly

Local $a = "14'965"

I'll remove the "+" sign from the content of the clipboard and see if it works.

 

 

 

 

Share this post


Link to post
Share on other sites

Add the send raw parameter to Send() or else the + has a total different meaning. Open the helpfile to figure out the details. ;)

Jos


SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

You need to remember + equals shift when sending so use "{+}14'965" and it should work

Share this post


Link to post
Share on other sites

Several suggestions

First - avoid using "Send". Use ControlSend. The reason is if you send and the window focus changes, your script breaks. With ControlSend, it won't break.

Second - try to see if you can hook directly into the control you want to read so you don't have to use the clipboard as a middleman. Look at ControlGetText to read the control and ControlSetText to send data to the control.

Share this post


Link to post
Share on other sites

Thanks to all.

I don't need the "+". It is part of the data I am grabbing. I'll just remove it since that is what is causing my problem.

I'd love to use "ControlGetText" and any other methods to avoid mouse mouvements, but the controls in the program I am using seem to change ID every time. Almost all my script is done by mouse. The only exception is I am able to use "WinGetText" for some data.

P.S. I'm not a experienced programmer.

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  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...