eazy420 Posted August 3, 2012 Share Posted August 3, 2012 So after about 10 hours (no jokes please) i have finally finished my first script.-purpose of scriptTo set two different sets of alarm clock settings with a single click and test the volume.The program used is called AtomicAlarmClock. After a few too many days being late to work, i needed a fool-proof way of setting the alarms without my Fiance saying, "$#@#$# Erik you didnt set the alarms again!"this way i dont ever have to hear that again -what is doesFirst it closes the program so files are not write protected,Then it makes a super simple GUI my super novice fiance can easily navigate.it takes a backup copy of the alarm.ini file and replaces the one the program uses, and restarts the program.i also added a button to test the volume by maximizing the master volume, wave volume and mute toggle.i know this is going to be some messy scripting but hey, its my first success useing autoit!much of it was done by copy/pasting helpfile and forum posts and altering them until they worked.any comments will be appreciated assuming they will not be sarchastic.expandcollapse popup#include <GUIConstants.au3> if ProcessExists("AtomicAlarmClock.exe") Then ProcessClose("AtomicAlarmClock.exe") EndIf #Region ### START Koda GUI section ### Form=C:\Documents and Settings\Owner\Desktop\Form1.kxf $Form1 = GUICreate("Alarm Select", 634, 453, 193, 125) GUICtrlCreatePic('C:\Documents and Settings\Owner\Desktop\My Pictures\Bankai-The-Vizsla.jpg',0 ,0, 634, 453) GUICtrlSetState(-1, $GUI_DISABLE) $Rachael = GUICtrlCreateButton("Rachael", 0, 328, 155, 121, 0) GUICtrlSetFont(-1, 18, 800, 4, "Verdana") GUICtrlSetColor(-1, 0x800080) $Erik = GUICtrlCreateButton("Erik", 472, 328, 161, 121, 0) GUICtrlSetFont(-1, 18, 400, 4, "Tahoma") GUICtrlSetColor(-1, 0x008000) $title = GUICtrlCreateLabel("Who needs to get up?", 112, 40, 411, 46) GUICtrlSetFont(-1, 26, 800, 4, "Tahoma") $Button1 = GUICtrlCreateButton("Test that shit!", 232, 416, 145, 33, 0) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Form1 Case $Form1 Case $Form1 Case $Form1 Case $Rachael FileDelete ( "c:\documents and settings\owner\application data\Alarms.ini" ) FileCopy ( "C:\backup\rachalarm.ini", "c:\documents and settings\owner\application data\Alarms.ini" ) Run ( "C:\Program Files\Atomic Alarm Clock\AtomicAlarmClock.exe" ) Exit Case $Erik FileDelete ( "c:\documents and settings\owner\application data\Alarms.ini" ) FileCopy ( "C:\backup\erikalarm.ini", "c:\documents and settings\owner\application data\Alarms.ini" ) Run ( "C:\Program Files\Atomic Alarm Clock\AtomicAlarmClock.exe" ) Exit Case $title Case $Button1 send("{VOLUME_MUTE }") send("{VOLUME_UP 30}") SoundSetWaveVolume(100) SoundPlay(@WindowsDir & "\media\tada.wav", 0) MsgBox ( 0, "Sound Test", "Did you hear the Tada!? This button will turn the volume to maximum, and turn on/off the mute. if you didn't hear it, then press the test button one more Time, if you still didnt hear it then the speaker dial is not turned up, or not plugged into the computer.", 0) EndSwitch WEndim coming from a windows batch experience which i made my first prototype of this exe, however it did not have the options i wanted, plus i had to call a lot of other batch files, and had no support if i accidently moved a file. this is also the first time ive ever compiled a exe. (a pleasant experience all in all) Link to comment Share on other sites More sharing options...
MvGulik Posted August 3, 2012 Share Posted August 3, 2012 (edited) Not sure why, but I feel compelled to react. So after about 10 hours (no jokes please) The latter part works better if you forgo the first part. (But i'm sure there is a reason for the first part. ... Time will tell.) *drops out again (after a little exorcism) [darn spelling checker] Edited August 3, 2012 by MvGulik "Straight_and_Crooked_Thinking" : A "classic guide to ferreting out untruths, half-truths, and other distortions of facts in political and social discussions.""The Secrets of Quantum Physics" : New and excellent 2 part documentary on Quantum Physics by Jim Al-Khalili. (Dec 2014) "Believing what you know ain't so" ... Knock Knock ... Link to comment Share on other sites More sharing options...
abberration Posted August 3, 2012 Share Posted August 3, 2012 My first program was just a simple messagebox and it took me hours to figure out the various options. Anyways, I would suggest that instead of copying and overwriting the ini files, try using IniWrite to just change the values. Easy MP3 | Software Installer | Password Manager Link to comment Share on other sites More sharing options...
eazy420 Posted August 3, 2012 Author Share Posted August 3, 2012 (edited) My first program was just a simple messagebox and it took me hours to figure out the various options.Anyways, I would suggest that instead of copying and overwriting the ini files, try using IniWrite to just change the values.interesting. can i use that command in multiple lines? her alarm file is 8600 characters long (she presses snooze alot) max is a little above 4000 per line correct?also im trying to make it so any alterations made to the alarm file is kept and restored. in my batch files i had them use an indicator file which was copied over along with the replacement ini. and it would check if that file existed (so it knew whose alarms were set),deleted it, and replaced the current settings with the backup file and vs.. in essence if i unchecked all but one alarm, the next time i restore thoes alarms still only one alarm would be enabled. is there a faster way of doing this without useing an indicator file? (useing lines always run into a loop i guess and eventually both her and my alarms would become the same file)and before someone asks, i checked the program readme's and license and it says nothing about automating it, it only says i cannot decompile it. i can post a screen shot of it later Edited August 3, 2012 by eazy420 Link to comment Share on other sites More sharing options...
eazy420 Posted August 3, 2012 Author Share Posted August 3, 2012 (edited) Edited August 3, 2012 by eazy420 Link to comment Share on other sites More sharing options...
abberration Posted August 3, 2012 Share Posted August 3, 2012 Dude, I am playing with AtomicAlarmClock right now and it has the ability to create as many alarms as you want with different settings for each one such as what sound to play and the volume to play it at. Am I missing something? I don't see the point of doing what you are doing. Easy MP3 | Software Installer | Password Manager Link to comment Share on other sites More sharing options...
lorenkinzel Posted August 4, 2012 Share Posted August 4, 2012 Perhaps the joy of learning and / or doing? Like building your own: hot rod / house / guitar / anti-neighbor-cat taser / etc. when they are readily available. What is the point of doing those things? Xandy 1 Link to comment Share on other sites More sharing options...
eazy420 Posted August 5, 2012 Author Share Posted August 5, 2012 (edited) Dude, I am playing with AtomicAlarmClock right now and it has the ability to create as many alarms as you want with different settings for each one such as what sound to play and the volume to play it at. Am I missing something? I don't see the point of doing what you are doing.im glad you asked. for lack of a better description, my girl is vveerryy lazy. plus, it takes on average 15 clicks to make a new alarm in the program. you have to enable wake pc, choose the sound that doesn't sound stupid, reduce the pause between sounds to 0, play until alarm message is closed. trying to walk someone through this who hasn't done this before, at 2AM mind you , eventually i found it easier to take 10 hours out of my time to write her a program that does her job in 2 clicks. plus she always wants to make sure every alarm is set correctly and test them individually. no need anymore if they worked one, they will always work! (high five guys!)Perhaps the joy of learning and / or doing?Like building your own: hot rod / house / guitar / anti-neighbor-cat taser / etc. when they are readily available.What is the point of doing those things?exactly, i showed everyone who would be semi impressed when i had finished it. gave me a good sense of accomplisment. i cant want to make another. im just molling over ideas! Edited August 5, 2012 by eazy420 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now