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 

on off

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





PostPosted: Sun Jul 06, 2008 4:16 pm    Post subject: on off Reply with quote

hey i need a script so alt 1 turn script on and alt 1 turns it off
Back to top
SpiderGames



Joined: 09 Jun 2008
Posts: 331
Location: Canada

PostPosted: Sun Jul 06, 2008 4:57 pm    Post subject: Reply with quote

if you want to start it with alt and close it with alt...
it's easyer if you use alt and ctr-alt but w/e..

Code:

{Alt}::
{
 if valt = 1
 {
 valt = 0
  }
 else if valt = 0
 {
 valt = 1
 }
}

if valt = 1
{
 Loop,
 {
 ; your script...
 if valt = 0
  {
   Break,
   }
   else
   {
   Continue
   }
 }
}

_________________
"I reject your ReAlItY and Substitute with my Own"
_______________________________________
Pie Is exactly 3!
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger MSN Messenger
Guest






PostPosted: Sun Jul 06, 2008 5:08 pm    Post subject: Reply with quote

doesnt seem to be working just says somethings wrong and cant fin {alt}
Back to top
vahju



Joined: 17 Feb 2008
Posts: 69

PostPosted: Sun Jul 06, 2008 5:18 pm    Post subject: Reply with quote

Change
Code:
{alt}::

to one of the following:
Code:

!::
RALT::
LALT::
Back to top
View user's profile Send private message
garry



Joined: 19 Apr 2005
Posts: 1078
Location: switzerland

PostPosted: Sun Jul 06, 2008 5:20 pm    Post subject: Reply with quote

Code:
#persistent

!1::
V++
M:=mod(V,2)
if M=1
   goto,GUI3
else
   Gui,3:destroy
return


GUI3:
Gui,3:add,text,x10 y30 ,Myprogram
Gui,3:Show,x0 y40 h60 w200,Myprogram
return

3Guiclose:
if M=1
   V++
Gui,3:destroy
return


Last edited by garry on Sun Jul 06, 2008 6:08 pm; edited 3 times in total
Back to top
View user's profile Send private message
Guest






PostPosted: Sun Jul 06, 2008 5:28 pm    Post subject: Reply with quote

ok guys its not coming up that error anymore but its not turnin on or off
Back to top
Guest






PostPosted: Sun Jul 06, 2008 5:59 pm    Post subject: Reply with quote

nice work gary but it doesnt actually stop wen u press alt 1 it just says ur script closes in 2 seconds but doesnt
Back to top
garry



Joined: 19 Apr 2005
Posts: 1078
Location: switzerland

PostPosted: Sun Jul 06, 2008 6:02 pm    Post subject: Reply with quote

try again, made small changes
can make it better with ... ifwinexist .... etc
Back to top
View user's profile Send private message
Guest






PostPosted: Sun Jul 06, 2008 6:05 pm    Post subject: Reply with quote

this is my full code garry what do u think im doing wrong

#persistent

!1::
V++
M:=mod(V,2)
if M=1
{
msgbox,,,Your script starts in 2 seconds,2
Gui,3:add,text,x10 y30 ,Myprogram
Gui,3:Show,x0 y40 h60 w200,Myprogram
return
}

else
{
msgbox,,,Your script closes in 2 seconds,2
Gui,3:destroy
return
}
return


;WinWait, Call of Duty 4,
IfWinNotActive, Call of Duty 4, , WinActivate, Call of Duty 4,
WinWaitActive, Call of Duty 4,

~LButton::Send, {RButton}
LButton UP::Send, {RButton}
Back to top
garry



Joined: 19 Apr 2005
Posts: 1078
Location: switzerland

PostPosted: Sun Jul 06, 2008 6:13 pm    Post subject: Reply with quote

Quote:
hey i need a script so alt 1 turn script on and alt 1 turns it off

script example above just starts/closes a 2nd GUI (your new script) when press alt+1
want you start an exe program ? (I'll try again .... )
Back to top
View user's profile Send private message
Guest






PostPosted: Sun Jul 06, 2008 6:16 pm    Post subject: Reply with quote

ok sorry for the miss understanding erm do u have msn ?
Back to top
garry



Joined: 19 Apr 2005
Posts: 1078
Location: switzerland

PostPosted: Sun Jul 06, 2008 6:27 pm    Post subject: Reply with quote

if you login can write to me
I've tried again, just ask, someone has a better solution
Code:

#persistent
programx=xy.exe

!1::
V++
M:=mod(V,2)
if M=1
   goto,ProgramStart
else
   goto,ProgramClose
return

ProgramStart:
;msgbox,%programx% starts
Run,%programx%
Process,wait,%programx%
PID2 = %ErrorLevel%
Process,exist,%programx%
   {
   sleep,2000
   msgbox,Do something
   }
return


ProgramClose:
;msgbox,%programx% close
process,close,%PID2%
return
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