Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Scanning for a file that is open
Message
From
18/02/2004 06:19:26
Erick Miranda
Formata Data Business - Grupo Linx
Contagem, Brazil
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00878210
Message ID:
00878223
Views:
18
Hi Neil!

In your arrUsers's column 1 have the user's number so this is number you tryied to use LTrim with it and the column 2 have a character where you tryied to do a Str. Try:
SET EXCLUSIVE OFF
SET DELETED ON
Select users.userno, users.username ;
  from "U:\Questpdm\Data\Users" ;
  ORDER BY users.username ;
  into array arrUsers
if ( _Tally > 0 )
for ix = 1 to alen(arrUsers,1)
  If File("U:\QuestPDM\Profile\User"+ltrim(str(arrUsers[ix,1]))+"\insystem.dbf")
    lnFID = Fopen("U:\QuestPDM\Profile\User1\insystem.dbf", 12)
    If lnFID = -1
      MessageBox("User "+trim(arrUsers[ix,2])+" is in system")
    Else
      Fclose(lnFID)
      MessageBox("User "+trim(arrUsers[ix,2])+" is not in system")
    ENDIF
  ENDIF
 ENDFOR
endif
I hope this help you!
P.S.: In line where have the FOpen() function. Maybe be lnFID = Fopen("U:\QuestPDM\Profile\User"+ltrim(str(arrUsers[ix,1]))+"\insystem.dbf", 12).


>I am trying to find out whether a list of users in my application are in the application. I have a user table named users. This list all users. Each user has a unique user number stored in the table. In a directory named Profiles I have a directory for each user with the name of the user being the name of the directory. An example of the user table:
>Name              Number
>
>Paul              100
>Simon             120
>In the profile directory you would see:
>U:\Profiles\User100
>U:\Profiles\User120
>When a user logs into the system there is a file named insystem.dbf in the profile directory which is opened. Therefore what I would like to do is to scan the user table to grab the users. Then goto the equivalent PROFILE directory numbers and determine whether each of there insystem.dbf files are open. If they are open I would like to list the username in a list box. Here is my code to date. I cannot get this working for some reason I get a function, argument is invalid.
>SET EXCLUSIVE OFF
>SET DELETED ON
>Select users.userno, users.username ;
>  from "U:\Questpdm\Data\Users" ;
>  ORDER BY users.username ;
>  into array arrUsers
>if ( _Tally > 0 )
>for ix = 1 to alen(arrUsers,1)
>  If File("U:\QuestPDM\Profile\User"+ltrim(str(arrUsers[ix,2]))+"\insystem.dbf")
>    lnFID = Fopen("U:\QuestPDM\Profile\User1\insystem.dbf", 12)
>    If lnFID = -1
>      MessageBox("User "+trim(arrUsers[ix,1])+" is in system")
>    Else
>      Fclose(lnFID)
>      MessageBox("User "+trim(arrUsers[ix,1])+" is not in system")
>    ENDIF
>  ENDIF
> ENDFOR
>endif
>Can anybody help me please?
Erick
Força Sempre!
Strength Always!
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform