English Amiga Board


Go Back   English Amiga Board > Support > support.Apps

 
 
Thread Tools
Old 24 August 2020, 22:09   #1
Sim085
Registered User
 
Join Date: Apr 2009
Location: N/A
Posts: 754
IconX - read tool types from script?

Is it possible to read use tool types to pass arguments to a script run through IconX?
Sim085 is offline  
Old 24 August 2020, 22:59   #2
AMIGASYSTEM
Registered User
AMIGASYSTEM's Avatar
 
Join Date: Aug 2014
Location: Brindisi (Italy)
Posts: 6,278
You could make an example, excuse me but the translation did not make me understand what you asked for
AMIGASYSTEM is offline  
Old 24 August 2020, 23:51   #3
Sim085
Registered User
 
Join Date: Apr 2009
Location: N/A
Posts: 754
Yes sure. Imagine two files; Hello.info and Hello where Hello.info is the icon of type Project with Default Tool set to IconX and has a Tool Types entry MSG=Hello,World. From the Hello script I would like to print the value of MSG as set up in Tool Types. Is this possible? (similar to command line arguments to a program).


Quote:
Originally Posted by AMIGASYSTEM View Post
You could make an example, excuse me but the translation did not make me understand what you asked for
Sim085 is offline  
Old 25 August 2020, 00:07   #4
AMIGASYSTEM
Registered User
AMIGASYSTEM's Avatar
 
Join Date: Aug 2014
Location: Brindisi (Italy)
Posts: 6,278
IconX runs "Hello" through the "Execute" command and I don't know if this command supports this kind of message.

If you want to run the icon from a Shell instead you could use "WBRun" this command also supports the parameters included in the Tooltype
AMIGASYSTEM is offline  
Old 25 August 2020, 10:23   #5
meynaf
son of 68k
meynaf's Avatar
 
Join Date: Nov 2007
Location: Lyon / France
Age: 47
Posts: 3,984
Quote:
Originally Posted by AMIGASYSTEM View Post
IconX runs "Hello" through the "Execute" command and I don't know if this command supports this kind of message.
Sadly I don't think it does.


Quote:
Originally Posted by AMIGASYSTEM View Post
If you want to run the icon from a Shell instead you could use "WBRun" this command also supports the parameters included in the Tooltype
This is for running a WB program from CLI, but what the OP wants is the opposite : running a CLI program from WB.
meynaf is offline  
Old 25 August 2020, 11:05   #6
ppill
CON: artist
ppill's Avatar
 
Join Date: Feb 2006
Location: Poland
Age: 39
Posts: 1,224
Quote:
Originally Posted by Sim085 View Post
Is it possible to read use tool types to pass arguments to a script run through IconX?
You can pass filenames of selected icons. Select the icons and double click on the script holding down SHIFT.

That's pretty much it. Iconx has some tool types but nothing for arguments.

You can check out CliCon for more features.
ppill is offline  
Old 25 August 2020, 12:07   #7
daxb
Registered User
 
Join Date: Oct 2009
Location: Germany
Posts: 2,694
I think what you need is a tool (should exists if I remember right) that can read tooltypes from icon files. If the script is in ARexx you can use rexxtricks.library for example that can handle tooltypes.

Haven't tried but there could be a problem left. The icon file might be locked during execution and therefore no access to it. But try it.
daxb is offline  
Old 25 August 2020, 13:42   #8
paul1981
Registered User

paul1981's Avatar
 
Join Date: Oct 2013
Location: England
Posts: 263
http://m68k.aminet.net/package/util/cli/ViewT

I found that, haven't tried it myself however. I wonder if those old IconX type programs have it in, like IconJ and XIcon, and I think there's another but you never know, they may have what you want? Worth checking out.

Edit:
I've just tried the ViewT and it does work, it lists the tooltypes but it numbers the lines too starting from 1. , it puts the number followed by a fullstop followed by a space and then the tooltype. You could use a script to modify and get clean output if required or try and alter the program itself as the C source is included. It has a DEL option, don't use that as it erases the line number of the tooltype you enter so be careful!

Last edited by paul1981; 25 August 2020 at 14:09.
paul1981 is offline  
Old 25 August 2020, 14:04   #9
AMIGASYSTEM
Registered User
AMIGASYSTEM's Avatar
 
Join Date: Aug 2014
Location: Brindisi (Italy)
Posts: 6,278
Quote:
Originally Posted by meynaf View Post
Sadly I don't think it does.
but what the OP wants is the opposite : running a CLI program from WB.

But this can be done safely if you have an updated OS (3.5/3.9)

Last edited by AMIGASYSTEM; 02 October 2020 at 19:21.
AMIGASYSTEM is offline  
Old 25 August 2020, 14:40   #10
meynaf
son of 68k
meynaf's Avatar
 
Join Date: Nov 2007
Location: Lyon / France
Age: 47
Posts: 3,984
Quote:
Originally Posted by AMIGASYSTEM View Post
But this can be done safely if you have an updated OS (3.5/3.9)
You don't need an updated OS to just run a cli program from wb, even with arguments, but this is not the point. The point is to pass icon tooltypes to the cli program (in a way it can understand).
meynaf is offline  
Old 25 August 2020, 15:02   #11
PeterK
Registered User
 
Join Date: Apr 2005
Location: Hangover
Posts: 2,816
Icon.library offers the functions FindToolType() and MatchToolValue(), and with Arexx it should be possible to open any library of the system and use its functions, if I remember that correctly, but I'm not an Arexx user or expert.

