Jump to content

ControlSend corrupting String


 Share

Recommended Posts

Strange problem of variables being altered when executing ControlSend.

example-

D:\Print\printfile.pdf

being altered to

d;\print\printfile1.pdf (colon changed to semicolon as well as upper to lower case)

Example of context:

Run("C:\Program Files\Adobe\Acrobat 7.0\Reader\AcroRd32.exe")

MouseMove(14,27)

MouseClick("left")

ControlSend("","","","{DOWN 2}")

ControlSend("","","","{ENTER}")

ControlSend("Open","","Edit1",$file1,1)

($file1="D:\Print\printfile1.pdf" but appears in selection box "Edit1" as d;\print\printfile1.pdf)

If changed to ControlSend("Open","","Edit1","D:\Print\printfile1.pdf",1) it works OK.

Anyone else come across this?

Link to comment
Share on other sites

MouseMove(14,27)

MouseClick("left")

ControlSend("","","","{DOWN 2}")

ControlSend("","","","{ENTER}")

Why are you using ControlSend with blanks? Why not just use Send() or figure out what control you're sending the keys to and ControlSend("Window", "Text", "Control", "{DOWN 2}{ENTER}")? It's generally better IMHO to use Controlxxx commands than MouseMove, MouseClick and Send whenever possible.

ControlSend("Open","","Edit1",$file1,1)

Is the "Open" window open the one that DOWN and ENTER are going to, or is it a result of making a choice and hitting enter on another window?

My UDFs: ExitCodes

Link to comment
Share on other sites

Why are you using ControlSend with blanks?  Why not just use Send() or figure out what control you're sending the keys to and ControlSend("Window", "Text", "Control", "{DOWN 2}{ENTER}")?  It's generally better IMHO to use Controlxxx commands than MouseMove, MouseClick and Send whenever possible.

Is the "Open" window open the one that DOWN and ENTER are going to, or is it a result of making a choice and hitting enter on another window?

<{POST_SNAPBACK}>

Link to comment
Share on other sites

Why are you using ControlSend with blanks?  Why not just use Send() or figure out what control you're sending the keys to and ControlSend("Window", "Text", "Control", "{DOWN 2}{ENTER}")?  It's generally better IMHO to use Controlxxx commands than MouseMove, MouseClick and Send whenever possible.

Is the "Open" window open the one that DOWN and ENTER are going to, or is it a result of making a choice and hitting enter on another window?

<{POST_SNAPBACK}>

I had tried avoiding mouseclicks but could not get control to focus on the Adobe toolbar (tried all of the classnames and IDs given by 'AutIt window info' and those returned by WinList but none worked).

The ControlSend("",""...etc.) is simply because I gave up on trying to address window by name /ID and cleared the fields.

The "{DOWN 2}{ENTER}" are working on the open window and the file path variable is entered in the correct filed (Edit1) but the as d;\...etc. instead of D:\...

Link to comment
Share on other sites

All you're trying to do is open a file, so why not use:

Send("^o")
WinWait("Open")
ControlSend("Open","","Edit1",$file1,1)

Next, why are you bothering to use the open command? Why not include the filename in the Run command?

Have you tried pasting this into something other than Acrobat Reader?

I have personally never used the raw text flag, so I can only assume it works as advertised, but maybe it's causing a problem. Try the ControlSend without the ",1".

My UDFs: ExitCodes

Link to comment
Share on other sites

All you're trying to do is open a file, so why not use:

Send("^o")
WinWait("Open")
ControlSend("Open","","Edit1",$file1,1)

Next, why are you bothering to use the open command?  Why not include the filename in the Run command?

Have you tried pasting this into something other than Acrobat Reader?

I have personally never used the raw text flag, so I can only assume it works as advertised, but maybe it's causing a problem.  Try the ControlSend without the ",1".

<{POST_SNAPBACK}>

Have found solution ... simply replaced ControlSend..etc. with Send($file1)

For the record, removing the ",1" flag changed the corruption to D:|Print\printfile1.pdf !!

I tested the original script with MS WordViewer and there was no corruption so I guess it must be a 'feature' of the Adobe menu.

Only been using AutIt for a few days so it will take me a while to learn all the tricks.

Thanks for the help.

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