Jump to content
AndyS19

Cannot fix "cannot open" in SciTE au3.properties file

Recommended Posts

AndyS19

I have a au3.properties file that adds a search command to the right click context menu.  This command does a FINDSTR on all .au3 files in the "Program Files" directory.  However, on 32 bit Windows 7 and 8.1 OS's, 32 bit executables are now run from a "Program Files (x86)" directory.

I have a construct that builds a path variable that holds the locations to search.  In this variable, I have both "Program Files" and "Program Files (x86)", as well as a directory that holds my library file.

The constructor looks like this:

findcmd="C:\Windows\System32\Findstr.exe"
myLib="C:\Andy\AutoIT-src\myLib"
where1="C:\Program Files\autoit3\include\*.au3" "C:\Program Files (x86)\autoit3\include\*.au3" $(myLib)\*.au3

Then in the command definition, I use it like this:

#   "Find Definitions"
# Look in the C:\Program Files (x86)\AutoIt3\Include directory for any .au3 file
# that has a definition for the currently selected word (or the word the
# cursor is on)
#
command.name.42.$(au3)=
command.42.$(au3)=$(findcmd) /N /R /I /C:"^global [0-9a-f].* $(CurrentWord) =" $(where1)
command.subsystem.42.$(au3)=0
command.save.before.42.$(au3)=2

The problem is that on 32 bit systems without the "Program Files (x86)" directory, I get this error:
    FINDSTR: Cannot open C:\Program Files (x86)\autoit3\include\*.au3

I think that what I need is an 'if then else' something like this:
 

if exists "C:\Program Files (x86)" then
    where1=""C:\Program Files (x86)" $(myLib)\*.au3
else
    where1=""C:\Program Files" $(myLib)\*.au3
endif

How can I conditionally define the search path?

Share this post


Link to post
Share on other sites
anthonyjr2
Local $filePath
If FileExists("C:\Program Files (x86)") Then
    $filePath="C:\Program Files (x86)\" & $myLib & "\*.au3"
Else
    $filePath="C:\Program Files\" & $myLib & "\*.au3"
EndIf
Edited by anthonyjr2
slight change

UHJvZmVzc2lvbmFsIENvbXB1dGVyZXI=

Share this post


Link to post
Share on other sites
Jos

What about when you use these enviroment variable: $(ProgramW6432) & $(ProgramFiles) in your properties file? 
I guess one is empty in a x86 system so would return  "".

PS: Don't change au3.properties, but make all changes in SciTEUSer.properties as the override the au3.properties settings and never get lost with an update of the installation.

Jos

 


Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites
AndyS19

I tried your example, but $(filePath) is replaced by an empty string.  Here's my new code with your suggested changes:
 

myLib=C:\Andy\AutoIT-src\myLib
# where1="C:\Program Files (x86)\autoit3\include\*.au3" $(myLib)\*.au3

Local $filePath
If FileExists("C:\Program Files (x86)") Then
    $filePath="C:\Program Files (x86)\autoit3\include\*.au3"
Els
    $filePath="C:\Program Files\autoit3\include\*.au3"
EndIf

$filePath=$(filepath) $(myLib)"\*.au3"

#  "Find References"
# Look in the C:\Program Files (x86)\AutoIt3\Include directory for any .au3 file
# that has references to the currently selected word (or the word the
# cursor is on)
#
command.name.41.$(au3)=
command.41.$(au3)=$(findcmd) /N /I /C:"$(CurrentWord)" $(filePath)
command.subsystem.41.$(au3)=0
command.save.before.41.$(au3)=2

When I highlight "SomeText" in my .au3 script and run command 41, here is what I see: 

>C:\Windows\System32\Findstr.exe /N /I /C:"SomeText"

So $(filePath) expanded to an empty string.  I tried using 'filePath' without the '$' and got similar results.  I'm not sure when to use filePath vs $filePath vs $(filePath).  Also the name concatenation on line 11 doesn't seem to work.

PS:  I put my au3.properties file in %SCITE_USERHOME%  (C:\Users\Andy\AppData\Local\AutoIt v3\SciTE).  A new install or upgrade will not override this directory.

 

Share this post


Link to post
Share on other sites
Jos
3 minutes ago, AndyS19 said:

