Garfke Posted September 3, 2009 Share Posted September 3, 2009 To open a file I paste the path of that file in the "open file dialog" but the pathC:\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()? Link to comment Share on other sites More sharing options...
WolfWorld Posted September 3, 2009 Share Posted September 3, 2009 (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 September 3, 2009 by WolfWorld Main project - Eat Spaghetti - Obfuscate and Optimize your script. The most advance add-on.Website more of GadGets! Link to comment Share on other sites More sharing options...
Garfke Posted September 3, 2009 Author Share Posted September 3, 2009 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. Link to comment Share on other sites More sharing options...
WolfWorld Posted September 3, 2009 Share Posted September 3, 2009 What value did you set it to? Do you have your cap lock on? Main project - Eat Spaghetti - Obfuscate and Optimize your script. The most advance add-on.Website more of GadGets! Link to comment Share on other sites More sharing options...
Garfke Posted September 3, 2009 Author Share Posted September 3, 2009 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) Link to comment Share on other sites More sharing options...
jvanegmond Posted September 3, 2009 Share Posted September 3, 2009 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. github.com/jvanegmond Link to comment Share on other sites More sharing options...
Garfke Posted September 3, 2009 Author Share Posted September 3, 2009 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. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now