Creating a IE Pop-up to run Once-a-day only

10 posts in this topic

zantlan 0

Hi there, I need some help please to get my pop-up script to run once-a-day

At present I am using this simple call script to open IE and point to a Sharepoint location to present a file to users when they log in. The problem is that with each login the IE pop-up appears, and my team is looking for some form of intelligence to work out that its already "run-once" that day and not re-run the script...

Share this post

Link to post

Share on other sites

BrewManNH 1,027

You could do it the simple way, with an INI file that has the last run date stored in it, and have your script read from that INI file to see if today's date <> last run date. Also, instead of using _IECreate, you could use ShellExecute("https://sharepoint_server/popup1.png").

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Share this post

Link to post

Share on other sites

BrewManNH 1,027

Iniread/IniWrite or RegRead/RegWrite depending on the path you want to take to accomplish this.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Share this post

Link to post

Share on other sites

BrewManNH 1,027

You can get the current date using the _NowDate() function, and compare it to the stored date. You can tailor the ini filename to the user's login name (@UserName macro), so that it will check for who ever logs in, rather than only running it once per computer per day. Change the "test.ini" to something like IniRead(@UserName & ".ini", "RunDate", "LastRunDate", "N/A"), you might want to include the path to the ini file in there as well.

#include <Date.au3>IfIniRead("test.ini","RunDate","LastRunDate","N/A")<>_NowDate()Then; checks to see if the stored date matches today's dateMsgBox(64,"No match","The stored date: "&IniRead("test.ini","RunDate","LastRunDate","")&" doesn't match todays date: "&_NowDate()); if it doesn't match, displays this msgbox (demo only)IniWrite("test.ini","RunDate","LastRunDate",_NowDate()); because it hasn't been run today, we store today's date in the INI file; place your code hereElseMsgBox(64,"Match","The stored date: "&IniRead("test.ini","RunDate","LastRunDate","")&" matches today's date: "&_NowDate()); we've already run this todayExit; so we exit the script without doing anything more.EndIf

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Share this post

Link to post

Share on other sites

BrewManNH 1,027

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.