Hi all
I develop a script with python and I link it with a wisual interface with Add/Script tool. all works without any problem
I have to share it as part of my work and for not to change the script I was wondering if there is a way to protect it like generating a tool as the Esri one (with the hammer icone)
Any help, Any Idea??
Thanks in advance
Once you have the script tool, you can get properties of it, click the source tab, and delete the file in the "Script File" box and click OK.
Then, if you don't want anyone to be able to get at the python of the script, right-click it in Catalog, and set password.
If you don't care about this, skip it.
Next, right-click it in Catalog, and "Import Script" (If you set a password, you will need to enter it before it allows you to browse for script). Browse to the script that "was" sourced to this tool, and import it.
Now the tool/script is in the toolbox with the python code embedded in it, and doesn't need the .py file anymore, Can now be copy/pasted into other toolbox's as desired. Also, this way it will allow you to add it to the UI Controls and actually put it as a tool on a toolbar.
R_
Thanks you very much guys. It was really helpful. I was able to embed my python code in the tool and protect it with a password.
I have two more small questions:
1- It is a way to make a tool in the same format as arcGIS tools (hammer Icon)
2- you mention Rhett that is is possible to add an arctoolbox (python script??) to a UI control. I try to do it (customize/commands/[UI Control]). unfortunatly, I did not see how to add my tool
Thanks a lot
Sorry, forgot they might not call it UI Controls anymore.
I'm still in 10.0, so not sure what it is called in later versions, but:
Right-click on a toolbar, go to the bottom and select Customize,
Click the "Commands:" tab
Scroll to the bottom of the Categories and select [ Geoprocessing Tools ]
Click the Add Tools... button
Browse to the toolbox and script tool that you created and select it.
It will now show up in the Commands: window
Drag it to a toolbar, then you can right-click on it, Change Button Image, and select the hammer (or whatever icon you want).
Keep in mind that if you make any changes to the script tool, you will need to remove it from the Geoprocessing tools list and the toolbar, re-import the changes to the tool, then re-add it to the Commands: window and the toolbar or the changes won't take effect.
R_
Thanks Guys