Hi, Is it possible to specify commandline args for an sbs
script (similar to argv in other languages)? I was hoping I could do SCRIPT "spo2xls.sbs" "someOutput.spo". or even: SCRIPT
"spo2xls.sbs" "\\location\to\be\searched\recursively". I am looking for a SaxBasic script to *batch* convert existing .spo files to a more modern format. I am aware of the menu-based sbs/wwd that exports each pivot table to a separate xls sheet (written by Jon Peck). I also checked spsstools.net, but that code was complaining about ActiveX. I started writing something myself already (my very first, and hopefully also last, sbs script!), but I 'd prefer something tried and true. Regards, Albert-Jan ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ All right, but apart from the sanitation, the medicine, education, wine, public order, irrigation, roads, a fresh water system, and public health, what have the Romans ever done for us? ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
Administrator
|
Very Close my friend.
SCRIPT "spo2xls.sbs" ("someOutput.spo"). Within the script use: MySyntaxInvokedScriptParam = objSpssApp.ScriptParameter(0) Originally the SPSS -> SAX connection lacked this. Of course, It was fundamental to my assignments so I got them to add it in short order (I believe around ver 7.5). You'd be surprised at the features which were added because I bitched loudly enough back in the day CASESTOVARS, VARSTOCASES, Macro Bug fixes, Extended statistical compute functions etc)!
Please reply to the list and not to my personal email.
Those desiring my consulting or training services please feel free to email me. --- "Nolite dare sanctum canibus neque mittatis margaritas vestras ante porcos ne forte conculcent eas pedibus suis." Cum es damnatorum possederunt porcos iens ut salire off sanguinum cliff in abyssum?" |
In reply to this post by Albert-Jan Roskam
Yes, Basic scripts can take a parameter
string:
ScriptParameter Method Passes a string parameter from a command file (syntax file) to a script. First, use the SCRIPT command syntax to run the script and pass the parameter: SCRIPT ‘filename’ [(quoted string)] where filename is the name of the script to run and quoted string is the parameter to pass to that script. Next, use the passed parameter in the script with the ScriptParameter method. strScriptParam = objSpssApp.ScriptParameter(0) Note that when a script run with the SCRIPT command contains syntax commands, those commands must be run asynchronously, so that your application regains control immediately and the user can continue working without waiting for the procedure to finish. For example, if your script contains syntax: strSyntax="FREQUENCIES VARIABLES=ALL." Set the bSync parameter of the ExecuteCommands method to False to run them asynchronously: objSpssApp.ExecuteCommands strSyntax, False Jon Peck (no "h") aka Kim Senior Software Engineer, IBM [hidden email] phone: 720-342-5621 From: Albert-Jan Roskam <[hidden email]> To: [hidden email], Date: 03/16/2013 11:19 PM Subject: [SPSSX-L] basic sax basic question Sent by: "SPSSX(r) Discussion" <[hidden email]> Hi, Is it possible to specify commandline args for an sbs script (similar to argv in other languages)? I was hoping I could do SCRIPT "spo2xls.sbs" "someOutput.spo". or even: SCRIPT "spo2xls.sbs" "\\location\to\be\searched\recursively". I am looking for a SaxBasic script to *batch* convert existing .spo files to a more modern format. I am aware of the menu-based sbs/wwd that exports each pivot table to a separate xls sheet (written by Jon Peck). I also checked spsstools.net, but that code was complaining about ActiveX. I started writing something myself already (my very first, and hopefully also last, sbs script!), but I 'd prefer something tried and true. Regards, Albert-Jan ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ All right, but apart from the sanitation, the medicine, education, wine, public order, irrigation, roads, a fresh water system, and public health, what have the Romans ever done for us? ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
Hi Jon, David,
Thank you for your replies! Can't wait to try this. My script does not contain embedded syntax, so I don have to worry about synchronization. I am planning to use Python to generate a syntax that contains a SCRIPT command for each spo file in a given directory. Each spo file is converted into a multisheet xls file with pivot tables, graphs and igraphs on separate sheets. I absolutely don't like creating all these xls files (ugh!), but the LegacyViewer requires admin rights under Win 7 in order for graphs to be displayed. Can spss 14 still be used to view spo files even after the license has expired? I always assumed it would, but I really prefer getting rid of that version altogether. Regards, Albert-Jan ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ All right, but apart from the sanitation, the medicine, education, wine, public order, irrigation, roads, a fresh water system, and public health, what have the Romans ever done for us? ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
Free forum by Nabble | Edit this page |