Jump to content

Program to press a button at a certain time?

Ok so i made you this software in VB6.

Here is src & exe:

http://www.mediafire.com/download/nrdbcc0e5vel9l4/Alarm.rar

Here is screenshot:

-snip-

Cool, but why VB6? Instead of a more modern VB or something like C#?

Spoiler

System:

i5 3570k @ 4.4 GHz, MSI Z77A-G43, Dominator Platinum 1600MHz 16GB (2x8GB), EVGA GTX 980ti 6GB, CM HAF XM, Samsung 850 Pro 256GB + Some WD Red HDD, Corsair RM850 80+ Gold, Asus Xonar Essence STX, Windows 10 Pro 64bit

PCPP:

http://pcpartpicker.com/p/znZqcf

 

Link to post
Share on other sites

Ok so i made you this software in VB6.

Here is src & exe:

http://www.mediafire.com/download/nrdbcc0e5vel9l4/Alarm.rar

Here is screenshot:

 

What key will it press?

Link to post
Share on other sites

What key will it press?

So no interest in my solution huh?

"You know it'll clock down as soon as it hits 40°C, right?" - "Yeah ... but it doesnt hit 40°C ... ever  😄"

 

GPU: MSI GTX1080 Ti Aero @ 2 GHz (watercooled) CPU: Ryzen 5600X (watercooled) RAM: 32GB 3600Mhz Corsair LPX MB: Gigabyte B550i PSU: Corsair SF750 Case: Hyte Revolt 3

 

Link to post
Share on other sites

So no interest in my solution huh?

Yours doesn't work.

 

It does nothing when it hits the alarm time.

Link to post
Share on other sites

Yours doesn't work.

 

It does nothing when it hits the alarm time.

O.o did you read the manual? - worked for me. so thats odd. anyway thats still good feedback ill have a look and fix it if i can

"You know it'll clock down as soon as it hits 40°C, right?" - "Yeah ... but it doesnt hit 40°C ... ever  😄"

 

GPU: MSI GTX1080 Ti Aero @ 2 GHz (watercooled) CPU: Ryzen 5600X (watercooled) RAM: 32GB 3600Mhz Corsair LPX MB: Gigabyte B550i PSU: Corsair SF750 Case: Hyte Revolt 3

 

Link to post
Share on other sites

O.o did you read the manual? - worked for me. so thats odd. anyway thats still good feedback ill have a look and fix it if i can

 

There was a manual? I didn't see one, i'll check when I get home.

Link to post
Share on other sites

There was a manual? I didn't see one, i'll check when I get home.

-.- honestly i put the setup and a txt file named "Manual" together in one zip and you dont see it? why werent you asking about how to use it properly then?

"You know it'll clock down as soon as it hits 40°C, right?" - "Yeah ... but it doesnt hit 40°C ... ever  😄"

 

GPU: MSI GTX1080 Ti Aero @ 2 GHz (watercooled) CPU: Ryzen 5600X (watercooled) RAM: 32GB 3600Mhz Corsair LPX MB: Gigabyte B550i PSU: Corsair SF750 Case: Hyte Revolt 3

 

Link to post
Share on other sites

