English Amiga Board


Go Back   English Amiga Board > Support > support.Apps

 
 
Thread Tools
Old 22 April 2018, 09:36   #1
Foebane
Banned
 
Join Date: Sep 2011
Location: Cardiff, UK
Age: 51
Posts: 2,871
Icon for script on main Workbench window?

I have been trying to take a script I wrote and stored in System:S and put it onto the main Workbench screen as an icon, so I can quickly and easily run it without having to open the relevant windows, "Execute Command" or DOpus.

How can I create an icon for a script, or indeed any file? It's been decades since I did it, and I've forgotten.
Foebane is offline  
Old 22 April 2018, 10:01   #2
Leffmann
 
Join Date: Jul 2008
Location: Sweden
Posts: 2,269
One way is to use IconEdit in Tools, save an icon of type "Project", and set its default tool to "C:IconX"
Leffmann is offline  
Old 22 April 2018, 10:15   #3
Foebane
Banned
 
Join Date: Sep 2011
Location: Cardiff, UK
Age: 51
Posts: 2,871
Thank you, it worked great.
Foebane is offline  
Old 22 April 2018, 10:42   #4
AMIGASYSTEM
Registered User
 
AMIGASYSTEM's Avatar
 
Join Date: Aug 2014
Location: Brindisi (Italy)
Age: 70
Posts: 8,248
You can also run a script as if it were an executable, to do this, just add the flag S (Script) to the file. From Workbench you can run this script by adding a "Tool" type icon
AMIGASYSTEM is offline  
Old 22 April 2018, 12:12   #5
daxb
Registered User
 
Join Date: Oct 2009
Location: Germany
Posts: 3,303
DOpus has an AddIcon funktion. Select your file and hit AddIcon button. Or copy an icon you like and rename it to the script name. You can also add a hotkey for the script start. Then no icon is needed.
daxb is offline  
Old 25 April 2018, 14:16   #6
kolla
Banned
 
