Jump to content

Recommended Posts

Posted (edited)

Hi Experts,

I need your inputs and idea if can autoit notify the user if has new file saved in his/her folder? Like to loop in that folder and popup notification GUI (see sample attached). I've got it from google. :sweating:

I can't start compiling code from this point. I have no idea how to handle notification. I also tried help but it's different of what i've expected to do.

Any help and idea would be great from experts on this forum. I'm kind of new learner in autoit and this forum helps me a lot. Hope you can extend your support for a seeker like me.:>

Thanks in advance guys....

Notify.png

Edited by KickStarter15

Programming is "To make it so simple that there are obviously no deficiencies" or "To make it so complicated that there are no obvious deficiencies" by C.A.R. Hoare.

  • Moderators
Posted (edited)

KickStarter15,

I have used the FileSystemMonitor and ReadDirectoryChanges UDFs to monitor folders for changes. My personal preference goes to the former as it is self-contained while the latter requires a DLL.

As to the pop-up notification, look at my Toast & Notify UDFs (links in my sig below).

M23

Edited by Melba23
Fixed links

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

  Reveal hidden contents

 

Posted

Hi M23,

Thanks for your help, i finally got the idea how but I coded it my self and compiled some codes from help and your Notify UDF, and I've got the result I need.

Big big appreciation with your coding M23 and If you have any modification of what i coded below that would be helpful.

#include <WinAPI.au3>
#include <GUIConstants.au3>
#include <ListViewConstants.au3>
#include <WindowsConstants.au3>
#include <IE.au3>
#Include <File.au3>
#Include <Array.au3>
#include <DateTimeConstants.au3>

Opt("GUIOnEventMode", 1)
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate(@UserName, 190, 350, 192, 100)
GUISetOnEvent($GUI_EVENT_CLOSE, "Form1Close")
GUISetOnEvent($GUI_EVENT_MINIMIZE, "Form1Minimize")
GUISetOnEvent($GUI_EVENT_MAXIMIZE, "Form1Maximize")
GUISetOnEvent($GUI_EVENT_RESTORE, "Form1Restore")
$Label1= GuictrlcreateLabel("0",0,0,0,0)
GUICtrlSetOnEvent(-1, "Label1Click")
$List1 = GUICtrlCreateListView("                                      |", 3, 30, 179, 293,$LVS_NOCOLUMNHEADER,$LVS_EX_FULLROWSELECT)
GUICtrlSetOnEvent(-1, "List1Click")
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

Func popup()
   $popup = GUICreate("New file saved to folder...", 350, 30, 1020,960, $WS_POPUPWINDOW)
   GUISetOnEvent($GUI_EVENT_CLOSE, "popup")
   $Label = GUICtrlCreatelabel("New file saved to folder...", 1, 1, 250, 23,-1)
   GUICtrlSetFont(-1, 12, 800, 0, "Arial")
   GUICtrlSetColor(-1,0xFFFFFF)
   GUICtrlSetBkColor(-1, 0x3D95FF)
   GUISetState(@SW_SHOW)
WinSetTrans("New file saved to folder...","",255)
sleep(1000)
WinSetTrans("New file saved to folder...","",240)
sleep(200)
WinSetTrans("New file saved to folder...","",230)
sleep(200)
WinSetTrans("New file saved to folder...","",220)
sleep(200)
WinSetTrans("New file saved to folder...","",210)
sleep(200)
WinSetTrans("New file saved to folder...","",200)
sleep(200)
WinSetTrans("New file saved to folder...","",190)
sleep(200)
WinSetTrans("New file saved to folder...","",180)
sleep(200)
WinSetTrans("New file saved to folder...","",170)
sleep(200)
WinSetTrans("New file saved to folder...","",160)
sleep(200)
WinSetTrans("New file saved to folder...","",150)
sleep(200)
WinSetTrans("New file saved to folder...","",140)
sleep(200)
WinSetTrans("New file saved to folder...","",130)
sleep(200)
WinSetTrans("New file saved to folder...","",120)
sleep(200)
WinSetTrans("New file saved to folder...","",110)
sleep(200)
WinSetTrans("New file saved to folder...","",100)
sleep(200)
WinSetTrans("New file saved to folder...","",70)
sleep(200)
WinSetTrans("New file saved to folder...","",65)
sleep(200)
WinSetTrans("New file saved to folder...","",60)
sleep(200)
WinSetTrans("New file saved to folder...","",0)
sleep(200)

