AutoHotkey Community

It is currently May 26th, 2012, 10:01 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 4 posts ] 
Author Message
PostPosted: October 16th, 2008, 4:13 am 
Offline

Joined: October 16th, 2008, 4:01 am
Posts: 2
I have a script to help my work on OrCAD. Sometimes after I fired a hotkey (ex. F5), windows XP seemed CTRL key is always pressed. I must reboot to get ride of it.

Code:
#SingleInstance force
SetTitleMatchMode, 2
I_Icon = C:\Documents and Settings\chrisl\My Documents\icon\orcad.ico

; Change tray icon (if one was specified in the configuration section above):
If I_Icon <>
    IfExist, %I_Icon%
        Menu, Tray, Icon, %I_Icon%

#ifwinactive, Orcad Capture

   ; change connector to input type
F5::
PlaceOffPageConnector(0)
return

   ; change connector to output type
F6::
PlaceOffPageConnector(1)
return

   ; change connector to bidir type
F8::
PlaceOffPageConnector(2)
return

   ; change connector to input type
+F5::
PlaceOffPageConnector(0,2)
return

   ; change connector to output type
+F6::
PlaceOffPageConnector(1,2)
return

   ; change connector to bidir type
+F8::
PlaceOffPageConnector(2,2)
return
   ; change connector to input type
^F5::
PlacePortConnector(0)
return

   ; change connector to output type
^F6::
PlacePortConnector(1)
return

   ; change connector to bidir type
^F8::
PlacePortConnector(2)
return

   ; change connector to input type
^+F5::
PlacePortConnector(0,2)
return

   ; change connector to output type
^+F6::
PlacePortConnector(1,2)
return

   ; change connector to bidir type
^+F8::
PlacePortConnector(2,2)
return

   ; repeat work
F7::
SendInput {Enter}
SendInput {Home}
SendInput {Del}
SendInput {Del}
SendInput CARD
SendInput {Enter}
return


; type = 0 for input, 1 for output, 2 for BIDIR
PlaceOffPageConnector(type, rot=4)
{
  BlockInput On
   name := type==0 ? "OFFPAGELEFT-IN" : type==1 ? "OFFPAGERIGHT-OUT" : "OFFPAGE-BIDIR"
   mv := type==0 ? -40 : 40

   MouseGetPos, mx, my
   SendInput {Enter}
   SendInput ^c
   SendInput {Esc}
   SendInput {Del}
   SendInput !p
   SendInput f
   SendInput %name%
   SendInput {Enter}
   Click, %mx%, %my%
   SendInput {Esc}
   MouseClick, , mv, 0, , , ,R
   SendInput {Enter}
   SendInput ^v
   SendInput {Enter}
   mv := type==0 ? -40 : 45
   MouseClick, , -mv, 0, , , ,R
    loop, %rot%
    {
    SendInput r
    }
    SendInput ^x
    SendInput ^v
  BlockInput Off
   return
}

; type = 0 for input, 1 for output, 2 for BIDIR
PlacePortConnector(type, rot=4)
{
  BlockInput On
   name := type==0 ? "PORTRIGHT-R" : type==1 ? "PORTLEFT-R" : "PORTBOTH-L"
   mv := type==2 ? 50 : -50

   MouseGetPos, mx, my
   SendInput {Enter}
   SendInput ^c
   SendInput {Esc}
   SendInput {Del}
   SendInput !p
   SendInput i
   SendInput %name%
   SendInput {Enter}
   Click, %mx%, %my%
   SendInput {Esc}
   loop, 4
   {
   SendInput r
   }
   SendInput {Esc}
   MouseClick, , mv, 0, , , ,R
   SendInput {Enter}
   SendInput ^v
   SendInput {Enter}
   mv := type==0 ? -30 : 35
   MouseClick, , -mv, 0, , , ,R
   loop, %rot%
   {
   SendInput r
   }
   SendInput ^x
   SendInput ^v
  BlockInput Off
   return
}

window(title)
{
  WinWait,%title%,,2
;  WinActivate,%title%
;  WinWaitActive,%title%,,2
  return
}

#ifwinactive


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 16th, 2008, 7:57 am 
code like: SendInput ^c
sometimes doesnt do {ctrl up}

instead, use:
Code:
sendinput {ctrl down}
sleep 10
sendinput c
sleep 10
sendinput {ctrl up}

this should fix


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: October 17th, 2008, 6:19 am 
Offline

Joined: October 16th, 2008, 4:01 am
Posts: 2
Thanks a lot, your method works after 2 days testing


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 17th, 2008, 6:40 am 
Offline

Joined: August 14th, 2006, 11:54 am
Posts: 163
Location: CPH
What exactly does it do?

See I have a similar problem with the ctrl key "hanging" and I was thinking that with a loop and a getkeystate, one could make Autohotkey watch, and if the key stays down more than a few seconds it would be released...

I just don't know how to go about it?

:roll:


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: Google Feedfetcher, iBob35555VR, just me, Tilter_of_Windmills, tomoe_uehara and 72 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