Jump to content

Recommended Posts

Posted

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()?

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
Posted

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

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)

Posted

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.

Posted

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.

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...