AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

How to ensure if some hotket key is pressed or not ...

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
padarrju



Joined: 23 Jan 2006
Posts: 37
Location: Vadodara - Gujarat (INDIA)

PostPosted: Thu Oct 05, 2006 5:19 am    Post subject: How to ensure if some hotket key is pressed or not ... Reply with quote

Hello All AutoHotKey Users & Developers,

I have developed a small program to auto logon SAP application using some hot key. I need to check if the hot key is not pressed within 30 seconds, autohotkey program should automatically closed & exit.

My code is given below :

Code:
#SingleInstance ignore
#Persistent
#NoTrayIcon

SetKeyDelay,100
winminimizeall

IniRead, sap_user_id,c:\\sap_pswd.ini,SAP_LOGON,SAP_USERID
IniRead, pswd, c:\\sap_pswd.ini,SAP_LOGON,SAP_PASSWORD

#S::
RUN,C:\\Program Files\\SAP\\FrontEnd\\SAPgui\\SAPgui.exe fagind01.xx.yyy.com 00
sleep,2000

Wait_SAPR3:
;---------------
IfWinNotExist,SAP R/3,,Goto,Wait_SAPR3
WinWait, SAP R/3
WinActivate, SAP R/3
WinMaximize, SAP R/3
send,%sap_user_id%
send,{TAB}
sleep,3000
send,%pswd%
send,{enter}
sleep,2000
ifwinexist,Info on incoming documents,,winactivate,Info on incoming documents
ifwinactive,Info on incoming documents,,send,{Enter}
finish:
exitapp
Return

esc::ExitApp

; End Of Script .....

Best Regards,

Raju C Padaria
Back to top
View user's profile Send private message
AiKscroll



Joined: 06 Jun 2005
Posts: 179
Location: Northern Virginia

PostPosted: Thu Oct 05, 2006 7:40 am    Post subject: Reply with quote

Code:

#SingleInstance ignore
#Persistent
#NoTrayIcon

SetKeyDelay,100
winminimizeall

IniRead, sap_user_id,c:\\sap_pswd.ini,SAP_LOGON,SAP_USERID
IniRead, pswd, c:\\sap_pswd.ini,SAP_LOGON,SAP_PASSWORD
SetTimer, Pressed, 30
Return

Pressed:
If !used
ExitApp
Return

#S::
used := true
RUN,C:\\Program Files\\SAP\\FrontEnd\\SAPgui\\SAPgui.exe fagind01.xx.yyy.com 00
sleep,2000

Wait_SAPR3:
;---------------
IfWinNotExist,SAP R/3,,Goto,Wait_SAPR3
WinWait, SAP R/3
WinActivate, SAP R/3
WinMaximize, SAP R/3
send,%sap_user_id%
send,{TAB}
sleep,3000
send,%pswd%
send,{enter}
sleep,2000
ifwinexist,Info on incoming documents,,winactivate,Info on incoming documents
ifwinactive,Info on incoming documents,,send,{Enter}
finish:
exitapp
Return

esc::ExitApp

_________________
_AiK
Back to top
View user's profile Send private message AIM Address
padarrju



Joined: 23 Jan 2006
Posts: 37
Location: Vadodara - Gujarat (INDIA)

PostPosted: Thu Oct 05, 2006 9:04 am    Post subject: Reply with quote

Thank U very very much !!!
Your code is working fine !!!

Best Regards & Hope the same support for newbies like us.

Raju C Padaria
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group