PS:  I put my au3.properties file in %SCITE_USERHOME%  (C:\Users\Andy\AppData\Local\AutoIt v3\SciTE).  A new install or upgrade will not override this directory.

Somehow you have made a change to a production file since this wouldn't work if you didn't!  You really should only make changes to SciTEUser.properties!

 Jos


Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites
AndyS19

Jos, from the SciTE documenation:

There are two environment variables, "SciTE_HOME" and "SciTE_USERHOME", which the user may set to override the standard locations of the global and/or the user properties files (this and the following applies to Windows and GTK): 

If SciTE_USERHOME is set then it is where the user properties files are found. 
If SciTE_HOME is set then it is where the global properties files are found. 
If only SciTE_HOME is set then it is where both the global and user properties files are found.

 

Share this post


Link to post
Share on other sites
Jos

I know what the environment variables are used for, but what I stated about properties files is still valid. ;)
So you maintain your own total set of standard properties files and update them each time SciTE4AutoIt3 is released?

Jos 


Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites
AndyS19

We're getting a little off topic, but yes, I have my user properties files (au3.properties, etc.) in a local directory and merely copy them to the  %SCITE_USERHOME% directory and the next time I edit a .au3 file, the changes are applied.  I've been doing this through laptop and OS changes for years now.

Share this post


Link to post
Share on other sites
anthonyjr2

Ooh, disregard my suggestion then. I misread your question and did not realize you were working in the au3.properties file. I'm not exactly sure how that file is parsed, but I doubt you can use AutoIt syntax within it.


UHJvZmVzc2lvbmFsIENvbXB1dGVyZXI=

Share this post


Link to post
Share on other sites
AndyS19

So, the suggested if-else-endif was not correct.  I tested it with the conditions reversed and the same output is generated.  I wish there was a way to syntax check properties files.  I need to go back to my original question: 

