Jump to content


Photo
- - - - -

Checking for a file on C: drive


9 replies to this topic

#1 Dec

Dec

    Newbie

  • Members
  • Pip
  • 3 posts

Posted 21 February 2007 - 11:51 AM

Does anybody know of a good way to check from PROIV if a file exists on the C drive? I was going to write a simple VB prgram but I have the same problem if the exe does not exist.

Thanks

#2 SteveHoughton

SteveHoughton

    Member

  • Members
  • PipPip
  • 42 posts
  • Gender:Male
  • Location:Kent UK

Posted 21 February 2007 - 05:47 PM

Does anybody know of a good way to check from PROIV if a file exists on the C drive? I was going to write a simple VB prgram but I have the same problem if the exe does not exist.

Thanks


if you are running under windows then the following has worked in Pro-IV since the begining

SYSF(&#@CHKFILE,BANK-IMPORT-FILENAME,#STAT)
IF #STAT = -1 THEN
UMSG('Import File is Not Present .... ',-1)
ELSE
// File exists

#3 Dec

Dec

    Newbie

  • Members
  • Pip
  • 3 posts

Posted 22 February 2007 - 07:20 PM

Thanks Steve

I have used SYSf before to check for files on windows and Unix. The problem is I am on Unix and I want to check if a .exe exists on C:.

I tried doing a system command with a pipe to a text file but windows pops up a window and then removes it. This doesn't lookt that good so I was looking for something cleaner.

#4 George Macken

George Macken

    ProIV Guru

  • Members
  • PipPipPipPipPip
  • 248 posts
  • Gender:Male
  • Location:Co. Wicklow, Ireland

Posted 24 February 2007 - 01:08 PM

Hi

take a look at this thread, it may be helpful in resolving your current issue

http://www.proivrc.c...c=1212&hl=ASYNC

additionally in whatever command you issue is it possible to re-direct the I/O to prevent the windows dialogue box etc.,

Rgds

George

#5 Dec

Dec

    Newbie

  • Members
  • Pip
  • 3 posts

Posted 26 February 2007 - 05:09 PM

Thanks George.

I did redirect the output but Windows still pops up a window for a split second.

I have managed to solve the problem by writing a small VB program to do the checking. I pass the full path + filename to the VB program and it sends back a return code. The problem with using a VB program is you need to make sure the VB program exists on each client machine. To get around this I have transferred the .exe to the server and I do a CLIENT.Send of the file to the PC before I do the system command to call the .exe. The .exe file is tiny so when I do the transfer it takes no time to do it and I know the .exe will always exist on the client pc. I have run it and it works a treat.

Thanks for your help.

#6 Donald Miller

Donald Miller

    ProIV Guru

  • Members
  • PipPipPipPipPip
  • 205 posts
  • Gender:Male
  • Location:Cupar, Fife, Scotland
  • Interests:Motorcycling, Running, Cooking

Posted 08 October 2007 - 07:37 PM

Hi Dec

This may be well known by now - but it may mean that you can simplify your VB maintenance.

To identify if a file exists use:

#A = CLIENT.Execute($FILE,"",$PATH,"SW_HIDE")

The hide means (on my XP pro set up anyway) that the application isn't opened. The value of #A will show the status you're looking for if the the path and filename are correct. See the manual for all the return code meanings (zero - exists, 2 - file not found, 3 path not found)
Half of what he said meant something else, and the other half didn't mean anytthing at all

#7 Rob Donovan

Rob Donovan

    rob@proivrc.com

  • Admin
  • 1,640 posts
  • Gender:Male
  • Location:Spain

Posted 08 October 2007 - 07:46 PM

Hi,

Haven't tried it Donald, but doesnt that run the application rather than check the file?

SW_HIDE means run the application, but keep the application from dispalying.

However, I could be wrong...

Rob.

#8 Donald Miller

Donald Miller

    ProIV Guru

  • Members
  • PipPipPipPipPip
  • 205 posts
  • Gender:Male
  • Location:Cupar, Fife, Scotland
  • Interests:Motorcycling, Running, Cooking

Posted 08 October 2007 - 09:28 PM

Hi Rob

You'd have thought so - wouldn't you? But when I tested it with SW_HIDE there was no additional application on the start bar.

Using SW_SHOWNORMAL opens the app with the appropriate file and the window is the current one
SW_SHOWMINIMIZED opens the app but it's not shown as a window - it has to be "restored" or closed
SW_SHOWNOACTIVE (and SHOWNA) opened the app but it wasn't the current window and the current window was still behind it.

But with SW_HIDE the app may have been opened but it's then immediately closed. There is no indication of the app being opened. Either that or it's hidden somewhere else..... I'll check with the task manager.
Half of what he said meant something else, and the other half didn't mean anytthing at all

#9 Donald Miller

Donald Miller

    ProIV Guru

  • Members
  • PipPipPipPipPip
  • 205 posts
  • Gender:Male
  • Location:Cupar, Fife, Scotland
  • Interests:Motorcycling, Running, Cooking

Posted 08 October 2007 - 09:46 PM

With the task manager open there was no discernable change when SW_HIDE was used. In all the other cases there was a new app in the Application List window in the Task Manager

It must run the app tho cos if the file and dir are correct 0 is returned. If the filename is incorrect then 2 is returned. Maybe it's too fast to register (even on my aging laptop).

It might be interesting to know which is quicker: CLIENT.GetPath or CLIENT.Execute using SW_HIDE. And of course the Execute can only be used on file extensions that trigger an application (probably).

Just thought it might be useful....
Half of what he said meant something else, and the other half didn't mean anytthing at all

#10 Rob Donovan

Rob Donovan

    rob@proivrc.com

  • Admin
  • 1,640 posts
  • Gender:Male
  • Location:Spain

Posted 09 October 2007 - 06:31 AM

I see,

But SW_HIDE is a const that is normally used in other languages to start an app, but dont display it in the task bar or on the screen, kind of running it in the back ground.

I would presume that is what Client.Execute is doing...

Maybe there is a bug with Client.execute & SW_HIDE.

Rob.



Reply to this topic



  


0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users