Well, through the Windows Task Scheduler, you can schedule a task to wake the computer up if it's in sleep mode, so if you're using any script-based mthod to start the playlist, you can schedule a task to run that script at, say, 7:00 AM, check the "wake from sleep" button, and then put your computer to sleep at night.  (I don't know how this would work if your computer requires a log-in when you boot back up, so maybe check into that).

 

I'll also throw a recommendation to maybe try AutoHotkey for this.  (If you don't know about it, it's a macro language which is really nice for automating user input stuff like keystrokes and mouse clicks, but is pretty dang versatile).  You should be able to set it up to automatically open Spotify if it isn't open already (3-4 lines, tops), then navigate through the menus to your playlist and start playing it (send command followed by a few keystroke combinations, or a click command).  Manually navigating through menus probably isn't the most elegant method of doing this, but it should be pretty simple, easy, and quick.  Plus, elegance probably isn't hugely important if you're using this to wake you up, since you won't be using your computer when you're asleep, probably.  So you can probably slack a bit for easy code over efficient/elegant execution.

 

Or, if you plan to leave your computer on all night with the playlist already open, it would just be as simple as one line: send (whatever key(s) you hit to make spotify start playing).  Also, note that I don't use Spotify, or I could whip up and test a quick script to do this rather than speaking in generalities and vague terms.  That said, AHK should be able to do what you want, probably elegantly/effectively enough, and it should be easy to learn enough to write the script yourself and tweak it as needed.  AHK is pretty quick to pick up and you can do a lot with a pretty limited set of commands.

Link to post
Share on other sites

to everyone who tried my solution:

 

1. read the manual

2. stuff doesnt work? feedback. extra functionality wanted? feedback. any questions really? FEEDBACK.

 

come on people thats how software development work give me some feedback here so i can make it better if needed 

 

also Azgoth 2 is right using scheduled tasks could even wake the system at certain times. if wanted i could try to integrate that functionality

"You know it'll clock down as soon as it hits 40°C, right?" - "Yeah ... but it doesnt hit 40°C ... ever  😄"

 

GPU: MSI GTX1080 Ti Aero @ 2 GHz (watercooled) CPU: Ryzen 5600X (watercooled) RAM: 32GB 3600Mhz Corsair LPX MB: Gigabyte B550i PSU: Corsair SF750 Case: Hyte Revolt 3

 

Link to post
Share on other sites

to everyone who tried my solution:

 

1. read the manual

2. stuff doesnt work? feedback. extra functionality wanted? feedback. any questions really? FEEDBACK.

 

come on people thats how software development work give me some feedback here so i can make it better if needed 

It worked for me but I really don't think a simple thing like this needs an installer, a standalone exe would be much better.

 

Also, are you using the Send/PostMessage method to start playing or simulating input?

1474412270.2748842

Link to post
Share on other sites

It worked for me but I really don't think a simple thing like this needs an installer, a standalone exe would be much better.

 

Also, are you using the Send/PostMessage method to start playing or simulating input?

yeah i would have preferred an exe file too but exactly because i used a dll for communication with spotify i wanted it neat and tidy hence the installer.

 

just to really give an answer youre right im not simulation key strokes. im directly communication with spotify specifically.

 

thanks for the feedback

"You know it'll clock down as soon as it hits 40°C, right?" - "Yeah ... but it doesnt hit 40°C ... ever  😄"

 

GPU: MSI GTX1080 Ti Aero @ 2 GHz (watercooled) CPU: Ryzen 5600X (watercooled) RAM: 32GB 3600Mhz Corsair LPX MB: Gigabyte B550i PSU: Corsair SF750 Case: Hyte Revolt 3

 

Link to post
Share on other sites

nice how long have you been programming?

 

Cool, but why VB6? Instead of a more modern VB or something like C#?

I was coding in VB6 since I was 7-8 years old. In that time C# was new and no one really care for that thing.
I'm now coding on web, but i still remember good part of VB6.

 

 

What key will it press?

This program is going to press left click, i was thinking that is good options because probably "play button" in on left click, just standard mouse click.

Link to post
Share on other sites

Okay, so just for funsies, I went ahead and downloaded Spotify to see if I could get an AHK script working.  I did, and it's under ten lines, but it's probably a bit cruder of an approach than what cluelessgenius has made made.  You'll have to install AutoHotkey (the install is small and very fast, and AHK is really nice for writing macros, so if you have any need for that, I'd recommend you install AHK anyways) and tell Windows to automatically run Spotify URIs through Spotify, which should be as easy as finding a URI link somewhere, clicking it, and clicking the box in the pop-up window that says something like "always use this program" or whatever.

 

Then, open up Notepad, paste the following code into it, replace "SPOTIFYURI" with your Spotify playlist's URI, then save it as a .ahk file.

SetTitleMatchMode, 2SetKeyDelay, 200run, SPOTIFYURIwinwait, Spotifysleep 30000WinActivate, Spotifysend {tab}{enter}{tab}{tab}{enter}exitapp

This runs the Spotify URI link, which should automatically open through Spotify and bring up the playlist you want to play.  Then it waits for the Spotify window to exist, pauses for thirty seconds (since, at least for me, Spotify can take a while to let me do stuff in it after the window technically opens), activates the window (just in case it somehow got de-activated or focus shifted to another window somehow), then types out tab-enter-tab-tab-enter.  That combination of keys, for me, brings up a button that says "jump to main content," hits enter to select that, then hits tab two more times to select the "play" button, and hits "enter" to start playing the playlist.  Finally, it closes the script and the instance of AutoHotkey running it.

 

Then just dump the script somewhere, and go into the Task Scheduler and create a new task to run the .ahk file.  Under "triggers," if you select "weekly," you can specify what days of the week to run on so it only runs, say, Monday through Friday, and not on weekends.  Or whatever days you need it to.

 

I haven't tested whether this works well with "wake from sleep" in the task scheduler, but I'd recommend putting something like sleep 60000 (or a bigger number) at the very top of the script (which would tell it to wait for one minute before running anything else in the script), just to ensure your computer is fully awake, since I don't know how the timing of when the task scheduler runs the script will work with respect to when your computer is fully awake from sleep mode.  I also don't think this will work if you need to log on to your computer when it wakes up, but again, I haven't tested it.  It should work fine if you're leaving your computer on all night, but if you're going to do that, you might as well use one of the other solutions people have made here.

 

Also: to test the script on your own (which you should definitely do just to be sure), it can help to put a hotkey line in the first line.  Then, double-click the .ahk file to run it.  Since there's a hotkey given in the first line now, the script won't run until you press win+p (or whatever key/key combination).

Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now

×