Sign in to follow this  
Followers 0
Diana (Cda)

"Snooze" feature on a task?

5 posts in this topic

Thanks to all the great help once again from the forum! I recently returned to a contract after one month away since the person I replaced was back during that month. With my new, larger USB flash drive, it's been my goal to make myself more portable, too! This time around I'm here only for 6 weeks so to set up Outlook reminders and tasks yet again was not something I wanted to do, even though I have backups of everything. Anyway, that's why the slew of new messages from me as I've run across hitches re AI issues I'm addressing to use AI and a scheduler running off my flash drive instead of MS Outlook. I've done most of the work myself, I've just got quite a few tricky little things that I'm not finding solutions for like this delay feature I find I need.

Here is the script in question that I'd like to add some sort of snooze feature to:

;
; AutoIt v3.0
;
; this allows partial window titles to be valid!
AutoItSetOption("WinTitleMatchMode", 2)

SoundPlay ("..\WAVS\ETHTECHN21_SS01.WAV")




Sleep(5000)

; Path of "Time Logger" file to launch:  E:\WORKdirectories\WorkDir- EXCEL\TIME LOGGER for WORK.xls

Run('explorer.exe "E:\WORKdirectories\WorkDir- EXCEL\TIME LOGGER for WORK.xls')
WinWait("Excel")

WinSetState ("Excel", "", @SW_MAXIMIZE)
Sleep (10000)
WinSetState ("Excel", "", @SW_MAXIMIZE)


Exit
; finished
This works just great ... except ... that the scheduler launches the file via this AI script no matter what. Sometimes, like now, I'm not ready to leave on time so I can't enter an end time yet to the log file being opened so it would be better if I could "snooze" the action of opening the file for x-number of minutes.

When I used to run everything like this out of Outlook, a box would come up with the action reminder with the option to snooze. I use the pulldown to determine how many minutes from now I think I'll be ready and that is that.

Any ideas on how to mimic this somehow in AI? I naturally did a search first as per normal but what came up doesn't do the trick. I naturally use Sleep() a lot and that isn't relevant and other delay issues weren't quite what was needed (i.e., the delay solution in "allowing user to decide delay" [http://www.autoitscript.com/forum/index.php?showtopic=30602&hl=delay] gives me seconds only and I couldn't see how to modify it to snooze the action. Hopefully the resulting AI solution loops until one presses OK and the file launches; what I mean by that, that I can set it to snooze however many times needed until I finally press OK and have the file open.

Also, hopefully it won't be something too complicated to emulate this type of thing. Here are screenshots of 2 views of how Outlook does this: http://www.angelfire.com/art2/hypatia/Snooze_01.gif, http://www.angelfire.com/art2/hypatia/Snooze_02a.gif, http://www.angelfire.com/art2/hypatia/Snooze_02b.gif (hope these screenshots display okay! <g>). I don't need all the information that is shown in these screenshots, I just need a simple message box that says "Press OK to launch this file now or choose how many minutes to snooze ...", something like that. A box saying number of minutes is great, too, it doesn't need to be a pull-down menu as shown in these examples.

Thanks much! Appreciate all the help. :whistle:

Share this post


Link to post
Share on other sites



This isn't fancy, but it will work:

While 1
    $value = MsgBox(4, "Reminder", "Would you like to snooze?")
    If $value = 6 Then
        $input = InputBox("Snooze", "Snooze for how many minutes?", 5)
        $time = $input*1000*60
        Sleep($time)
    Else
        ExitLoop
    EndIf
WEnd

IE Dev ToolbarMSDN: InternetExplorer ObjectMSDN: HTML/DHTML Reference Guide[quote]It is surprising what a man can do when he has to, and how little most men will do when they don't have to. - Walter Linn[/quote]--------------------[font="Franklin Gothic Medium"]Post a reproducer with less than 100 lines of code.[/font]

Share this post


Link to post
Share on other sites

This isn't fancy, but it will work:

While 1
    $value = MsgBox(4, "Reminder", "Would you like to snooze?")
    If $value = 6 Then
        $input = InputBox("Snooze", "Snooze for how many minutes?", 5)
        $time = $input*1000*60
        Sleep($time)
    Else
        ExitLoop
    EndIf
WEnd
Wow, great! I missed your message while I posted my 2nd msg re non-working screenshots links. This bit of code is very neat and seems to do the job just great. I tested it to snooze for 1 minute and it came back up after one minute with same message! <g> And it quit when I pressed "No". Works for me.

However, where do you suggest putting the action to be done whenever I finally press okay? I didn't get this to work when trying to do that. I tried putting the original code in between the "Sleep($time)" and "Else" thinking that seemed best place but it obviously isn't or I'm missing more code because it doesn't work. It didn't give me choice to snooze again and immediately just launched the file, which means that I'd only get one snooze <g>. Alternatively, hitting "No" so as to not snooze but open the file directly was a no-go since the whole script just quit right at that point <lol>. I'm just such a dunce with this type of thing <sigh>.

Thanks!

(p.s., I found the #NoTrayIcon while doing a search this afternoon for all this stuff. I think I'll add that to this script so that I'm not seeing the AI icon in the systray throughout the "snooze" <g>.)

Share this post


Link to post
Share on other sites

You should be able to put the beginning of your script (if there's anything you'd like it to do before it asks you to snooze or not) before the while loop. Anything you'd like it to do after you hit "Ok" should just go after the Wend. The "Else-->ExitLoop" says to stop looping continuously, and your script will move on to the next thing after the loop, ie. the part you want to do after the snooze.


IE Dev ToolbarMSDN: InternetExplorer ObjectMSDN: HTML/DHTML Reference Guide[quote]It is surprising what a man can do when he has to, and how little most men will do when they don't have to. - Walter Linn[/quote]--------------------[font="Franklin Gothic Medium"]Post a reproducer with less than 100 lines of code.[/font]

Share this post


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
Sign in to follow this  
Followers 0