How can I conditionally define the search path?

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Similar Content

    • Jos
      By Jos
      7/8/2018: Uploaded a new SciTe4AutoIt3.exe v18.708.1148.0 installer.
      It has been over a year since the last update of the full SciTE4AutoIt3 installer whch mainly had to do with the fact that Neil was moving toward v4 of SciTE and I wanted to wait for a stable version.
      Any help with testing this version before general release is appreciated.
      Also any feedback is welcome in caseI missed something or suggestions for improvement before releasing.
      ==> SciTE4AutoIt3 v18.708.1148.0
      Enjoy,
      Jos

      Addition/Changes/Fixes in the current installer:
      -------------------------------------------------------------------------------------------------- 8-7-2018 *** Merged the SciTE v 4.1.0 by Neil Hodgson with our own version of SciTE. (Jos)     This is a major change from the previous version so ensure you update all files including LUA or else you will get errors!     - SciLexer au3: Fixed issues with nested CommentBlocks not always showing the correct color.     - SciLexer au3: Change any line starting with # and no recognised keyword to be shown with the Pre-Processor in stead of default.     - Changed Shortcut for AU3INFO to Ctrl+Shift+F6.     - Moved the session restore logic for (save.session.advanced=1)into SciTE in stead of LoadSession.lua as that was clearing the recent files list of the last session       when opening a file by double cliking it. This is fixed with this change.       Default remains 0 so when a file is double clicked the last session isn't restored unless you add this to SciTEuser.properties:       "save.session.advanced=1"     - updated Tools.lua replacing [s%] with [ /t] to avoid empty lines being stripped by those functions. (Thanks Enyby) *** Updated AutoIt3Wrapper v18.708.1148.0 (Jos)     - 17.224.935.1 Added /autoit3dir to au3stripper commandline, when provided to AutoIt3Wrapper., to ensure the included files are for the correct AutoIt3 directory     - 17.224.935.2 Added directives:          #AutoIt3Wrapper_Res_CompanyName=          ;Company field          #AutoIt3Wrapper_Res_LegalTrademarks=      ;Trademark field     - 17.224.935.5 Fixed Versioning when files contain backets ->  ()     - 17.224.935.6 Added support for :          #AutoIt3Wrapper_Au3stripper_Stop_OnError=        ;(Y/N) Continue/Stop on Warnings.(Default=N)     - 17.224.935.7 added INI support for:           [Other]            Au3Stripper_Stop_OnError=n     - 17.224.935.10 Minor changes in console messages     - 17.224.935.11 Modifications from JPM:         - add #AutpIt3Wrapper_Res_Cursor_Add         - "clean" a little bit AutoIt3Wrapper.au3 *** Updated Au3Stripper v18.708.1148.0 (Jos)     - 17.224.935.1 Fixed crash when an include file contains longer record than 4096 characters.     - 17.224.935.2 Changed /rsln to replace @ScriptLineNumber in the Master script with "XXX/YYY". XXX is the master script linenumber, YYY is the Merged script linenumber.     - 17.224.935.3 Fixed issue detecting #cs #ce when a space was missing after the directive.     - 17.224.935.4 Changed Close/Open logic for Tracelog to (hopefully) avoid the hardcrash.     - 17.224.935.5 improved speed avoiding rereading include files to determine the max rec len.     - 17.224.935.6 improved speed by re-coding the check for long records.     - 17.224.935.7 Made sure the returncode is the highest from all iterations in stead of the last iteration.     - 17.224.935.8 fix for reported bug: https://www.autoitscript.com/trac/autoit/ticket/3623#comment:4     - 17.224.935.9 added support for #autoit3wrapper_autoit3dir     - 17.224.935.10 Fixed support for #autoit3wrapper_autoit3dir when followed by linecomment                     Stop processing when include file isn't found.     - 18.624.1847.1 strip the leading and trailing double quotes from the autoit3dir directive to avoid an error when they are specified.     - 18.624.1847.2 Fixed Hardcrash in the Include logic     - 18.624.1847.3 Fixed Hardcrash in Func stripping logic by enlarging the base table size     - 18.702.1556.1 Fixed regression bug with the Translate option.     - 18.703.1808.2 Fixed regression bug with the Stripping FUNC logic for the first found FUNC. *** Updated SciTEConfig v18.708.1148.0 (Jos)     - 17.224.935.1 No updates *** Updated Tidy v18.708.1148.0 (Jos)     - 17.224.935.1 Added option  to copy comments from #CS to #CE. Default is to copy the comments.                    Added Tidy Parameters:  /Skip_CE_Comment or /scec will skip this copy action                    Added INI option:                      * * *  Add comment to #CE/#CommentEnd and make it the same as the #CS/CommentStart Comments.                      ce_comment=1     - 17.224.935.2 Fix issue with Copy comments on comment start - end     - 17.224.935.4 Fix another issue with Copy comments on comment start - end -------------------------------------------------------------------------------------------------- ==> ScitillaHistory page containing all SciTE-Scintilla updates.
      ==> Visit the SciTE4AutoIt3 Download page for the latest versions
      ==> Check the online documentation for an overview of all extra's you get with this installer.
    • sumanth1980
      By sumanth1980
      Here i am wrote a simple lines to install basic applications but when i clicked on one application/program to install it was working fine but when i cancel the program in the middle to install another program it was not working. I am not an expert in this but i want a solution for this ... Can any one help me on this....
      ORG-1.au3
    • FrancescoDiMuro
      By FrancescoDiMuro
      Good evening everyone
      I was trying to insert function header to the functions of my script, but, in the SciTE console, this appears:
      Function or struct definition not found, unable to insert header. @Jos Any suggestion?
      Thanks in advance.

      Best Regards.
    • cheeroke
      By cheeroke
      Hi I am not sure how to call it properly, but for those of you who use SciTE, when you typing built in function and about to pass parameters to it you can see popup with all the ones which can be passed.
      Question: how to create something like that for my own functions?
       
      Thanks
    • therks
      By therks
      Does SciTE have string or number ids for the recent file menu items?
      I was hoping to add shortcuts (using the user.shortcuts properties) to the most recent item, but the documentation doesn't list any id's for those items (unless I overlooked?).
      Also, did anyone else notice that the index listing for the SciTE doc doesn't work properly?
      It appears it's linking to this: mk:@MSITStore:C:\Program%20Files\AutoIt3\SciTE\Scite4AutoIt3.chm::/SciTEDocumentation.html
      When it should be this? mk:@MSITStore:C:\Program%20Files\AutoIt3\SciTE\Scite4AutoIt3.chm::/Scitedoc/SciTEDoc.html
×