Jump to content
Macro Express Forums

Locating a share drive


johnboy691
 Share

Recommended Posts

Hi All:

 

I have a csv file located on the company server(s) which I access through the X: drive, which is a share drive. When something is saved to this share drive it is duplicated immediately on other servers using drives. ie: S, T, U, W, etc. Most processors access this shared drive through the X: drive. Some however, especially our home telecommuters access the exact same files but using the path of one of the other drives as noted above.

 

My macro now uses the ASCII File Begin Process command using the path X:\FSA\Macro Express\User ID List.csv

 

Is there a way I can Find what path is the share drive letter for those processors who use S, or T, or U, or W, etc.? If there is I could have the macro copy that info into a variable and have the macro go to the operational part of the macro and look for the file using that processor's share drive letter.

 

Thanks for any help you can give.

 

John

Link to comment
Share on other sites

I had a similar need (USB drive letters change, even on the same computer). Try this:

 

// ----------------------------------------------------------------------------------------------------------------------------------
//   Sample: Find file on unknown drive - 
// ----------------------------------------------------------------------------------------------------------------------------------

// Initialization
Variable Set String %T10% "FSA\Macro Express\User ID List.csv"

// Repeat from 67 ('C') to 90 ('Z')
Repeat Start (Repeat 24 times)
 Variable Set %T1% to ASCII Char of %N1%

 If Folder Exists "%T1%:\"
If File Exists "%T10%"
  Break
End If
 End If
Repeat End

 

T10 will contain the drive letter. You may want to speed things up by limiting the number of drives to fewer than C: through Z:. (See the Repeat Start command.)

 

<REM2:----------------------------------------------------------------------------------------------------------------------------------><REM2:  Sample: Find file on unknown drive - ><REM2:----------------------------------------------------------------------------------------------------------------------------------><REM2:><REM2:Initialization><TVAR2:10:01:FSA\Macro Express\User ID List.csv><REM2:><REM2:Repeat from 67 ('C') to 90 ('Z')><REP3:01:000067:000001:00024:1:01:><ASCIIC:1:0:1><REM2:><IFOTH:02:1:%T1%:\><IFOTH:01:2:%T10%><BREAK><ENDIF><ENDIF><ENDREP>

Link to comment
Share on other sites

Hi Kevin:

 

Thanks so much for the help! I think I'm almost done. Everything seems to work "except" it always comes up Z for the drive (and I don't even have a Z). I have a T, U and X it could stop at that has the ...User Id..csv file. But it alwys comes up Z.

 

I'll include the script. Do you see what I may be doing wrong. I've tried different combinations. Thansks so much.

 

<REM2:Initialization><TVAR2:99:01:FSA\MACRO EXPRESS --NEW 7-18-2006\John Boller\CSV\GFLX USER ID LIST.csv><REM2:><REM2:Repeat from 78 ('N') to 90 ('Z')><REP3:01:000078:000001:00013:1:01:><ASCIIC:98:0:1><IFOTH:02:1:%T98%:\><IFOTH:01:2:%T99%><BREAK><ENDIF><ENDIF><ENDREP><REM2:Display box just for test purposes to show file and drive captured in variables><TBOX4:T:1:CenterCenter000278000200:000:InfoT98 = %T98%

 

T99 = %T99%><REM2://Searches for User ID><TVAR2:77:02:FWhat is the GFLX USER ID you want to look for?FF0Right:Center><MSD:150><ADFBEG:F10:001:000001:000000:%T98%:\FSA\MACRO EXPRESS --NEW 7-18-2006\John Boller\CSV\GFLX USER ID LIST.csv><IFVAR2:4:07:1:T77T><

Link to comment
Share on other sites

When including macro script please enclose in CODE tags. Look at the icons above the box where you type. Code tags help separate the script from surrounding text.

 

Further, it is nice to copy the commands in script format as well. (In the script editor highlight what you want to copy, right-click, and click on 'Copy Command Text'. Paste the result within CODE tags.

 

This is what it should look like using your script:

<REM2:Initialization><TVAR2:99:01:FSA\MACRO EXPRESS --NEW 7-18-2006\John Boller\CSV\GFLX USER ID LIST.csv><REM2:><REM2:Repeat from 78 ('N') to 90 ('Z')><REP3:01:000078:000001:00013:1:01:><ASCIIC:98:0:1><IFOTH:02:1:%T98%:\><IFOTH:01:2:%T99%><BREAK><ENDIF><ENDIF><ENDREP><REM2:Display box just for test purposes to show file and drive captured in variables><TBOX4:T:1:CenterCenter000278000200:000:InfoT98 = %T98%

T99 = %T99%><REM2://Searches for User ID><TVAR2:77:02:FWhat is the GFLX USER ID you want to look for?FF0Right:Center><MSD:150><ADFBEG:F10:001:000001:000000:%T98%:\FSA\MACRO EXPRESS --NEW 7-18-2006\John Boller\CSV\GFLX USER ID LIST.csv><IFVAR2:4:07:1:T77T><TEXTTYPE:<>

// Initialization
Variable Set String %T99% "FSA\MACRO EXPRESS --NEW 7-18-2006\John Boller\CSV\GFLX USER ID LIST.csv"

// Repeat from 78 ('N') to 90 ('Z')
Repeat Start (Repeat 13 times)
 Variable Set %T98% to ASCII Char of %N1%
 If Folder Exists "%T98%:\"
If File Exists "%T99%"
  Break
End If
 End If
Repeat End
// Display box just for test purposes to show file and drive captured in variables
Text Box Display: Info
// //Searches for User ID
Variable Set String %T77% from Prompt
Delay 150 Milliseconds
ASCII File Begin Process: "GFLX USER ID LIST.csv" (Comma Delimited Text )
 If Variable %T7% = variable %T77%
Text Type: <

Note that the last few lines of your script are messed up. Copying with Code tags helps prevent this.

Edited by kevin
Link to comment
Share on other sites

It looks like the script is not finding the file. You will need to figure out why that is so. But you could improve the script by changing this:

// Repeat from 78 ('N') to 90 ('Z')
Repeat Start (Repeat 13 times)
 Variable Set %T98% to ASCII Char of %N1%
 If Folder Exists "%T98%:\"
If File Exists "%T99%"
  Break
End If
 End If
Repeat End

to this:

// Repeat from 78 ('N') to 90 ('Z')
Repeat Start (Repeat 13 times)
 Variable Set %T98% to ASCII Char of %N1%
 If Folder Exists "%T98%:\"
If File Exists "%T99%"
  Break
Else
  // If we're done searching through all the drives and the path
  // wasn't found, set the drive variable to 'NOT FOUND'
  If Variable %T98% = "Z"
	Variable Set String %T98% "NOT FOUND"
  End If
End If
 End If
Repeat End

Link to comment
Share on other sites

It works!!! Thanks again so much Kevin. My problem was the format I had the folders and files and drive letter set up. This will save me so much manual work trying to make different macros for telecommuters who have "other" drives. I can't believe I put this off for so long. I really, really appreciate your help! Thanks for the code directions too.

 

John

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...