bavltd Posted August 15, 2007 Posted August 15, 2007 Hi I've created the following applescript to create folders and open the resulting folder based on field info from two tables "tell application " & QMK & "Finder" & QMK & "¶"& "set clientsfolder to folder "& QMK & Our Company Data::Company Client Folder & QMK & " of folder "& QMK &Our Company Data::Company Folder&QMK& " of disk " & QMK & Our Company Data::Company Drive & QMK & " as string" & "¶"& "if not (exists folder " & QMK & Contacts::Company & QMK & " of folder " &QMK&Our Company Data::Company Client Folder&QMK&" of folder " & QMK&Our Company Data::Company Folder&QMK & " of disk " & QMK & Our Company Data::Company Drive & QMK & ") then " &"¶"& "make new folder at folder clientsfolder with properties {name: " & QMK & Contacts::Company & QMK &"}" & "¶" & "end if" & "¶" & "set jobfolder to folder "& QMK & Contacts::Company &QMK & " of folder "& QMK & Our Company Data::Company Client Folder & QMK & " of folder "& QMK &Our Company Data::Company Folder&QMK& " of disk " & QMK & Our Company Data::Company Drive & QMK & " as string" & "¶"& "if not (exists folder " & QMK & Our Company Data::Company Initials &" #"& Job ID &" - " &Name & QMK & " of folder jobfolder) then " &"¶"& "make new folder at folder jobfolder with properties {name: " & QMK & Our Company Data::Company Initials& " #"& Job ID &" - " &Name &QMK&"}" & "¶" & "end if" & "¶"& "set jobfolder1 to folder "&QMK&Our Company Data::Company Initials&" #"& Job ID &" - " &Name & QMK & " of folder "& QMK & Contacts::Company &QMK & " of folder "& QMK & Our Company Data::Company Client Folder & QMK & " of folder "& QMK &Our Company Data::Company Folder&QMK& " of disk " & QMK & Our Company Data::Company Drive & QMK & " as string" & "¶"& "activate" & "¶"& "make new Finder window to jobfolder1"& "¶"& "end tell" I would like to make a similar version for Windows. Can anyone help as I'm completely lost in the windows world? Thanks Jonathan
MarkWilson Posted August 15, 2007 Posted August 15, 2007 Do you have an English version of what you are trying to accomplish?
bavltd Posted August 15, 2007 Author Posted August 15, 2007 I would like to have a button on a page that will create a folder within a directory on our server for a job database. The structure is as follows: Company Work Drive - Company Folder on Network Drive (there are three companies that use the same server) Clients folder - Name of folder where clients are stored Client Company folder - a Folder for each company Job Folder - Where documents are stored. Created from Job ID & Job name fields In windows the structure would be serverCompany Work DriveClients FolderClient Company FolderJob Folder (serverDataClientsACustomerJob#12) I would like the script to check to see if Client Company folder exists, and if not create it based on the value of that field. I would then it to check to see if the Job folder exists, otherwise I would like it to create the Job Folder within the Client Company Folder. Finally I want it to open the folder. Hopefully that makes it clearer. I have seen this done in an access database using vb script, but don't know how to run vb script in FM. Below is the vb script. The field names are slightly different, but hopefully it is clear. VB Script Private Sub Create_Directory_Click() 'On Error GoTo Err_Create_Directory_Click Dim strclientpath As String Dim strjobpath As String strclientpath = Me![DocLocation] & "" & Me![Company] & "" strjobpath = Me![DocLocation] & "" & Me![Company] & "" & Me![OurCompanyInitials] & " #" & Me![JobID] & " - " & Me![Job Description] & "" If Dir(strclientpath, vbDirectory) > vbNullString And Dir(strjobpath, vbDirectory) > vbNullString Then Exit Sub ElseIf Dir(strclientpath, vbDirectory) > vbNullString Then MkDir strjobpath Exit Sub Else MkDir strclientpath MkDir strjobpath
MarkWilson Posted August 15, 2007 Posted August 15, 2007 To script this use: Set Variable[$filepath; Value:serverDataClientsAC ustomerJob_12] Send Event["aevt"; "odoc"; "CMD /C MD " & $filepath] Open URL[No dialog; $filepath "CMD /C MD " & $filepath In English: Set a script variable for the filepath. Add the CMD operators to perform the making of directories and execute it. Open the folder. Note: You will require the the necessary write permissions to be able to perform this. I have not tested this on in a server environment, only on my local machine. To perform VB from FileMaker export the VB code to a file and call the file.
bavltd Posted August 16, 2007 Author Posted August 16, 2007 Thanks. I will give it a go. Can I create a vb script dynamically from a calculated field and run it or does it have to be external? Can I create it and export to a temp file and run that?
MarkWilson Posted August 16, 2007 Posted August 16, 2007 Yes, create the file dynamically and export it to a temp location.
Recommended Posts
This topic is 6350 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 accountSign in
Already have an account? Sign in here.
Sign In Now