Code:
   NAME
	FindToolType - find the value of a ToolType variable.

   SYNOPSIS
	value = FindToolType(toolTypeArray, typeName)
	  D0                      A0           A1

	STRPTR FindToolType(STRPTR *, STRPTR);

   FUNCTION
	This function searches a tool type array for a given entry,
	and returns a pointer to that entry.  This is useful for
	finding standard tool type variables.  The returned
	value is not a new copy of the string but is only
	a pointer to the part of the string after typeName.

   INPUTS
	toolTypeArray -- an array of strings (STRPTR *).
	typeName -- the name of the tooltype entry (STRPTR).

   RESULTS
	value -- a pointer to a string that is the value bound to typeName,
	        or NULL if typeName is not in the toolTypeArray.

   EXAMPLE
	Assume the tool type array has two strings in it:
	    "FILETYPE=text"
	    "TEMPDIR=:t"

	FindToolType( toolTypeArray, "FILETYPE" ) returns "text"
	FindToolType( toolTypeArray, "filetype" ) returns "text"
	FindToolType( toolTypeArray, "TEMPDIR" )  returns ":t"
	FindToolType( toolTypeArray, "MAXSIZE" )  returns NULL
	FindToolType( toolTypeArray, "text" )     returns NULL
	FindToolType( toolTypeArray, ":t" )       returns NULL

   NOTES
	icon.library V44 tolerates tool type strings with additional
	blanks around the '=' character, such as in "FILETYPE = text".
	Older icon.library versions did not support this.

   SEE ALSO
	icon.library/MatchToolValue



   NAME
	MatchToolValue - check a tool type variable for a particular value.

   SYNOPSIS
	result = MatchToolValue(typeString, value)
	  D0                        A0        A1

	BOOL MatchToolValue(STRPTR, STRPTR);

   FUNCTION
	MatchToolValue is useful for parsing a tool type value for
	a known value.  It knows how to parse the syntax for a tool
	type value (in particular, it knows that '|' separates
	alternate values).  Note that the parsing is case insensitive.

   INPUTS
	typeString -- a ToolType value (as returned by FindToolType)
	value -- you are interested if value appears in typeString

   RESULTS
	result -- TRUE if the value was in typeString else FALSE.

   EXAMPLE
	Assume there are two type strings:
	    type1 = "text"
	    type2 = "a|b|c"

	MatchToolValue( type1, "text" ) returns TRUE
	MatchToolValue( type1, "TEXT" ) returns TRUE
	MatchToolValue( type1, "data" ) returns FALSE
	MatchToolValue( type2, "a" )    returns TRUE
	MatchToolValue( type2, "b" )    returns TRUE
	MatchToolValue( type2, "d" )    returns FALSE
	MatchToolValue( type2, "a|b" )  returns FALSE

   NOTES
	icon.library V44 skips blank spaces surrounding the typeString
	options and the value string. Older icon.library versions did
	not support this.

   SEE ALSO
	icon.library/FindToolType
	utility.library/Stricmp
PeterK is offline  
Old 25 August 2020, 20:46   #12
thomas
Registered User
thomas's Avatar
 
Join Date: Jan 2002
Location: Germany
Posts: 6,121
Quote:
Originally Posted by PeterK View Post
with Arexx it should be possible to open any library of the system and use its functions
No, it does not work this way. To use a library with ARexx the library has to have a special function which acts as an interrface between ARexx and the other library fuinctions.

That's why the openlib function of ARexx requires an offset argument. It's the offset of the special funtion.
thomas is offline  
Old 25 August 2020, 21:52   #13
PeterK
Registered User
 
Join Date: Apr 2005
Location: Hangover
Posts: 2,816
Sorry, it was more than 20 years ago when I wrote my last Arexx scripts and at that time I still had a big Arexx manual from OS 2.x, but I don't have that anymore and my memories are lossy, so maybe I'm wrong ...

Update: I can't remember anymore what I once used to get access to library functions with Arexx, but there are several solutions available on Aminet, even for reading icon tooltypes. Try some of the following examples ...

http://aminet.net/package/util/libs/rxwb
http://aminet.net/package/util/rexx/rmh
http://aminet.net/package/util/rexx/royalbridge11
http://aminet.net/package/util/rexx/Rxgen

Last edited by PeterK; 25 August 2020 at 23:26.
PeterK is offline  
Old 26 August 2020, 01:54   #14
rare_j
Zone Friend

rare_j's Avatar
 
Join Date: Apr 2005
Location: London
Posts: 1,029
Have a look at TTtool on Aminet
http://aminet.net/package/util/batch/TTTool

This will read the default tool and the tooltypes from an icon.

Last edited by rare_j; 31 August 2020 at 14:04.
rare_j is offline  
Old 26 August 2020, 10:12   #15
paul1981
Registered User

paul1981's Avatar
 
Join Date: Oct 2013
Location: England
Posts: 263
Quote:
Originally Posted by rare_j View Post
Have a look at TTTtool on Aminet
http://aminet.net/package/util/batch/TTTool

This will read the default tool and the tooltypes from an icon.
Nice find. The OP will be extremely pleased
paul1981 is offline  
Old 26 August 2020, 11:37   #16
Sim085
Registered User
 
Join Date: Apr 2009
Location: N/A
Posts: 754
Indeed


Many thanks to everyone for all the help.



Quote:
Originally Posted by paul1981 View Post
Nice find. The OP will be extremely pleased
Sim085 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
Help with icons and tool types MartinW support.Other 3 12 December 2018 16:16
Script to update tool types of slaves for quit key? emuola project.WHDLoad 17 15 March 2017 19:26
Tool Types disappearing XimeR project.WHDLoad 6 29 July 2014 16:45
How to change default tool for file types AndyFC project.ClassicWB 2 13 February 2013 11:18
Execute script works but not after adding an icon with IconX as Default Tool. e5frog support.Other 19 27 July 2010 11:23

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 19:10.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2020, vBulletin Solutions Inc.
Page generated in 0.12974 seconds with 15 queries