0

I am in receipt of a number of JMP data table files (SAS related). I need to loop through a folder containing these files, open the file (via the file's native JMP application), and SAVE the file AS a SAS data set datatype. These JMP files can NOT be opened in SAS, hence the reason for having to open them in JMP software, then SAVEAS. There may be over a hundred of these JMP files, so I would like to automate the process. Here's the code I have so far:

Dim objShell
Set objShell = WScript.CreateObject( "WScript.Shell" )
objShell.Run("Jmp.exe C:\SourceFolder\test.jmp")
'
wscript.sleep 8000
objShell.SendKeys "%{F}{A}"  '<-- FAILURE #1
wscript.sleep 8000
objShell.SendKeys "C:\DestinationFolder\test.sas7bdat{ENTER}"  '<FAILURE #2
wscript.sleep 8000
objShell.SendKeys "%{F}{X}"
'
Set objShell = Nothing

The application opens, but the SENDKEYS function does not open the SAVEAS popup. It only gets to FILE menu (this menu does drop down, but the "A" does not fire).

In addition, I will need to change the "save as type" file type option in the SAVEAS dialog as the file type defaults to ".jmp". This needs to be changed to ".sas7bdat". Simply saving the file with a new extension DOES NOT WORK.

NOTE: The JMP application I am using is a 30-day trial application. Not sure if that matters - however, I have tested opening/saving the file manually and it does indeed work.

1201ProgramAlarm
  • 32,384
  • 7
  • 42
  • 56
Craig
  • 145
  • 1
  • 12
  • These are sas7bdat files? Do you have access to SAS? – Reeza Dec 05 '17 at 01:52
  • No. These are JMP files (.jmp file extension). I need to convert them to .sas7bdat. So, I need to open them in JMP software then "save as" .sas7bdat file type. – Craig Dec 05 '17 at 03:29
  • If you have SAS it can read them directly and/or do the conversion for you much easier. JMP also supports JSL so I would think programming this in that language would also be relatively easy... – Reeza Dec 05 '17 at 03:41
  • No. The reason I'm using JMP software is because SAS does NOT read them, otherwise I would use it. These JMP files are several years old. I need to focus on the task above - I need help with the VBscript. – Craig Dec 05 '17 at 03:57
  • If you have a SAS license SAS tech support may help with the conversion. Not sure what the rules are but I know they've done it historically. I am removing the SAS tag because it's not relevant here and adding the VBScript tag so you hopefully get better responses. – Reeza Dec 05 '17 at 04:09
  • Try introducing a small delay (`WScript.Sleep(200)` or so) before sending the next character. If the character combinations work when pressed manually, they are going to work when used with `SendKeys()` as well. – Tomalak Dec 05 '17 at 04:28
  • `objShell.SendKeys "A"` doesn't work - it just hangs on the "F" (file menu). Also, the second part of what I'm asking for is equally important (saving file as .sas7bdat extension). – Craig Dec 05 '17 at 05:18

0 Answers0