# Message box after download

**URL:** <https://forum.inductiveautomation.com/t/message-box-after-download/64469>\
**Category:** Ignition\
**Tags:** vision\
**Created:** [September 26, 2022, 9:57am UTC](https://forum.inductiveautomation.com/t/message-box-after-download/64469 "2022-09-26T09:57:57Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dharani\_T](https://avatars.discourse-cdn.com/v4/letter/d/bc8723/32.png) [@Dharani\_T](https://forum.inductiveautomation.com/u/Dharani_T)\
**Post date:** [September 26, 2022, 9:57am UTC](https://forum.inductiveautomation.com/t/message-box-after-download/64469/1 "2022-09-26T09:57:57Z")

</div>

Hi,

I would like to have a message box once the csv file has been downloaded.

```auto
Table= event.source.parent.getComponent('Table')
csv = system.dataset.toCSV(Table.data)
filePath = system.file.saveFile("LossTime.csv", "csv", "Comma Separated Values")
if filePath:
    system.file.writeFile(filePath, csv)
    
system.gui.messageBox("File Downloaded Successfully", "Loss Time export")

```

But unfortunately i am getting this message even when i close the file path popup.  
How to check whether the file is downloaded so that successful message can be displayed.

Thanks in advance

---

<div class="post-metadata">

**Author:** ![Matrix\_Engineering](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/matrix_engineering/32/19781_2.png) [@Matrix\_Engineering](https://forum.inductiveautomation.com/u/Matrix_Engineering)\
**Post date:** [September 26, 2022, 11:19am UTC](https://forum.inductiveautomation.com/t/message-box-after-download/64469/2 "2022-09-26T11:19:40Z")

</div>

Try this:

```auto
Table= event.source.parent.getComponent('Table')
csv = system.dataset.toCSV(Table.data)
filePath = system.file.saveFile("LossTime.csv", "csv", "Comma Separated Values")
if filePath != -1:
    system.file.writeFile(filePath, csv)
    system.gui.messageBox("File Downloaded Successfully", "Loss Time export")
    

```

---

<div class="post-metadata">

**Author:** ![Dharani\_T](https://avatars.discourse-cdn.com/v4/letter/d/bc8723/32.png) [@Dharani\_T](https://forum.inductiveautomation.com/u/Dharani_T)\
**Post date:** [September 26, 2022, 11:33am UTC](https://forum.inductiveautomation.com/t/message-box-after-download/64469/3 "2022-09-26T11:33:21Z")

</div>

Hi,  
I am getting the below error when i close the filepath window,

---

<div class="post-metadata">

**Author:** ![Matrix\_Engineering](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/matrix_engineering/32/19781_2.png) [@Matrix\_Engineering](https://forum.inductiveautomation.com/u/Matrix_Engineering)\
**Post date:** [September 26, 2022, 11:40am UTC](https://forum.inductiveautomation.com/t/message-box-after-download/64469/4 "2022-09-26T11:40:54Z")

</div>

Hmm ok, that code used to be fine in 7.9, try removing the -1 then:

```auto
Table= event.source.parent.getComponent('Table')
csv = system.dataset.toCSV(Table.data)
filePath = system.file.saveFile("LossTime.csv", "csv", "Comma Separated Values")
if filePath:
    system.file.writeFile(filePath, csv)
    system.gui.messageBox("File Downloaded Successfully", "Loss Time export")

```

---

<div class="post-metadata">

**Author:** ![Dharani\_T](https://avatars.discourse-cdn.com/v4/letter/d/bc8723/32.png) [@Dharani\_T](https://forum.inductiveautomation.com/u/Dharani_T)\
**Post date:** [September 26, 2022, 12:04pm UTC](https://forum.inductiveautomation.com/t/message-box-after-download/64469/5 "2022-09-26T12:04:21Z")

</div>

Hey thanks. It works
