Jump to content

Deafult folder for multiple files selection


---
 Share

Recommended Posts

Good Morning,

I tried to use this code to change dinamically the default folder for selecting files into a specific folder, but it dpoesn't work. Where it is wrong?

codice=(gom.app.project.project_name).split("_")[0]
print (codice)
control_dir=str('S:\\QUAREP\\Controlli\\'+codice+'\\')
print (control_dir)

DIALOG=gom.script.sys.create_user_defined_dialog (content='<dialog>' \
' <title>Scegli i files</title>' \
' <style></style>' \
' <control id="OkCancel"/>' \
' <position>center</position>' \
' <embedding>always_toplevel</embedding>' \
' <sizemode></sizemode>' \
' <size height="218" width="294"/>' \
' <content columns="1" rows="2">' \
'  <widget row="0" columnspan="1" type="display::text" column="0" rowspan="1">' \
'   <name>text</name>' \
'   <tooltip></tooltip>' \
'   <text>&lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">' \
'&lt;html>&lt;head>&lt;meta name="qrichtext" content="1" />&lt;style type="text/css">' \
'p, li { white-space: pre-wrap; }' \
'&lt;/style>&lt;/head>&lt;body style="    ">' \
'&lt;p align="center" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">&lt;span style=" font-size:16pt;">Scegli i files da controllare&lt;/span>&lt;/p>&lt;/body>&lt;/html></text>' \
'   <wordwrap>false</wordwrap>' \
'  </widget>' \
'  <widget row="1" columnspan="1" type="input::file" column="0" rowspan="1">' \
'   <name>folder</name>' \
'   <tooltip></tooltip>' \
'   <type>multi_file</type>' \
'   <title>Choose File</title>' \
'   <default></default>' \
'   <limited>false</limited>' \
'   <file_types/>' \
'   <file_types_default></file_types_default>' \
'  </widget>' \
' </content>' \
'</dialog>')


DIALOG.folder.default = control_dir

RESULT=gom.script.sys.show_user_defined_dialog (dialog=DIALOG)

Thank you in advance!

Link to comment
Share on other sites

I found the solution: I have to go 1 step deeper in the folder, in a subdirectory of my code. So the variable control_dir must be ("S:\\QUAREP\\Controlli\\"+codice+"\\00_BF\\").

Link to comment
Share on other sites

 Share

×
×
  • Create New...