Hi List,
I use Spss 15.0 and I need a command or a macro or a sctipt to automate via sintax to export the ouput. I actualy use mouse and windows to do: - export>text>path>all the objects - export>excel>path>only visible objects How can I do this using a sintax instruction or something similar? TIA Arnaldo ===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD |
The OUTPUT EXPORT command, which would
do what you want, was introduced in V17. In V15 you would have to
write a SaxBasic script for this and run it with the SCRIPT command.
Jon Peck (no "h") aka Kim Senior Software Engineer, IBM [hidden email] new phone: 720-342-5621 From: Arnaldo Ferrari Nasi <[hidden email]> To: [hidden email] Date: 12/12/2011 08:32 AM Subject: [SPSSX-L] automate export via sintax - spss 15.0 Sent by: "SPSSX(r) Discussion" <[hidden email]> Hi List, I use Spss 15.0 and I need a command or a macro or a sctipt to automate via sintax to export the ouput. I actualy use mouse and windows to do: - export>text>path>all the objects - export>excel>path>only visible objects How can I do this using a sintax instruction or something similar? TIA Arnaldo ===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD |
Yes, I know the OUTPUT EXPORT command in V17, but I am not able to
write the SaxBasic script I need for the V15. Can anyone help me? Arnaldo. >The OUTPUT EXPORT command, which would do what you want, was >introduced in V17. In V15 you would have to write a SaxBasic script >for this and run it with the SCRIPT command. > >Jon Peck (no "h") aka Kim >Senior Software Engineer, IBM >[hidden email] >new phone: 720-342-5621 > > > > >From: Arnaldo Ferrari Nasi <[hidden email]> >To: [hidden email] >Date: 12/12/2011 08:32 AM >Subject: [SPSSX-L] automate export via sintax - spss 15.0 >Sent by: "SPSSX(r) Discussion" <[hidden email]> > > > > >Hi List, > >I use Spss 15.0 and I need a command or a macro or a sctipt to >automate via sintax to export the ouput. > >I actualy use mouse and windows to do: >- export>text>path>all the objects >- export>excel>path>only visible objects > >How can I do this using a sintax instruction or something similar? > >TIA >Arnaldo > >===================== >To manage your subscription to SPSSX-L, send a message to >[hidden email] (not to SPSSX-L), with no body text except the >command. To leave the list, send the command >SIGNOFF SPSSX-L >For a list of commands to manage subscriptions, send the command >INFO REFCARD > ===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD |
Depending on the output format required
and whether there was any Viewer editing, you might be able to use OMS
to capture what you need.
Jon Peck (no "h") aka Kim Senior Software Engineer, IBM [hidden email] new phone: 720-342-5621 From: Arnaldo Ferrari Nasi <[hidden email]> To: Jon K Peck/Chicago/IBM@IBMUS Cc: [hidden email] Date: 12/12/2011 09:11 AM Subject: Re: [SPSSX-L] automate export via syntax - spss 15.0 Yes, I know the OUTPUT EXPORT command in V17, but I am not able to write the SaxBasic script I need for the V15. Can anyone help me? Arnaldo. >The OUTPUT EXPORT command, which would do what you want, was >introduced in V17. In V15 you would have to write a SaxBasic script >for this and run it with the SCRIPT command. > >Jon Peck (no "h") aka Kim >Senior Software Engineer, IBM >[hidden email] >new phone: 720-342-5621 > > > > >From: Arnaldo Ferrari Nasi <[hidden email]> >To: [hidden email] >Date: 12/12/2011 08:32 AM >Subject: [SPSSX-L] automate export via sintax - spss 15.0 >Sent by: "SPSSX(r) Discussion" <[hidden email]> > > > > >Hi List, > >I use Spss 15.0 and I need a command or a macro or a sctipt to >automate via sintax to export the ouput. > >I actualy use mouse and windows to do: >- export>text>path>all the objects >- export>excel>path>only visible objects > >How can I do this using a sintax instruction or something similar? > >TIA >Arnaldo > >===================== >To manage your subscription to SPSSX-L, send a message to >[hidden email] (not to SPSSX-L), with no body text except the >command. To leave the list, send the command >SIGNOFF SPSSX-L >For a list of commands to manage subscriptions, send the command >INFO REFCARD > |
In reply to this post by Arnaldo Ferrari Nasi-3
Hi Arnaldo
Below tow scripts (untested) to export charts and tables. The script to export charts assume that you want to export to the directory c:\Temp\Charts and numbers the exported charts as Q_1.jpg, Q_2.jpg etc. The Script to export tables exports the tables into C:\Temp\Tables as word-tables and numbers them. Hope this helps, Christian 'Script to export Charts. Option explicit Sub Main Dim objOutputDoc As ISpssOutputDoc Dim objOutputItems As ISpssItems Dim objOutputItem As ISpssItem Dim objSPSSChart As ISpssChart Dim intItemNum As Integer Dim k As Integer Dim intItemCounter As Integer Dim intItemType As Integer Dim strChartDirSpez As String Set objOutputDoc = objSpssApp.OpenOutputDoc(strFile) objOutputDoc.Visible = False Set objOutputDoc = objSpssApp.GetDesignatedOutputDoc Set objOutputItems = objOutputDoc.Items intItemNum = objOutputItems.Count() strChartDirSpez = "C:\Temp\Charts" k = 0 ' Loop through all items in output For intItemCounter = 0 To intItemNum - 1 Set objOutputItem = objOutputItems.GetItem(intItemCounter) intItemType = objOutputItem.SPSSType() If intItemType = SPSSChart Then k = k + 1 Set objSPSSChart = objOutputItem.GetChartOleObject objSPSSChart.ExportChart (strChartDirSpez & "\Q_" & CStr(k) & ".jpg", "JPEG File") ' objSPSSChart.ExportChart (strChartDirSpez & "\Q_" & CStr(k) & ".wmf", "Windows Metafile") End If Next intItemCounter End Sub ' Script to export Tables. Option Explicit Sub Main Dim objOutputDoc As ISpssOutputDoc Dim objOutputItems As ISpssItems Dim objOutputItem As ISpssItem Dim intItemNum As Integer Dim intItemType As Integer Dim k As Integer Dim intItemCounter As Integer Dim strPath As String Dim strTableDir As String Set objOutputDoc = objSpssApp.GetDesignatedOutputDoc Set objOutputItems = objOutputDoc.Items intItemNum = objOutputItems.Count() strTableDir = "C:\Temp\Tables" k = 0 ' Loop through all items in output For intItemCounter = 0 To intItemNum - 1 Set objOutputItem = objOutputItems.GetItem(intItemCounter) intItemType = objOutputItem.SPSSType() 'If item is a pivot table, export as a Word file If intItemType = SPSSPivot Then k = k + 1 strPath = strTableDirName & "\Table" & k & ".doc" ' Debug.Print strPath objOutputItem.ExportWordDocument(strPath, True) End If Next intItemCounter End Sub ********************************** la volta statistics Christian Schmidhauser, Dr.phil.II Weinbergstrasse 108 CH-8006 Zürich Tel: +41 (043) 233 98 01 Fax: +41 (043) 233 98 02 email: mailto:[hidden email] Web: www.lavolta.ch On Mon, 12 Dec 2011 17:01:39 +0100 Arnaldo Ferrari Nasi <[hidden email]> wrote: > Yes, I know the OUTPUT EXPORT command in V17, but I am not able to > write the SaxBasic script I need for the V15. > Can anyone help me? > > Arnaldo. > >>The OUTPUT EXPORT command, which would do what you want, was >>introduced in V17. In V15 you would have to write a SaxBasic script >>for this and run it with the SCRIPT command. >> >>Jon Peck (no "h") aka Kim >>Senior Software Engineer, IBM >>[hidden email] >>new phone: 720-342-5621 >> >> >> >> >>From: Arnaldo Ferrari Nasi <[hidden email]> >>To: [hidden email] >>Date: 12/12/2011 08:32 AM >>Subject: [SPSSX-L] automate export via sintax - spss 15.0 >>Sent by: "SPSSX(r) Discussion" <[hidden email]> >> >> >> >> >>Hi List, >> >>I use Spss 15.0 and I need a command or a macro or a sctipt to >>automate via sintax to export the ouput. >> >>I actualy use mouse and windows to do: >>- export>text>path>all the objects >>- export>excel>path>only visible objects >> >>How can I do this using a sintax instruction or something similar? >> >>TIA >>Arnaldo >> >>===================== >>To manage your subscription to SPSSX-L, send a message to >>[hidden email] (not to SPSSX-L), with no body text except >>the >>command. To leave the list, send the command >>SIGNOFF SPSSX-L >>For a list of commands to manage subscriptions, send the command >>INFO REFCARD >> > > ===================== > To manage your subscription to SPSSX-L, send a message to > [hidden email] (not to SPSSX-L), with no body text except >the > command. To leave the list, send the command > SIGNOFF SPSSX-L >For a list of commands to manage subscriptions, send the command > INFO REFCARD ===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD |
Administrator
|
I doubt whether one *wants* each pivot table in a separate document!!!
Here are some very LEAN script for exporting ALL pivot tables into a single document, ALL Items, All VISIBLE items. --- Sub Main With objSpssApp.GetDesignatedOutputDoc With .Items For I=0 To .Count-1 If .GetItem(I).SPSSType=SPSSPivot Then .GetItem(I).Selected=True Next End With .ExportDocument SpssSelected , "C:\Temp\TableExport.doc" , SpssFormatDoc ,False End With End Sub ** ALL ITEMS** . Sub Main With objSpssApp.GetDesignatedOutputDoc With .Items For I=0 To .Count-1 .GetItem(I).Selected=True Next End With .ExportDocument SpssSelected , "C:\Temp\AllItemExport.doc" , SpssFormatDoc ,False End With End Sub ** VISIBLE ITEMS ** Sub Main With objSpssApp.GetDesignatedOutputDoc With .Items For I=0 To .Count-1 .GetItem(I).Selected=True Next End With .ExportDocument SpssVisible , "C:\Temp\VisibleItemExport.doc" , SpssFormatDoc ,False End With End Sub **OR** Sub Main With objSpssApp.GetDesignatedOutputDoc With .Items For I=0 To .Count-1 If .GetItem(I).Visible=True Then .GetItem(I).Selected=True Next End With .ExportDocument SpssSelected , "C:\Temp\AllItemExport.doc" , SpssFormatDoc ,False End With End Sub
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?" |
Administrator
|
One *MAY* wish to place a .ClearSelection at the top before With .Items (fixed the first one).
Also, note that scripts can be run from syntax using the SCRIPT command and parameters can be passed to them via ScriptParameter. The following untested should work. Leaving it to OP to delve into the SCRIPT command to see SYNTAX for calling this. Sub Main With objSpssApp.GetDesignatedOutputDoc .ClearSelection With .Items For I=0 To .Count-1 If .GetItem(I).Visible=True Then .GetItem(I).Selected=True Next End With .ExportDocument SpssSelected , objSpssApp.ScriptParameter (0), SpssFormatDoc ,False End With End Sub Sub Main With objSpssApp.GetDesignatedOutputDoc .ClearSelection With .Items For I=0 To .Count-1 If .GetItem(I).SPSSType=SPSSPivot Then .GetItem(I).Selected=True Next End With .ExportDocument SpssSelected , "C:\Temp\TableExport.doc" , SpssFormatDoc ,False End With End Sub
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?" |
Free forum by Nabble | Edit this page |