Jump to content
Sign in to follow this  
Newbie2

ClipPut issues

Recommended Posts

Newbie2

Hi guys,

I must be doing something very wrong. Im trying to scan an excell file (which is open). What's wrong in this?

Send ("^c")
$x=clipget ()
msgbox (0,"",$x); It displayes 5
If $x = "5" Then
msgbox (0,"","OK"); Never arrived here! WHYYYYY?
EndIf
Edited by Newbie2

Share this post


Link to post
Share on other sites
Jos

Hi guys,

I must be doing something very wrong. Im trying to scan an excell file (which is open). What's wrong in this?

Send ("^c")
$x=clipget ()
msgbox (0,"",$x); It displayes 5
If $x = "5" Then
msgbox (0,"","OK"); Never arrived here! WHYYYYY?
EndIf

<{POST_SNAPBACK}>

Didn't test it but could it be that the $x var contains leading or trailing spaces ??

Try $x=StringStripWS(clipget (),3) and see if that works...


Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites
Newbie2

Bingo!! :(

I wonder why a simple excel cell contains leading or trailing spaces... :ph34r:

Share this post


Link to post
Share on other sites
Somerset

hey the code works just fine... did you remmber that you have to highlight the stuff before it can be put on the clipboard?


 

Spoiler

shoot_zpsfd329d66.png
dontbelieveeverythingyouthink_zps0e1e900

Madness is the first step to understanding...

Share this post


Link to post
Share on other sites
Newbie2

Yes, Beerman,

I have highlighted it before running the script. However, w/o Jdeb's fix, it doesn't work...

Share this post


Link to post
Share on other sites
Somerset

well what i think you are doing is this

highlighting text executing script and not putting a delay on the script or calling attention back to the window.... you have to do that, before it knows what to copy....do this. put a sleep delay on your script, like 30 seconds or something. highlight what you want then wait.... see if that works... you have to remmber to draw windows attention back to the window you want the text copied from.


 

Spoiler

shoot_zpsfd329d66.png
dontbelieveeverythingyouthink_zps0e1e900

Madness is the first step to understanding...

Share this post


Link to post
Share on other sites
Newbie2

Delay is not the problem.

I have put the delay needed, but it's not submitted in the piece of script I have submitted.

The probelm is that excel adds some spaces so If $x = "5" Then... will never be true unless you strip out the spaces by using Jdeb's fix.

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.