AutoHotkey Community

It is currently May 27th, 2012, 7:39 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 4 posts ] 
Author Message
PostPosted: September 12th, 2006, 3:21 pm 
Offline

Joined: January 1st, 2006, 6:26 pm
Posts: 55
Hi, this is very puzzling to me..

I have a shorcut set up in Autocad to zoom out on ctrl-shift-5 - ^+5. I have many other shortcuts set up there as well. If I use them from Autocad directly, they always work, including the zoom out one. I have a gui ahk script that has buttons for all these commands. They all work fine, except that the zoom out command works on average 3 times out of 4 (or so). 1 time out of four it looks like WinActivate is taking too long and command gets sent before the window is activated, and nothing happens. I looked at the cpu usage while the command is sent and it's normal, around 0 to 10%, the same as when the commands that work are sent.

It's strange that this would affect WinActivate only before this one command, which isn't anything special compared to other commands.

Since the script works by first doing 'winactivate cad 200' (so that it will work with any cad version), I added the line after that 'winwaitactive cad 200'. That didn't help. Then I added a sleep command after that, that'd sleep for 350 before sending the command. That didn't help either. But when I increase sleep to 1000, the command works every time.

The only guess I could make is that Autocad doesn't like to execute this command right after it's activated, it needs to wait about a second and only then it's ready to do it. All other commands work right away. That doesn't make any sense to me..

Anybody else run into something similar? thx!

_________________
-AK


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 12th, 2006, 3:46 pm 
Offline

Joined: January 31st, 2005, 9:50 am
Posts: 3910
Location: Bremen, Germany
No, i didn't run into it, since I do not use that software.
You may wonna try to not use WinActivate, instead send the command with ControlSend.

_________________
Ciao
toralf
Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject: Doesn't work at all!
PostPosted: September 12th, 2006, 4:38 pm 
Offline

Joined: January 1st, 2006, 6:26 pm
Posts: 55
It doesn't work at all with ControlSend...

ButtonZmin:
SetTitleMatchMode, 2
ControlSend , ahk_parent, ^+5, CAD 200
ExitApp

I tried also without ahk_parent, and that doesn't work either..... And if I send a simple string of letters it doesn't work too..

This is the first time I use controlsend so I'm probably making some stupid mistake :wink:

_________________
-AK


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 12th, 2006, 5:48 pm 
Offline

Joined: January 1st, 2006, 6:26 pm
Posts: 55
I figured out & fixed the original problem..

The issue was that I was destroying the gui after sending the shortcut. This slows down the system, even though it's not reflected on cpu meter (it may be IO system load). Therefore all commands that are light on the system would run without a hitch, but two commands that I have had a problem, one of them was color command that shows color pick box in acad, and that creates a gui and (just now I realized hatch command is also affected), basically any command that created a new box in acad was significantly slowed down, by maybe .75-1 seconds; whereas zoom out command sometimes wouldn't work at all, even though I don't understand why high load on the system would completely stop zoom out. That shouldn't happen and is probably an autocad problem (along with many others).

The solution is to keep the script always running and keep it hidden, then show it when needed and hide it again when a button is pressed. I changed it in this manner and now all commands work fine.

_________________
-AK


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: HotkeyStick, sjc1000, SKAN, tomL, Yahoo [Bot] and 68 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group