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 

Run&Reload

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





PostPosted: Wed May 21, 2008 1:44 pm    Post subject: Run&Reload Reply with quote

Why Reload command does not work in lower line than i have Run command to another scripts in my basic script ?? Is there a way how to solve it?
Back to top
sinkfaze



Joined: 18 Mar 2008
Posts: 139

PostPosted: Wed May 21, 2008 1:47 pm    Post subject: Reply with quote

Post your script, please?
_________________
Have trouble searching the site for information? Try Quick Search for Autohotkey.
Back to top
View user's profile Send private message
Breta
Guest





PostPosted: Wed May 21, 2008 2:24 pm    Post subject: Reply with quote

if i place PROBLEM on first line in the script then it works but APPSKEY doesn't

Code:
#Persistent

#SingleInstance force


Run E:\Documents and Settings\D-L-X\Plocha\akh.ahk
Run E:\Documents and Settings\D-L-X\Plocha\stahuj.ahk
Run E:\Documents and Settings\D-L-X\Plocha\trezzor.ahk

#IfWinActive ahk_class Notepad   ;  PROBLEM
#r::   
send,^s
SoundPlay, %A_WinDir%\Media\soubor.wav
sleep 2000
reload
return 



APPSKEY::

switch := !switch
if switch
{
Run E:\Staženo\emule
WinWait, E:\Staženo\emule
WinMove,,, 0, 0, 420, 988
Run E:\Staženo\soulseek
WinWait, E:\Staženo\soulseek
WinMove,,, 420,   0, 420, 988
Run E:\Staženo\torrent
WinWait, E:\Staženo\torrent
WinMove,,, 840, 0, 420, 988
Run E:\Staženo\dc++
WinWait, E:\Staženo\dc++
WinMove,,, 1260, 0, 420, 988
}
else
{
IfWinExist, E:\Staženo\dc++
WinClose
IfWinExist, E:\Staženo\torrent
WinClose
IfWinExist, E:\Staženo\soulseek
WinClose
IfWinExist, E:\Staženo\emule
WinClose
}
return

#IfWinActive ahk_class IrfanView
#SingleInstance force
Rbutton::
keywait, rbutton, t0.339
if errorlevel = 1 
{
;
;'press-n-hold'
;
IfWinNotExist, ahk_class OpWindow
Run E:\Program Files\Opera\Opera.exe
WinWait, ahk_class OpWindow   
    WinActivate
    WinMaximize
SendInput ^t
return

IfWinExist, ahk_class OpWindow
    WinActivate
return
}
else
keywait, rbutton, d, t0.1327633948
if errorlevel = 0
{
;
; 'double click'
;
SendInput !{F4}
return
}
else
;
; regular single click
;
Send {Right}
return



#IfWinActive ahk_class #32770     ;emule
#t::
run E:\Program Files\eMule\Temp
WinWait, E:\Program Files\eMule\Temp
WinSet, AlwaysOnTop, On
return
Back to top
HugoV



Joined: 27 May 2007
Posts: 650

PostPosted: Wed May 21, 2008 2:37 pm    Post subject: Reply with quote

Read http://www.autohotkey.com/docs/Scripts.htm#auto
Back to top
View user's profile Send private message
Breta
Guest





PostPosted: Wed May 21, 2008 7:12 pm    Post subject: Reply with quote

its really hard english for me.. can you give me explain please?
Back to top
Jex
Guest





PostPosted: Wed May 28, 2008 2:49 pm    Post subject: Reply with quote

it's because you are assuming that the .ahk files will open with notepad. but this is not the case. they will be opened with the default program which is most likely autohotkey.exe

if you change the code to this:

Code:

Run Notepad.exe E:\Documents and Settings\D-L-X\Plocha\akh.ahk
Run Notepad.exe E:\Documents and Settings\D-L-X\Plocha\stahuj.ahk
Run Notepad.exe E:\Documents and Settings\D-L-X\Plocha\trezzor.ahk


it will open the files in Notepad.

OR

add return after the first part:


Code:
#SingleInstance force

#IfWinActive ahk_class Notepad
Run E:\Documents and Settings\D-L-X\Plocha\akh.ahk
Run E:\Documents and Settings\D-L-X\Plocha\stahuj.ahk
Run E:\Documents and Settings\D-L-X\Plocha\trezzor.ahk
Return ;Here

#r::   
send,^s
SoundPlay, %A_WinDir%\Media\soubor.wav
sleep 2000
reload
return


adding return will switch back to allow input. and not need an Ahk_class Notepad to be open to run.
Back to top
another guy
Guest





PostPosted: Wed May 28, 2008 2:57 pm    Post subject: Reply with quote

do you want the script to autorun the other three?
if you do i suggest:
Code:
#Persistent

#SingleInstance force


Run E:\Documents and Settings\D-L-X\Plocha\akh.ahk
Run E:\Documents and Settings\D-L-X\Plocha\stahuj.ahk
Run E:\Documents and Settings\D-L-X\Plocha\trezzor.ahk

;#IfWinActive ahk_class Notepad   ;  Remove this line
#r::   
send,^s
SoundPlay, %A_WinDir%\Media\soubor.wav
sleep 2000
reload
return 



APPSKEY::

switch := !switch
if switch
{
Run E:\Staženo\emule
WinWait, E:\Staženo\emule
WinMove,,, 0, 0, 420, 988
Run E:\Staženo\soulseek
WinWait, E:\Staženo\soulseek
WinMove,,, 420,   0, 420, 988
Run E:\Staženo\torrent
WinWait, E:\Staženo\torrent
WinMove,,, 840, 0, 420, 988
Run E:\Staženo\dc++
WinWait, E:\Staženo\dc++
WinMove,,, 1260, 0, 420, 988
}
else
{
IfWinExist, E:\Staženo\dc++
WinClose
IfWinExist, E:\Staženo\torrent
WinClose
IfWinExist, E:\Staženo\soulseek
WinClose
IfWinExist, E:\Staženo\emule
WinClose
}
return

#IfWinActive ahk_class IrfanView
#SingleInstance force
Rbutton::
keywait, rbutton, t0.339
if errorlevel = 1 
{
;
;'press-n-hold'
;
IfWinNotExist, ahk_class OpWindow
Run E:\Program Files\Opera\Opera.exe
WinWait, ahk_class OpWindow   
    WinActivate
    WinMaximize
SendInput ^t
return

IfWinExist, ahk_class OpWindow
    WinActivate
return
}
else
keywait, rbutton, d, t0.1327633948
if errorlevel = 0
{
;
; 'double click'
;
SendInput !{F4}
return
}
else
;
; regular single click
;
Send {Right}
return



#IfWinActive ahk_class #32770     ;emule
#t::
run E:\Program Files\eMule\Temp
WinWait, E:\Program Files\eMule\Temp
WinSet, AlwaysOnTop, On
return


if you remove that line then you don't need to be running an ahk_class notepad to run the rest of the script.
Back to top
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