Join Date: Nov 2007
Location: Trondheim, Norway
Posts: 1,893
Quote:
Originally Posted by AMIGASYSTEM View Post
You can also run a script as if it were an executable, to do this, just add the flag S (Script) to the file. From Workbench you can run this script by adding a "Tool" type icon
There's more to it. The regular WBInfo does not allow you to change icon type, but I presume you use RWBInfo which does.
You can also use ProcessIcon (http://aminet.net/package/util/wb/ProcessIcon)
Code:
ProcessIcon MyScript SIT Tool
The tooltype CLI must also be set (which is equivalent to "start from Shell" in WB45 WBInfo and RWBInfo) and most preferably also tooltype "DONOTPROMPT" (equivalent to "do not ask for input" in V45 WBInfo and RWBInfo).
kolla is offline  
Old 25 April 2018, 14:24   #7
kolla
Banned
 
Join Date: Nov 2007
Location: Trondheim, Norway
Posts: 1,893
Quote:
Originally Posted by daxb View Post
DOpus has an AddIcon funktion. Select your file and hit AddIcon button. Or copy an icon you like and rename it to the script name. You can also add a hotkey for the script start. Then no icon is needed.
Yeah, with Workbench, IIRC, an icon will be created once you stuff tooltypes etc into wbinfo window and hit "save". And you can of course use the OS commodity FKey to add hotkeys for launching scripts, instead of having icons on the Workbench.
kolla is offline  
Old 25 April 2018, 22:57   #8
malko
Ex nihilo nihil
 
malko's Avatar
 
Join Date: Oct 2017
Location: CH
Posts: 4,856
WB 1.3 is not really user-friendly when dealing with icon type.
If you want to change the type of an Icon to "Project" :
1- Load IconEdit
2- (slot 1) Open an already existing icon having the type "Project"
3- In a new slot (let's say slot 2), open the icon you want to change the type
4- Copy the icon opened in point 3- (slot 2) over the icon opened in point 2- (slot 1)
5- Save the icon (slot 1)
The icon has now the type "Project"
malko is offline  
Old 25 April 2018, 23:45   #9
AMIGASYSTEM
Registered User
 
AMIGASYSTEM's Avatar
 
Join Date: Aug 2014
Location: Brindisi (Italy)
Age: 70
Posts: 8,248
Quote:
Originally Posted by kolla View Post
There's more to it. The regular WBInfo does not allow you to change icon type, but I presume you use RWBInfo which does..
Yes use RWBInfo (indispensable utility), in any case, you can change icon status with IconEdit or better with IconType

Quote:
Originally Posted by kolla View Post
The tooltype CLI must also be set (which is equivalent to "start from Shell" in WB45 WBInfo and RWBInfo) and most preferably also tooltype "DONOTPROMPT").
From the Shell the icon is not needed, the file script (S) runs as a normal executable

[ Show youtube player ]

Last edited by AMIGASYSTEM; 11 May 2018 at 01:37.
AMIGASYSTEM is offline  
Old 26 April 2018, 00:19   #10
AMIGASYSTEM
Registered User
 
AMIGASYSTEM's Avatar
 
Join Date: Aug 2014
Location: Brindisi (Italy)
Age: 70
Posts: 8,248
Quote:
Originally Posted by malko View Post
WB 1.3 is not really user-friendly when dealing with icon type.
With WB 1.3 you can also use the utility (from Shell) SetIcontype
AMIGASYSTEM is offline  
Old 26 April 2018, 07:00   #11
Foebane
Banned
 
Join Date: Sep 2011
Location: Cardiff, UK
Age: 51
Posts: 2,871
Thanks, all. Getting the script to run from an icon has been solved. I used IconEdit and dragging the script to it and setting the icon type, but haven't tried the DOpus Add Icon button yet.
Foebane is offline  
Old 26 April 2018, 08:05   #12
malko
Ex nihilo nihil
 
malko's Avatar
 
Join Date: Oct 2017
Location: CH
Posts: 4,856
Quote:
Originally Posted by AMIGASYSTEM View Post
With WB 1.3 you can also use the utility (from Shell) SetIcontype
Humm, good to know Will give it a try.
malko is offline  
Old 26 April 2018, 11:07   #13
kolla
Banned
 
Join Date: Nov 2007
Location: Trondheim, Norway
Posts: 1,893
Quote:
Originally Posted by AMIGASYSTEM View Post
From the Shell the icon is not needed, the file script (S) runs as a normal executable
No, that is not correct. The S flag tells the shell that it shall launch the file using the Execute command, not as a normal executable. In fact, the E (execute) flag should not even be set on such scripts.

With shell v45 from ThoR you can even "launch" other types of files the same way, as it supports datatypes. You just set the variable "VIEWER" to Multiview, and then you can just type "HELP:english/sys/amigaguide.guide" and it will open that file in Multiview. For this to work, the specified file must specifically _not_ have the E (executable) flag set.

Last edited by kolla; 26 April 2018 at 11:22.
kolla is offline  
Old 26 April 2018, 11:27   #14
AMIGASYSTEM
Registered User
 
AMIGASYSTEM's Avatar
 
Join Date: Aug 2014
Location: Brindisi (Italy)
Age: 70
Posts: 8,248
Quote:
Originally Posted by kolla View Post
No, that is not correct. The S flag tells the shell that it shall launch the file using the Execute command, not as a normal executable. In fact, the E (execute) flag should not even be set on such scripts.
No, just execute is in C, and then the script can be executed directly as an executable, see my video attached

Last edited by AMIGASYSTEM; 06 June 2018 at 16:15.
AMIGASYSTEM is offline  
Old 26 April 2018, 13:31   #15
kolla
Banned
 
Join Date: Nov 2007
Location: Trondheim, Norway
Posts: 1,893
You have a very simplified view of how this works
You should think of the S flag as a way to tell the shell that "Execute" is the default tool for a file - that is all.

Likewise - if you remove the E flag, and have no S flag, it tells the shell to attempt opening the file with the program specified with the $VIEWER variable, if that variable is present.

Likewise - if you set the H flag, and the P flag is present, it tells the shell to also make the program resident when running it.

Last edited by kolla; 26 April 2018 at 13:39.
kolla is offline  
Old 26 April 2018, 13:36   #16
AMIGASYSTEM
Registered User
 
AMIGASYSTEM's Avatar
 
Join Date: Aug 2014
Location: Brindisi (Italy)
Age: 70
Posts: 8,248
Normal that I need to give something to start (Windows does the same thing with the .bat files), even a normal executable needs a library, font or other to start.
AMIGASYSTEM is offline  
Old 27 April 2018, 00:53   #17
malko
Ex nihilo nihil
 
malko's Avatar
 
Join Date: Oct 2017
Location: CH
Posts: 4,856
From "The Best Amiga Tricks & Tips ©1989 Data Becker, GmbH & ©1990 Abacus" :
Code:
PROTECT FILE/A,FLAGS,ADD/S,SUB/S
	Determines the protection bits a file should have.
	FILE	The name of the file to protect.
	FLAGS	Sets the protection status.
		R	The file can be read.
		W	The file can be written to.
		D	The file is deletable.
		E	The file is executable.
		In V1.3 the Hidden (H), Script (S), Pure (P) and
		Archive (A) bits can be set or reset.
		H	Hidden file.
		S	The file can be started without execute
			(script files only).
		P	The file can be placed in the Resident list
		A	The file is archived.
		The H and A bits function only with Kickstart 1.3.
	+, ADD	Sets the status of the given Status bit.
	-. SUB	Removes the status of the status bit.
	
V2.0 ALL/S,QUITE/S
	ALL	Multiple files may now be protected.
	QUIET	No messages are displayed.
malko is offline  
Old 27 April 2018, 01:14   #18
AMIGASYSTEM
Registered User
 
AMIGASYSTEM's Avatar
 
Join Date: Aug 2014
Location: Brindisi (Italy)
Age: 70
Posts: 8,248
Quote:
Originally Posted by malko View Post
S The file can be started without execute
(script files only).
Yes because the command execute it automatically takes it from the system , if you try to rename the command execute script file does not work
AMIGASYSTEM is offline  
Old 27 April 2018, 11:57   #19
Daedalus
Registered User
 
Daedalus's Avatar
 
Join Date: Jun 2009
Location: Dublin, then Glasgow
Posts: 6,334
It also talks about the H bit meaning "hidden" and the A bit only working under 1.3, so it's probably not the best source of information.

I did think that the E bit should also be set when the S bit is set (as in, it's an executable script), but I can't find any reference to it being either required or forbidden for scripts. It simply seems to be irrelevant when the S bit is present.
Daedalus is offline  
Old 27 April 2018, 12:36   #20
AMIGASYSTEM
Registered User
 
AMIGASYSTEM's Avatar
 
Join Date: Aug 2014
Location: Brindisi (Italy)
Age: 70
Posts: 8,248
The bit "E" it is not necessary to run a script or Icon, The bit "E" it is instead necessary on the real executables otherwise they do not start.
AMIGASYSTEM is offline  
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Similar Threads
Thread Thread Starter Forum Replies Last Post
Icon Theming Script TuKo Coders. General 4 19 February 2017 16:24
WB 3.1 - Creating an icon that runs a script file DamienD support.Other 17 04 November 2016 02:06
How to make an Workbench Icon running a CLI Script ? Marskilla support.Other 9 26 April 2016 23:11
Execute script works but not after adding an icon with IconX as Default Tool. e5frog support.Other 19 27 July 2010 10:23
Can't open install script's icon THX1138 support.Apps 14 01 July 2005 22:42

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 02:55.

Top

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Page generated in 0.18368 seconds with 13 queries