Jump to content

How to do this on Windows?


glenhest53
 Share

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

Recommended Posts

Hi:

I am not that familiar with automation tools on Windows.

So here is a brief explanation of how I automate this task on the MacIntosh.

I read the contents of a folder of PDF files and then write the returned string to a text file. That file is then imported into filemaker.

Here is the Applescript/Shell Command that reads the file.

set theFolderList to do shell script "ls '/Volumes/main/Business/ADD/Export/'".

How would I achieve the same on the Windows side.

Thanks in advance

Link to comment
Share on other sites

2 different methods you can use: a command line or a VBscript. A VBscript requires more code but has also more power. I've included a script below. There are however a couple of hoops you have to jump through to use the VBscript approach.

Let's stick with the command line approach:

cmd /c dir /b c:theFolder >c:outputfile.txt

You use the Send Event script step to execute this.

Anatomy:

"cmd /c" calls the Windows command line interperter and tells it to quit when done with the command ("/c")

"dir /b" tells Windows to produce a list of files, but just the names no other info ("/b")

">c:outputfile.text" tells Windows not to show the list on the screen but to redirect the output to a text file

-------------------------------------------

Set sh = CreateObject ("Shell.Application")

Set oFolder = sh.Namespace ("d:downloads")

Set fso = CreateObject("Scripting.FileSystemObject")

For Each filename In oFolder.Items

filenamesstring = filenamesstring & "," & filename

Next

Set oFile = fso.CreateTextFile("c:testfile.txt", True)

oFile.WriteLine(filenamesstring)

oFile.Close

Link to comment
Share on other sites

  • 2 weeks later...

This topic is 5708 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.