Jump to content
Server Maintenance This Week. ×

Using Command Line Events


This topic is 6413 days old. Please don't post here. Open a new topic instead.

Recommended Posts

I have been having a little difficulty with a scipt to export data out as a merge file, rename the file, and move it to a mapped network drive.

I am running a script to loop and export multiple exports with a three second pause to rename and move the file from the curent folder. The exported file is placed in the current folder as “Cutlist.csv.” Using the Send Mesage script step the file is renamed and moved with a Send Mesasge script step.

Rename:

"CMD /C " &

"RENAME " & """" & Substitute( Substitute( Substitute( Status( CurrentFilePath) , "file://" , "" ) , "/" , "" ) , Status( CurrentFileName) , "" ) & _Optimizer_FileName & """" & " " &

Substitute( Substitute( Substitute( Substitute( Substitute( Substitute( Substitute( Substitute( Substitute( Substitute( Substitute( Substitute( Substitute( Substitute( Substitute(

Trim( Substitute( Substitute( Job # , "." , "" ) , "¶" , "" ) ) & "_WO" &

Trim( Substitute( Substitute( WO # , "." , "" ) , "¶" , "" ) ) & "_" &

Trim( Substitute( Substitute( LeftWords( Mat Description , 5 ) , " " , "" ) , "¶" , "" ) ) ,

"," , "" ) , "+" , "" ) , "*" , "" ) , "/" , "-" ) , "^" , "" ) , "&" , "" ) , "=" , "" ) , ">" , "" ) , "<" , "" ) , "(" , "" ) , ")" , "" ) , ";" , "" ) , ":" , "" ) , """" , "" ) , "." , "" ) & ".csv"

Sample output = CMD /C RENAME "C:PRODINFOCutlist.csv" 2499_WO2516_13mmBirchPly.csv

Move:

"CMD /C " &

"MOVE " & """" &

Substitute( Substitute( Substitute( Status( CurrentFilePath) , "file://" , "" ) , "/" , "" ) , Status( CurrentFileName) , "" ) &

Substitute( Substitute( Substitute( Substitute( Substitute( Substitute( Substitute( Substitute( Substitute( Substitute( Substitute( Substitute( Substitute( Substitute( Substitute(

Trim( Substitute( Substitute( Job # , "." , "" ) , "¶" , "" ) ) & "_WO" &

Trim( Substitute( Substitute( WO # , "." , "" ) , "¶" , "" ) ) & "_" &

Trim( Substitute( Substitute( LeftWords( Mat Description , 5 ) , " " , "" ) , "¶" , "" ) ) ,

"," , "" ) , "+" , "" ) , "*" , "" ) , "/" , "-" ) , "^" , "" ) , "&" , "" ) , "=" , "" ) , ">" , "" ) , "<" , "" ) , "(" , "" ) , ")" , "" ) , ";" , "" ) , ":" , "" ) , """" , "" ) , "." , "" ) &

".csv" & """" &

" " & """" & _Folder_Optimizer & """"

Sample output = CMD /C MOVE "C:PRODINFO2499_WO2516_13mmBirchPly.csv" "S:CutRiteV8Import" = “server-sbs01DataCutRiteV8Import”

S: = “server-sbs01Data” Set to reconnect at login.

The difficulty is the file is not consistantly moved to the "S:CutRiteV8Import" folder. I do have greater success if I ensure the FileMaker files are opened via the same path as the destination folder.

Can anyone see anyway to improve this script or calculations?

Is this a common problem using the command line to move over network drives?

Link to comment
Share on other sites

You use pre fm7+ Statusfunctions! But this post claims to be 8adv???

However can you export a field content to a path stored in a $variable, and then let you CMD/C shift it's location if you can't get writing permissions to do it straight from filemaker...

Link to comment
Share on other sites

At first glance it looks like it should work. But the command line doesn't give you much error trapping, especially for intermittent problems like you're describing.

you may want to move this to a VBscript approach and use the VBscript plugin (www.grokittools.com) to get the feedback into FM so you can handle it.

Link to comment
Share on other sites

I found the problem today.

When a user opens the file by the network path the address is "server-sbs01" and when a user opens the file by a mapped drive the address is "S:"

I added a test to check for the colon of a drive letter and if false to add "" to the beginning of the file path.

S: = server-sbs01

Link to comment
Share on other sites

This topic is 6413 days old. Please don't post here. Open a new topic instead.

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
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.