AutoHotkey Community

It is currently May 27th, 2012, 11:54 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 9 posts ] 
Author Message
PostPosted: November 10th, 2005, 1:45 pm 
HI

I have found tremendous info on this site about scripts and find them amazing. i have the script working but i would like it to be scheduled at 6pm every evening. it is to drop the volume on the computer and then up it again at 6 in the morning. Any ideas? i'm still searching for an answer but if someone knows please email me at niri@ananzi.co.za

Thanks a million


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: November 10th, 2005, 2:53 pm 
Offline

Joined: March 24th, 2005, 11:50 am
Posts: 398
Location: germany
Try this one:

Code:
Gui, Add, DateTime, 1 vMyStartTime , 'DayStartTime:' HH:mm:ss
Gui, Add, DateTime, 1 vMystopTime , 'DayStopTime:' HH:mm:ss
Gui, add, text,section, Day-Volume  [`%]
Gui, add, text,, Night-Volume [`%]
Gui, add, edit,ys vDayVolume, 80
Gui, add, edit, vNightVolume, 20
Gui, add, button, section gStart, Start
gui, show
return


;********this part of the skript starts by pressig the button. Read about gui“s and g-label**************
Start:
Gui, submit, nohide                           ; get the info from the gui, and don`t hide it
Stringright, MyStartTime, MyStartTime, 6      ;We get a Timecode with the Format YYYYMMDDHH24MISS
Stringright, MyStopTime, MyStopTime, 6        ; back from the 2 DateTimecontrols, wie need to drop YYYYMMDD
                                                ; Stringright gets only the 6 chars from thr right side

setTimer, CheckVolume, 1000         ; Start the Part CheckVolume each second once
return



;*********this is the next part, started each second by setTimer, CheckVolume, 1000*****************
CheckVolume:
Stringright, Acual_Time, A_now, 6         ; again a long timecode, we have to shorten
                  ; the System_variable A_now contains the Actual time

if (MyStartTime <  Acual_Time  and  Acual_Time < MyStopTime)
{
   SoundSet, %DayVolume%  ; Set the master volume to vDayVolume%
   tooltip, high Volume
}
else
{
   SoundSet, %NightVolume%  ; Set the master volume to vNightVolume%
   tooltip, low Volume
}
return

;***********************************************************************************************************

you only have to adjust the math a bit


Last edited by garath on November 11th, 2005, 10:06 am, edited 1 time in total.

Report this post
Top
 Profile  
Reply with quote  
 Post subject: Thanks!
PostPosted: November 11th, 2005, 8:48 am 
HI Garath

Thank you so much. i tried it and it works perfectly. So does it mean i can use the similar code for any types of scripts that need to be timed?

Thanks i learnt alot from your code. I appreciate you time.

Kind Regards,
NIRI


Report this post
Top
  
Reply with quote  
PostPosted: November 11th, 2005, 9:09 am 
Garath

I just want to ask something. the GUI allows the times and percentages to be changed via the interface. But i see there are 6's in the software. Does it mean it that at 6pm it will drop the volume even though i've set the time to 9pm manually?

Thanks,
NIRI


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: November 11th, 2005, 10:11 am 
Offline

Joined: March 24th, 2005, 11:50 am
Posts: 398
Location: germany
I changed the description in the script. I hope, you can understand it, now.
One remaining problem is the situation
Starttime 22:00
Endtime 5:00

now the Timer won`t work like intended

You need to change the math, for situations Startime > Endtime
but for situations EndTime > Starttime it will work :wink:


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 11th, 2005, 4:53 pm 
Offline

Joined: July 30th, 2005, 3:31 pm
Posts: 13
Could you not just set the time length of the script and activate it with scheduled task manager on a timed daily basis?


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 11th, 2005, 5:41 pm 
Offline

Joined: March 24th, 2005, 11:50 am
Posts: 398
Location: germany
I could, but I like standalone solutions, hihi
But you could explain niki the usage of the scheduled task manager, sorry, I never used it :?


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 16th, 2005, 12:23 pm 
HI

Initially before i posted on this forum, i did get the application to start in Scheduled Tasks, but it still required intervention(shortcut keys) to put the sound up and down.

WIth Garaths software, you set the time of up and down. How can i get the script then to run with scheduled tasks?

That is very interesting.


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: November 16th, 2005, 3:41 pm 
Offline

Joined: March 24th, 2005, 11:50 am
Posts: 398
Location: germany
If you use the scheduled tasks, build 2 ahk-scripts, one for day, and one for night.
first script for Day
Code:
SoundSet, 100     ;Day-volume is 100%

second script for night
Code:
SoundSet, 40    ;Night-volume is 40%

So you have two scripts, which could be used by scheduled tasks


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

All times are UTC [ DST ]


Who is online

Users browsing this forum: BrandonHotkey and 17 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