Jump to content

Windows OS Equivalent to Perform AppleScript Script Step


Darrin King
 Share

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

Recommended Posts

We currently run FileMaker Server Advanced 11 on Mac OS X server.  We will be making the move to FMS 13 in the next 6 months and are exploring the option of moving our FMS to our Windows virtual server farm.   We use the AppleScript script step in a few of our solutions to run shell scripts and modify text files in the OS on the server.  I am struggling to find an equivalent method for the Windows side.  Below are a couple of examples of what we currently do.  My hope is someone here can post an explanation with examples to get us off and running.   

 

#Add header to export file and convert to Windows CRLF
Perform AppleScript
   [ Native AppleScript: 
 
--Add header row
do shell script "perl -i -lne 'if($.==1){print "uidNumbertgidNumbertSamAccountNametPasswordtSurNametGivenNametEmailAddresstHomeDirectorytadPathtLocaleIDtphysicalDeliveryOfficeNametUpdateFlagr$_"}else{print}' ~/Desktop/AD_Account_Info.txt" 
 
--Convert from Mac to Windows line breaks
do shell script "perl -i -pe 's/015/015012/g' ~/Desktop/AD_Account_Info.txt"
   ]
 
#Add Date & Time Stamp to file name
Set Variable [ $DateTimeStamp; <calculation redacted 'cause it's gnarly> ]
 
Perform AppleScript
   [ Calculated AppleScript:
"do shell script "mv ~/Desktop/AD_Account_Info.txt ~/Desktop/AD_Account_Info_" & $DateTimeStamp & ".txt""
   ]
 
Regards,
Darrin
Link to comment
Share on other sites

There is no matching equivalent (as in "Perform Windows Script" in the Windows version.  The closest you can get (without a plugin) is the Send Event script step.  Send Event can open any document or run any application.  

 

Simple commands can be sent directly to the command line interpreter like this:

cmd /c <do something here> && <do something else here> && <and one more command>

 

More complex stuff requires you to generate a batch file, VBscript or PowerShell file (can be exported from FM, they are just text files with the proper extension), and then called through Send Event.  Since you can generate those files from inside FM they are completely dynamic based on your data.


Obviously, if the OS script is fairly static you can also just write the script, save it in the FMS scripts folder and use a "Script Sequence" schedule that consist of two parts:

- runs your FM script that does the export

- runs the OS script that converts the line endings

Link to comment
Share on other sites

This topic is 2928 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
 Share

×
×
  • Create New...

Important Information

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