Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Tcl/Tk script-start by double click instead of calling from CLI

Status
Not open for further replies.

gjorgi

Programmer
Apr 4, 2005
12
US
Hi,
I have a simple Tcl/Tk script which I would like to start by double clicking it instead of calling it from the command line. How to get my script started that way?
 
Tried with chmod +x, but a dialog pops up and asks me how to run this script: in terminal, display or run. What I would like is to go straight to execution, without any dialog boxes. How to go about?
 
To tell it how to run the script the first line needs to be #! followed by the path to the interpreter. If you're using Linux you can use /usr/bin/wish for a tcl/tk gui. Like this:
Code:
#!/usr/bin/wish
code ...
 
That is exactly how my script starts, with the shebang line, but I still get the dialog box.
 
But I need the window. When I substitute wish for tclsh in the shebang line, I get error message (only when I run the script in console):
invalid command name "button"
while executing
"button .someButton -text etc -command {some-tcl-command}"
I need the window, the buttons, etc. And I made the windowed script executable with chmod +x. But I don't need the "Run or Display?" dialog box, is there any way around it?
 
Ok, got it. It doesn't have to do anything with tclsh vs. wish or making executable, linking, wrapping in C executable, changing MIME types etc.
I selected the file in the file browser and then selected "Edit" -> Preferences -> Behavior -> to the section "executable text files" where the radio button "Run when they are clicked" needs to be checked and that's about it...
Thanks to all that tried to help
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top