AutoHotkey Community

It is currently May 27th, 2012, 10:23 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 15 posts ] 
Author Message
PostPosted: August 8th, 2007, 9:24 pm 
Offline

Joined: June 26th, 2007, 4:30 am
Posts: 44
I bet there are threads somewhere in the forum about executing the script at the given time, but I seem not to find it.

so does anyone know where is the thread or have any suggestion that can help me to execute my script every morning around 7am.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: August 8th, 2007, 9:34 pm 
Offline

Joined: July 15th, 2007, 1:43 am
Posts: 1320
Code:
#Persistent    ; Script by BoBo
SetTimer, Chronos, 500
Return

Chronos:
FormatTime, TimeToMeet,,HHmm
If TimeToMeet = 1006 ; If you wanted the script to start at 7 am put change 1006 to 700
{
   Run notepad
   ExitApp
   }
Return

_________________
Religion is false. >_>


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: August 8th, 2007, 9:43 pm 
Offline

Joined: June 6th, 2006, 3:19 pm
Posts: 1654
Location: Denmark
lexikos has suggested a method without a timer: http://www.autohotkey.com/forum/viewtopic.php?t=21670&start=15

_________________
RegEx Powered Dynamic Hotstrings
COM
AutoHotkey 2


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: August 8th, 2007, 9:43 pm 
Offline
User avatar

Joined: August 30th, 2005, 8:43 pm
Posts: 8667
Location: Salem, MA
30 seconds of searching:
http://www.autohotkey.com/forum/viewtopic.php?t=19842
http://www.autohotkey.com/forum/viewtopic.php?t=5040
http://www.autohotkey.com/forum/viewtopic.php?t=8882
http://www.autohotkey.com/forum/viewtopic.php?t=6296

_________________
Image
(Common Answers) - New Tutorials Forum - Humongous FAQ


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: August 8th, 2007, 9:56 pm 
Offline

Joined: June 26th, 2007, 4:30 am
Posts: 44
dieom wrote:
Code:
#Persistent    ; Script by BoBo
SetTimer, Chronos, 500
Return

Chronos:
FormatTime, TimeToMeet,,HHmm
If TimeToMeet = 1006 ; If you wanted the script to start at 7 am put change 1006 to 700
{
   Run notepad
   ExitApp
   }
Return


engunneer gave some links and one of the links has the script above which is what I'm looking for. thank you dieom


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: August 8th, 2007, 10:00 pm 
Offline

Joined: June 26th, 2007, 4:30 am
Posts: 44
engunneer wrote:


maybe i didn't search enough. these are the phrases that I used to search:

execute script at specific time, get time, launch time, time, but no luck, so thank you engunneer..


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: August 8th, 2007, 10:06 pm 
Offline
User avatar

Joined: August 30th, 2005, 8:43 pm
Posts: 8667
Location: Salem, MA
I searched "scheduled time"

_________________
Image
(Common Answers) - New Tutorials Forum - Humongous FAQ


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: August 8th, 2007, 10:40 pm 
Offline

Joined: July 15th, 2007, 1:43 am
Posts: 1320
I searched "BoBo"

_________________
Religion is false. >_>


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: August 9th, 2007, 12:07 am 
Offline

Joined: June 26th, 2007, 4:30 am
Posts: 44
sorry to ask you guys again. Did Bobo say the script works? how come when I tried it didn't run.

I kept change the time 1006 accordingly to the real time:
Code:
If TimeToMeet = 1006 ; If you wanted the script to start at 7 am put change 1006 to 700


as I waited and waited but I didn't see the Notepad running. Every time I made the change in the script according to the real time which was always 2 minutes ahead before I closed out the script then waited for Notepad to launch, but I didn't see. For example if 4:10pm, I would change to 1610.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: August 9th, 2007, 12:14 am 
Offline
User avatar

Joined: August 30th, 2005, 8:43 pm
Posts: 8667
Location: Salem, MA
please post your whole code. You are running the AHK file, right?

_________________
Image
(Common Answers) - New Tutorials Forum - Humongous FAQ


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: August 9th, 2007, 12:35 am 
Offline

Joined: June 26th, 2007, 4:30 am
Posts: 44
here is my code:
Code:
#Persistent
SetTimer, begin_execute, 500

begin_execute:
{

   FormatTime, time_to_build, , HHmm
   ;start_time = 700 ;start time is at 7:00am

   if(time_to_build = 1618) ;execute at 4:18pm
   {

      string1 := "start time is "
      Gosub, build_file_info

      string1 = %time_to_build%
      Gosub, build_file_info

      string1 := "`n"
      Gosub, build_file_info

      GoSub, run_the_uninstaller ;uninstall the program

      ExitAPP

   } else {

      string1 = %time_to_build%
      Gosub, build_file_info

      string1 := " is not the start time to test the build...`n"
      Gosub, build_file_info

      ExitApp

   }

}


I'm using regular NotePad with extension .ahk; each time I made changes, I compiled and closed out the script then waited, but the script didnt do anything. Unless I double clicked on the script file then it executed else it wouldn't run automatically at the given time.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: August 9th, 2007, 12:45 am 
Offline

Joined: July 15th, 2007, 1:43 am
Posts: 1320
Code:
      if(time_to_build = 1618) ;execute at 4:18pm
   {

      string1 := "start time is "
      Gosub, build_file_info

      string1 = %time_to_build%
      Gosub, build_file_info

      string1 := "`n"
      Gosub, build_file_info

      GoSub, run_the_uninstaller ;uninstall the program

      ExitAPP

   } else {

      string1 = %time_to_build%
      Gosub, build_file_info

      string1 := " is not the start time to test the build...`n"
      Gosub, build_file_info

      ExitApp

   }

}


I think this is being recognized as a function rather then an if. Try this:

Code:
      if time_to_build = 1618 ;execute at 4:18pm
   {

      string1 := "start time is "
      Gosub, build_file_info

      string1 = %time_to_build%
      Gosub, build_file_info

      string1 := "`n"
      Gosub, build_file_info

      GoSub, run_the_uninstaller ;uninstall the program

      ExitAPP

   } else {

      string1 = %time_to_build%
      Gosub, build_file_info

      string1 := " is not the start time to test the build...`n"
      Gosub, build_file_info

      ExitApp

   }

}

_________________
Religion is false. >_>


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: August 9th, 2007, 12:56 am 
Offline

Joined: June 26th, 2007, 4:30 am
Posts: 44
hmm really, but then when I double click on the script, the If-statement works though. The reason I know it works because of the output to the file and it matches with the condition.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: August 9th, 2007, 3:08 am 
Offline
User avatar

Joined: August 30th, 2005, 8:43 pm
Posts: 8667
Location: Salem, MA
the script file needs to be always running. The SetTimer will activate the If at the right time. If you don't want the exe always running, you must use task scheduler.

_________________
Image
(Common Answers) - New Tutorials Forum - Humongous FAQ


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: August 9th, 2007, 5:14 pm 
Offline

Joined: June 26th, 2007, 4:30 am
Posts: 44
oh ok, that is the information I'm missing. I think I'm just going to use schedule task thus hope it works to execute my script daily in the morning.


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

All times are UTC [ DST ]


Who is online

Users browsing this forum: Bing [Bot], chaosad, robotkoer and 67 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