Sign in to follow this  
Followers 0

Scite request - not show beta tools if beta not installed

9 posts in this topic

Posted

I was running Scite with 3.2.10.0 and no Beta version installed. Under the Tools menu, I saw all sorts of beta tools as well. Could Scite menu be altered so that when the Beta is not installed, all the beta stuff does not show up?

Share this post


Link to post
Share on other sites



Posted

Maybe a clever Lua script could overwrite the properties to destroy them. Just an idea for Jos to maybe try to pursue.

Share this post


Link to post
Share on other sites

Posted (edited)

Maybe a clever Lua script could overwrite the properties to destroy them. Just an idea for Jos to maybe try to pursue.

Have already tried that but don't know a howto remove the properties.

Normally when you change for example:

command.name.0.$(au3)=Beta Run

to

command.name.0.$(au3)=
The entry will be gone from the tools menu, but when doing this in LUA:

	--Check for Beta
	f = io.open(props["autoit3dir"].."\\beta\\au3check.dat")
	if f ~= nil then
		-- Beta Exists
		f:close()
	else
		-- No Beta Directory
		props['command.name.0.' .. props['au3']] = ""
	end

It doesn't remove the entry...... Tried setting it to one space and nil but none work correctly.

So the only way I can think of at the moment is to actually update the au3.properties file lines like SciTEConfig does to remove tools.

Edited by Jos

Share this post


Link to post
Share on other sites

Posted

Jos, there's another solution...

You can use simple conditional code in properties files. Here's an example of my properties file:

# Only one of these can be define at a time.  Define to the currently in-use
# version of AutoIt.  If both are set, then beta will take precedence.
STABLE_AUTOIT=1
BETA_AUTOIT=0

# ...

# Import the keyword lists for both stable and beta.
import properties\au3.keywords.stable
import properties\au3.keywords.beta

# ...

# We are using stable AutoIt.
if STABLE_AUTOIT
	# Set Au3Dir to the AutoIt directory.  This variable is used outside the if.
	Au3Dir=D:\Program Files\AutoIt3

	# Load the stable API file.
	api.$(au3)=$(SciteDefaultHome)\api\au3.stable.api

	# AutoIt Keyword Lists
	keywords.$(au3)=$(au3.keywords.keywords.stable)
	keywords2.$(au3)=$(au3.keywords.functions.stable)
	keywords3.$(au3)=$(au3.keywords.macros.stable)
	keywords4.$(au3)=$(au3.keywords.sendkeys.stable)
	keywords5.$(au3)=$(au3.keywords.preprocessor.stable)
	keywords6.$(au3)=$(au3.keywords.special.stable)
	keywords8.$(au3)=$(au3.keywords.udfs.stable)

# We are using beta AutoIt.
if BETA_AUTOIT
	# Set Au3Dir to the AutoIt directory.  This variable is used outside the if.
	Au3Dir=D:\Program Files\AutoIt3\beta

	# Load the beta API file.
	api.$(au3)=$(SciteDefaultHome)\api\au3.beta.api

	# AutoIt Keyword Lists
	keywords.$(au3)=$(au3.keywords.keywords.beta)
	keywords2.$(au3)=$(au3.keywords.functions.beta)
	keywords3.$(au3)=$(au3.keywords.macros.beta)
	keywords4.$(au3)=$(au3.keywords.sendkeys.beta)
	keywords5.$(au3)=$(au3.keywords.preprocessor.beta)
	keywords6.$(au3)=$(au3.keywords.special.beta)
	keywords8.$(au3)=$(au3.keywords.udfs.beta)

My setup lets me switch between Stable API/Properties files by just changing 2 flags around (which you see). I can also enable or disable my custom wrapper by another flag (not present). You could do similar stuff. Then SciTEConfig could just change a flag instead of do heavy file modification. Also, the version of AutoIt Extractor I'm working on supports generating files and properties with the names you see above. It'll support multiple INI files so you'll be able to run it twice, once with a stable INI file, once with a beta INI file and it'll generate separate API and keyword.properties files. It's all really nice once set up and requires minimal effort on my part to change. If you are interested, I can show you the entire properties file via PM.

Share this post


Link to post
Share on other sites

Posted

Will have a look at this approach but its a shame that we can't do it dynamically using the approach I posted earlier ... Don't really like modifying au3.properties with the issues Vista could give ....

Jos

Share this post


Link to post
Share on other sites

Posted

Honestly Jos, SciTE is poorly designed to handle Vista and that's not really our fault. But, it should be possible to configure SciTE to load the properties file from anywhere on the system. Just need to figure out a good place to store them. It would be nice to use %APPDATA%\SciTE to store properties/Lua files. However, SciTE doesn't have a pre-defined property for that path. On the other hand, SciTE does claim to support environment variables as properties, so, it could be possible to do.

Share this post


Link to post
Share on other sites

Posted (edited)

Assuming the plan to change the access rights on the SciTE directory is implemented, I got it working doing it this way in LUA using the conditional properties as shown:

	-- Check for Beta and set the BETA_AUTOIT= in au3.properties to the correct value 
	f = io.open(props['autoit3dir'].."\\beta\\au3check.dat")
	self.Beta = '0'
	if f ~= nil then
		-- Beta Exists
		f:close()
		self.Beta = '1'
	end
	-- check if au3.properties needs to be changed
	if 	props['BETA_AUTOIT'] ~= self.Beta then
		print("Need to change au3.properties: BETA_AUTOIT = " .. self.Beta)
		f = io.open(props['SciteDefaultHome'].."\\properties\\au3.properties")
		if f ~= nil then
			self.au3propinfo = f:read('*a')
			f:close()
			-- update the setting for BETA_AUTOIT
			self.au3propinfo = string.gsub(self.au3propinfo,"BETA_AUTOIT=%d","BETA_AUTOIT=" .. self.Beta)
			f = io.open(props['SciteDefaultHome'].."\\properties\\au3.properties","w")
			f:write(self.au3propinfo)
			f:close()
			props['BETA_AUTOIT'] = self.Beta
			-- Trigger reload of the properties 
			scite.Open(props['SciteDefaultHome'].."\\properties\\au3.properties")
			scite.MenuCommand(IDM_SAVE)
			scite.MenuCommand(IDM_CLOSE)
		end
	end

This seems to be working fine till now.

:)

Edited by Jos

Share this post


Link to post
Share on other sites

Posted

Implemented in the latest Beta version of SciTE4AutoIt3 :)

Share this post


Link to post
Share on other sites

Posted

Moving this to the Complete sub-forum since... well, it's complete.

Share this post


Link to post
Share on other sites
Sign in to follow this  
Followers 0

  • Recently Browsing   0 members

    No registered users viewing this page.