Sign in to follow this  
Followers 0
Garfke

C:\ becomes C;\ ?

7 posts in this topic

To open a file I paste the path of that file in the "open file dialog" but the path

C:\data\... becomes C;\data\... ?

ControlFocus("Open worksheet","","Edit1");

;Sleep(100);

ControlSend("Open worksheet","","Edit1",$myData,1);

$myData contains the full absolute path to a file.

When I uncomment the sleep the "pasted path" is OK... but this looks like a hack to me.

Is there a better solution then Sleep()?

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

To open a file I paste the path of that file in the "open file dialog" but the path

C:\data\... becomes C;\data\... ?

$myData contains the full absolute path to a file.

When I uncomment the sleep the "pasted path" is OK... but this looks like a hack to me.

Is there a better solution then Sleep()?

This happen because you send it to fast and the shift key get lost in the process.

You can fix by setting these settings to a higher delay.

Opt("SendKeyDelay", 5)          ;5 milliseconds
Opt("SendKeyDownDelay", 1)      ;1 millisecond

Another suggestion is that if you don't need to send. Then use

ControlSetText ( "title", "text", controlID, "new text" [, flag] )

This is faster than the other but required more information for it to work.

Edited by WolfWorld

Share this post


Link to post
Share on other sites

This happen because you send it to fast and the shift key get lost in the process.

You can fix by setting these settings to a higher delay.

Opt("SendKeyDelay", 5)          ;5 milliseconds
Opt("SendKeyDownDelay", 1)      ;1 millisecond

Another suggestion is that if you don't need to send. Then use

ControlSetText ( "title", "text", controlID, "new text" [, flag] )

This is faster than the other but required more information for it to work.

Tnx for the answer. The first suggestion doesn't work. The ; is still there.

Share this post


Link to post
Share on other sites

What value did you set it to? Do you have your cap lock on?

The second suggestion doesn't work either...

Caps lock is not on.

$myData contains the string : C:\data\eclipse\workspace\project\input.txt (read from commandline)

Share this post


Link to post
Share on other sites

Using sleep in a way you described in your first post is not a hack at all. It's a very common thing to do, you're simply giving the app some time to fully process the ControlFocus command you've just sent it.

An ideal solution would be to hook into the process you are sending ControlFocus to and know when it's done with the command you sent it. The problem is that there's really no way to determine where the code ends that is being run by app when you send it the command.

Share this post


Link to post
Share on other sites

Using sleep in a way you described in your first post is not a hack at all. It's a very common thing to do, you're simply giving the app some time to fully process the ControlFocus command you've just sent it.

An ideal solution would be to hook into the process you are sending ControlFocus to and know when it's done with the command you sent it. The problem is that there's really no way to determine where the code ends that is being run by app when you send it the command.

Ok, I thought there was possibly some "wait" function...

Tnx for the replies.

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  
Followers 0