Jump to content

Yes/No Dialog, but only once a day


Recommended Posts

I've created a script that guides me through tasks that I should do every day (ex: check email, open music).

After each task, a dialog pops up with Yes or No.

If I click Yes, it needs to be marked as done for Today only. If I click no, it won't be marked as done for today.

Meaning if I run the script again, it will only do the tasks that weren't done (clicked no)

How would I go about doing this?

Link to post
Share on other sites

So essentially, you need to save the result of your yes presses and have some sort of time associated with it?  There are many ways to do this: you could save the data to a file or the registry for example. 

Each solution has their place and ideal scenario, but depending on the requirements, one solution may be more appropriate than others; for example: a registry solution may be most appropriate for a single specific computer, a local or network file solution may be appropriate for a mobile solution, a centralized network database solution could be best if needing to track multiple machines with multiple users.

So, what are your requirements?

 

Some functions to explore in your help file.  Might give you some initial ideas.

RegWrite
FileWrite
IniWrite
_DateDiff

 

Link to post
Share on other sites

Thanks for the info so far. I'm reading up on RegWrite right now.

Basically, I only want to do each task (dialog box) once per day. If I already clicked Yes today, it won't show up again, even if I restart the script or my computer.

I was thinking of writing to Excel but that seems far too complicated for me as I'm not well-versed in programming.

Link to post
Share on other sites

@smud

As @spudw2k suggested, you could easily do an Ini file, in which you put all your tasks as sections, and a key to mark if you already did that operation or not :)

An easy "format" of the Ini file could be:

[TaskName]
Done=Yes ;No

Look at Ini* functions in the Help file.

Then, at the start of your script, you have to read all the sections in an array, and obtain the values of the Done key, in order to let the script asks you if you want to do a certain operation or not.

When you are prompted with that question, and you click on "Yes", then you simply use an If...Else...EndIf statement, and, in case of $IDYES, you write Done = Yes to the specific section, so you don't have to worry if you restart your script in the same day.

By the way, you should think to reset your Ini file everyday, or you are not going to be asked to do something anymore :D

Try those functions and let us know ;)

Click here to see my signature:

Spoiler

ALWAYS GOOD TO READ:

 

Link to post
Share on other sites

Thank you guys! Got it working. (except the date comparison, but np).

 

Local $sRead = IniRead("Z:\Automation" & "\JustDoThis.ini", "General", "Music", "Default Value")
If $sRead == "No" Then
    If MsgBox(4, "4 Minutes", "Play Music") = 6 Then
          IniWrite("Z:\GoogleDrive\Work\TrueAutomation\_Just Do This" & "\JustDoThis.ini", "General", "Drums", "Yes")
    Else
          IniWrite("Z:\GoogleDrive\Work\TrueAutomation\_Just Do This" & "\JustDoThis.ini", "General", "Drums", "No")
    EndIf
EndIf

 

Link to post
Share on other sites

@smud

For the date comparsion, you could easily save:

- or the last access to the task, and so, you would have another key for each section you have;

- or the last access to the file, and so, you would have only one section, plus your tasks, in which you save the last time you access "by script" the file :)

As @spudw2k suggested, look at _Date* functions, especially at _DateDiff() ;)

Click here to see my signature:

Spoiler

ALWAYS GOOD TO READ:

 

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
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...