if WinSetTrans("New file saved to folder...","",0) then GUISetState(@SW_HIDE)
   EndFunc

ListUser()

$nFiles = "D:Programs\" & @UserName & "\Folder"
$xFiles = DirGetSize($nFiles,1)
GUIctrlsetdata($Label1, $xFiles[1])

While 1
   Sleep(1000)
   local $arraynfiles = DirGetSize($nFiles,1)

   If GUICtrlRead($Label1) < $arraynfiles[1] then
   GUIctrlsetdata($Label1, $arraynfiles[1])
    popup()
 endif
 
WEnd
Func ListUser()
$FILE=_FileListToArray("D:Programs\" & @UserName & "\Folder")
    if @error then
    else
       
    For $INDEX = 1 To $FILE[0]
       $POINT = StringInStr($FILE[$INDEX],"_",0,-1)
      if $POINT <> 0 then
      GUICtrlCreateListViewItem(StringLeft($FILE[$INDEX],$POINT-1),$List1)
      endif
    Next
 endif
EndFunc
Func Form1Close()
Exit
EndFunc

I tried having it that way to see if it works. When new file saved at the path "$nFiles" notification popup at the bottom of your desktop.

I never expected i can compiled it that way but looks so messy at all.:lol:

Anyway, am I doing it right? I'm a little bit confused with it. Please can you make it more nicer.:sweating:

Thanks...

Programming is "To make it so simple that there are obviously no deficiencies" or "To make it so complicated that there are no obvious deficiencies" by C.A.R. Hoare.

  • Moderators
Posted

KickStarter15,

  Quote

am I doing it right?

Expand  

If it works for you then the answer is : Yes! I would have done it very differently as I explained above, but that does not make mine the only solution.

As to cleaning up the code - I would suggest using a loop to fade the notification:

GUISetState(@SW_SHOW)
    WinSetTrans($popup, "", 255) ; Use the GUI handle as you have it
    Sleep(1000)
    For $iTrans = 240 to 0 Step -10
        WinSetTrans($popup, "", $iTrans)
        Sleep(200)
    Next
    GUISetState(@SW_HIDE)
EndFunc

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

  Reveal hidden contents

 

Posted
  On 2/18/2017 at 10:01 AM, Melba23 said:

As to cleaning up the code - I would suggest using a loop to fade the notification:

GUISetState(@SW_SHOW)
    WinSetTrans($popup, "", 255) ; Use the GUI handle as you have it
    Sleep(1000)
    For $iTrans = 240 to 0 Step -10
        WinSetTrans($popup, "", $iTrans)
        Sleep(200)
    Next
    GUISetState(@SW_HIDE)
EndFunc

 

Expand  

Wowwww... :drool: I never had it in mind that it can also be done this way...  Thank you so much M23, you have made my day perfect.:D

 

  On 2/18/2017 at 10:01 AM, Melba23 said:

If it works for you then the answer is : Yes! I would have done it very differently as I explained above, but that does not make mine the only solution.

 

Expand  

 Thank you M23, i think i can have it this way.

Programming is "To make it so simple that there are obviously no deficiencies" or "To make it so complicated that there are no obvious deficiencies" by C.A.R. Hoare.

Posted

M23,

How can I change this forum to [Solved]... Don't know how..^_^

Programming is "To make it so simple that there are obviously no deficiencies" or "To make it so complicated that there are no obvious deficiencies" by C.A.R. Hoare.

  • Developers
Posted
  On 2/18/2017 at 11:14 AM, KickStarter15 said:

How can I change this forum to [Solved]...

Expand  

There is no option to click, but you could simply update the title and prefix it with [Solved] if you want.

Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Posted

Thanks, guys. Noted on this. ;)

Programming is "To make it so simple that there are obviously no deficiencies" or "To make it so complicated that there are no obvious deficiencies" by C.A.R. Hoare.

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...