DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I automate the file path to export to

Solved!
Go to solution

Hello,

 

I am trying to export to pdf without dialog but want the pdf to go to a file path that exists in the file properties of the TDMS data set that is loaded. I have also wrote it as a channel as well. I cannot get this to work.

 

 

 

' create PDF

Dim

PDFFile : PDFFile = ch([1]/SI PDF Path)

PrintLeftMarg

= 0.23

PrintTopMarg

  = 0.23

PrintWidth

    = 8

PrintOrient

   = "portrait"

On

ErrorResumeNext

Call

PicPDFExport(PDFFile)

If

(Err.Number <> 0) Then

 

CallMsgBoxDisp("Cannot create the PDF document.")

else

 

' show results in PDF reader

 

IfFileExist(PDFFile) ThenCallExtProgram("", PDFFile)

 

IfErr.Number <> 0ThenMsgBox"Cannot start the PDF Reader. Have you installed a PDF Reader on your computer."

End

If

Err

.Clear

On

ErrorGoto0

0 Kudos
Message 1 of 8
(4,703 Views)

You can find the path with the following property

Data.Root.ChannelGroups(1).Channels(1).Properties("sourcedatafilepath").Value

 

To get this line you can drag&drop the property from the DataPortal into the workspace of SCRIPT.

 

I hope this helps

 

Winfried

 

0 Kudos
Message 2 of 8
(4,701 Views)

I have tried dragging from the properties which gives me

 

Data.Root.Properties("SI_PDF_Path").Value

 

And dragging the channel gives me

 

 

Data.Root.ChannelGroups(1).Channels("SI PDF Path")

 

 

Both do not work for me.

0 Kudos
Message 3 of 8
(4,699 Views)

The following line does not contain any channelname and works if you have at least one channel. It returns the path of the first channel in the first group:

 

Data.Root.ChannelGroups(1).Channels(1).Properties("sourcedatafilepath").Value

 

Winfried

0 Kudos
Message 4 of 8
(4,694 Views)

Thanks for helping me.

 

I am sorry if i am not understanding this but I know the path to my data channel ([1]/ SI PDF Path). I want to get this channels value (which is a string- C:\Data\Name of file) and set it equal to PDFFile in the above script.

 

If I use PDFFile= ch("[1]/SI PDF Path") - my result path is the numeric data index of the group and not the string value. I suppose because I got this from the calculator. But it is the only thing that remotely works for me.

0 Kudos
Message 5 of 8
(4,692 Views)

I am still not sure if I understand you. You store the filepath in the first value of the channel "[1]/ SI PDF Path"

To get this value use:

Data.Root.ChannelGroups(1).Channels("SI PDF Path").Values(1)

But why do you store the path as channel value? There are default properties that contains the path.

 

Hope this helps

Winfried




0 Kudos
Message 6 of 8
(4,689 Views)

I am storing the filepath that i want the pdf to be exported to. I have wrote this path as both a channel (called SI PDF Path) and a file property. The channel has one value - the path to export the pdf document to.

0 Kudos
Message 7 of 8
(4,686 Views)
Solution
Accepted by topic author Chris_Co

I finally figured it out.

The script should look like:

 

Dim PDFFile

PDFFile = Data.Root.Properties("SAE_PDF_Path").Value

 

The colon was screwing it up and moving it to the second line.

0 Kudos
Message 8 of 8
(4,681 Views)