Sign in to follow this  
Followers 0
ttleser

Need Help - Directory Scan

10 posts in this topic

I need a little help here with some ideas on how to do this. My company has a fax program that receives faxes. The program will answer the phone, then save the fax as a TIF file to a directory I pick. When faxes come in, people that have access to this network directory will look in the directory every so often and then when a fax does come in, they'll move it to a subdirectory named for the person the fax belongs to.

I'd like to make a AUTOIT program that would run on the fax server and scan the fax directory for new files (new faxes) then send a message to other computers that would be running a "client" version of the incoming fax notification program, that would let people know that a new fax was received as well as little preview of the file and an ability within the client program that would allow anyone to "move" the fax to the folder of the person the fax should goto.

So really I need 2 programs, a master and a client. The master program would scan a folder for new files and send a notification to a client program. The client program would receive the notification from the master, announcing a new fax was received as well as give the user the ability to move the new fax to a subdirectory.

Any thoughts of commands that would work in AutoIT for all I explained above?

Share this post


Link to post
Share on other sites



Everything you need is in the helpfile.

FileFindFirst, FileFindNext will let you scan the directory. I would use qa networkshare if the people involved is limited.

Adlibenable or other mechanism would do as a timer say scanning every 5 mins

I guess GUICtrlCreatePic Could do as a preview container.

FileOpenDialog or FileSelectFolder and FileMove to move the file.

Share this post


Link to post
Share on other sites

Thanks so far for the suggestions on where to start. What about the ability for the master program to "send" a message to a client program? Any thoughts on what I should do for that?

Share this post


Link to post
Share on other sites

If the other program has a GUI, use Autoit Window Info tool to find the names of the controls on the GUI. Then use the following functions to manipulate them:

ControlSend()

ControlClick()

ControlSetText()

ControlCommand()

Make sure to make use of the help file and read all the details that are provided on each function. The help file is quite easy to understand for autoit, and that is why people are frustrated when they are asked questions that are answered in the FAQ of the help file.


"So man has sown the wind and reaped the world. Perhaps in the next few hours there will no remembrance of the past and no hope for the future that might have been." & _"All the works of man will be consumed in the great fire after which he was created." & _"And if there is a future for man, insensitive as he is, proud and defiant in his pursuit of power, let him resolve to live it lovingly, for he knows well how to do so." & _"Then he may say once more, 'Truly the light is sweet, and what a pleasant thing it is for the eyes to see the sun.'" - The Day the Earth Caught Fire

Share this post


Link to post
Share on other sites

Thanks so far for the suggestions on where to start. What about the ability for the master program to "send" a message to a client program? Any thoughts on what I should do for that?

You want to complicate things with a client server solution?

I would go for a shared folder as Isaid earlier but If you insist on the client/server then a good starting point are the TCP function family.

Share this post


Link to post
Share on other sites

The help file is great and awesome IF you know the name of the command you're looking for. In most instances the reason I ask on the forums is because I've looked in the help file for what I think to search for, but doesn't yield any results.

In your example Kandie Man, are you assuming that the client program will be running on the same system as the master? They wouldn't be. The client would be running on a remote system and the master would only be running on the fax server itself.

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

You want to complicate things with a client server solution?

I would go for a shared folder as Isaid earlier but If you insist on the client/server then a good starting point are the TCP function family.

So what you're saying is ditch the master program and just have each client program do the scan itself? I guess that could work.

Edited by ttleser

Share this post


Link to post
Share on other sites

At least in the beginning.

When you have it working you could make it more advanced by adding some appointer logic.

Regarding the previewer. Maybe a better solution would be to embed a IE object and use that for previewing?

Take a look at the ie.au3 udf in he help file (latest beta).

Share this post


Link to post
Share on other sites

Uten, thanks for the replies. ;)

Here's the reply I was posting while you were posting yours. I'll look into this IE.au3 file. Can you take a look at this and tell me what you think?

Is there a reason why the GUICtrlCreatePic wouldn't open a TIF file? Faxes are typically more than 1 page, could it be that it can't display it due to this Multi-page file?

Edit: Ok, tested the GUICtrlCreatePic with a 1 page FAX file (tif) and it still didn't open. Here's the code, what am I doing wrong?

GUISetIcon("SHELL32.dll", 16)

; Show the GUI
GUISetState()
$listView = GUICtrlCreateListView("File Name          ", 0, 0, 100, 150)
$button_scan = GUICtrlCreateButton('&Scan', 5, 300, 75, 23)
$button_exit = GUICtrlCreateButton('E&xit', 90, 300, 75, 23)
$search = FileFindFirstFile("*.tif"); just look in current directory for tif files.

While 1

    $msg = GUIGetMsg()

    Select
            Case $msg = $button_exit
                Exit
            Case $msg = $GUI_EVENT_CLOSE
                Exit
            Case $msg = $button_scan

        _GUICtrlListViewDeleteAllItems($listView)
            
        While 1
            $file = FileFindNextFile($search)
            If @error Then ExitLoop
            GUICtrlCreatePic ($file, 295, 5, 200, 275)
            GUICtrlCreateListViewItem ($File, $listView)
        WEnd
            FileClose($search)
        EndSelect

WEnd

Now, I tested the code with a JPG file and it worked fine. Any thoughts?

Share this post


Link to post
Share on other sites

Sorry I don't know. Maybe tif is not supported? You know, tif used to be (and probably still is) a patented file format.

You could also try to put a GUICtrlSetImage ( controlID, filename [, iconID [, icontype]] ) in there just for testing. But, I can't see why it should not work if tif is supported.

Maybe you can dig something out of this?

If you don't get anything out of it and as there is only two threads returned by a +tif +GUICtrlCreatePic search I would create a new thread asking if GUICtrlCreatePic supports tif

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