Jump to content

Strings and ControlSend again


Recommended Posts

Hi,

some problems with my code. It works fine, but with

$string = ClipGet()
$string = StringReplace($string,@lf,")
ControlSend ( "Intercooled Stata 8.2", "Stata Command", "RICHEDIT1", $string &  {Enter}")

some characters get skipped by ControlSend. So far I found that

  • !
  • }
  • +
get skipped. This is a bad thing for statistical software code :D

On the other hand, ~ and - are recognized.

I read the help file on "Send Key list", but did not get a clue what I should do when these characters come up in a $variable.

Any help appreciated.

Thanks,

Eva

Link to comment
Share on other sites

Edit: Okay, I read maybe 60% of the first post and started composing mine. It's been a few hours since my last cup of caffeine :D . JdeB is probably on the right track. I'll leave the rest of my post here in case you end up finding a use for it. My soultion is for the problem where characters that should be ControlSend as capital letters (or any keys that require the shift key) get sent as if they were not using the shift key. It also applies to control and alt issues.

Problem: Sometimes characters that are sent using ControlSend do not get properly interperted by your target application. Most often this occurs with the shift key, but you can also have this problem with the Control and Alt keys.

Solution: Set the shift (or control or alt) keystroke using a global Send("{SHIFTDOWN}") before your contorl send, and a Send("{SHIFTUP}") after the keystrokes that require this modification.

Better Solution: I have created a UDF that does this for you. This means you don't have to break up your ControlSend into pieces that require and don't require the shift. Instead, you can just send your variable to my UDF, and it will properly handle the global shift state. It also has flags for setting the global state for control and/ or alt keys. You can download this via the index page that appears in my signature. It is called ControlSendPlus. Note: If you are using IE (which sucks) you must use my "direct download" link because IE doesn't properly browser my FTP directory. Also, please read the readme for information on the additional flag paramaters.

Edited by pekster

[font="Optima"]"Standing in the rain, twisted and insane, we are holding onto nothing.Feeling every breath, holding no regrets, we're still looking out for something."[/font]Note: my projects are off-line until I can spend more time to make them compatable with syntax changes.

Link to comment
Share on other sites

  • Developers

You could send the characters in RAW mode:

ControlSend ( "title", "text", "classnameNN", "string" [, flag] )

Parameters

flag [optional] Changes how "keys" is processed:

flag = 0 (default), Text contains special characters like + to indicate SHIFT and {LEFT} to indicate left arrow.

flag = 1, keys are sent raw.

Else you have to put {!} in the string to sent a ! ... etc

Check the Send command in the helpfile for a complete list.

Edited by JdeB

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

Link to comment
Share on other sites

Heh, I might have posted too quickly without reading the exact problem. Yea, if you want to use characters that are used by the "special characters" you either need to use the "special character" equivilent of them, or send them in raw mode. Raw mode is a good choice if you don't need to send keys like alt, shift, or {ENTER}. Otherwise, view the table in the Send function documentation to see what to replace each character with. ! turns into {!}, + turns into {+}, etc. Just consult the table for equivilents if you want to use flag 1.

[font="Optima"]"Standing in the rain, twisted and insane, we are holding onto nothing.Feeling every breath, holding no regrets, we're still looking out for something."[/font]Note: my projects are off-line until I can spend more time to make them compatable with syntax changes.

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