Closed andrewheiss closed 8 years ago
I'm not familiar with Python or AppleScript myself, but for anyone interested in investigating a fix for this issue, I have not to date run into such a character limit using R-Box to send R commands to the console. Might serve as some kind of inspiration for finding a fix for this.
I also ran into this error, because I need to run a few bigger files. This is what I found: "The length of the stataCommand needs to be less than 8192. If it is not, an INVALID_PARAMETER error will be generated." (Source: http://www.stata.com/automation/#list)
Maybe there should be an option in the plugin to send a whole do-file instead? I could look into that, if there's interest.
Building the file with super+b
sends the whole do file to Stata
The build command didn't work for me, because my finder is set to open do files in Sublime... So that didn't really do anything. I changed my build commands to run the do file from within Stata. That works for me, but maybe has other disadvantages? You can see the changes in the pull request.
Also in the pull request is a change to the run command. When the user attempts to run a command with more than 8191 characters, a dialog box pops open to ask if the whole file should be run instead. If yes, then the same method as described above is used.
The plugin cannot send a selection of text containing more than 8192 characters, but I can't figure out if this is because of a limitation in AppleScript or in Stata's AppleScript library.
The plugin will still create valid AppleScript commands for selections longer than 8192 characters, since the command is generated with with lines 69-78 in
text_2_stata.py
(you can see the resulting command in ST's console). However, longer commands do not get sent to Stata.This happens either because there's a size limit for strings in AppleScript, or Stata's
DoCommandAsync
command only accepts strings of a certain size. I don't know which one.Here's a file for testing (displays a number sequentially until the last line, which has a bunch of 0s to force the file to be 8192 characters):