AndyS19

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

10 posts in this topic

#1 ·  Posted

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



#2 ·  Posted (edited)

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

#3 ·  Posted

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

#4 ·  Posted

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

#5 ·  Posted

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

#6 ·  Posted

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

#7 ·  Posted

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

#8 ·  Posted

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

#9 ·  Posted

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

#10 ·  Posted

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

    • wakillon
      By wakillon
      SciTE Hopper : Jump to Any line by one click and many other helpfull functions !


      As Ashalshaikh suggested me after leaving me the task to continue >SciTE Hopper, i open a new Topic about it.
      It will be more easy for futures updates.

      Many helpfull functions in contextual menu.
      SciTE Hopper is now multipurpose.
      • Color Catcher added
      • BinaryToAu3Kompressor added
      • TinyAu3Search replaced by StringFinder
      • RegJumper added
      • Edit With SciTE added (available in Options)
      • SpecialCharactersViewer added (available in Tray menu)
      New Contextual Menu :

      For a right Click on a function :

      • Copy function name
      • Insert a function header
      • Cut function
      • Copy function
      • Delete function
      • Create a variables List
      • Remove usseless Blank lines
      • Remove Debug lines ( all lines starting with ConsoleWrite or _ArrayDisplay )
      • Set AutoIt Code Layout
      • Remove Comments

      For entire script :

      • Create a functions List
      • Create a variables List
      • Remove usseless Blank lines
      • Remove Debug lines ( all lines starting with ConsoleWrite or _ArrayDisplay )
      • Set AutoIt Code Layout
      • Remove Comments
      • ( Open in SciTE a ) Duplicate of current Script in Temp Dir
      • ( Open in SciTE a ) Duplicate of current Script in Same Dir
      • Explore Parent Script Folder
      • Copy Script name
      • Copy Script path
      • Find Unused Functions
      • Find Unused Variables
      • Set all functions in alphabetic order.( func headers and regions ( in fact, all lines between functions ) are not supported.)

      SciTE Editor New Contextual Menu if SciTE Hopper is added ( in Options ) to SciTE Editor :
      when you made a selection in SciTE Editor you can :

      • Open a Reg Key in Regedit using RegJumper
      • Open a Url in your default Browser
      • Search on google in your default Browser
      • Search on AutoIt Website in your default Browser
      Now Can be added to windows start (minimized)
      Options are available by Tray Menu.
      A double click on tray icon will open clipboard content to SciTE Editor ( Handy when you have copied some code from your browser )

      How to proceed for add SciTE Hopper to SciTE Editor :
      Run Scite Editor, run Scite Hopper ( compiled! ) go to Options and select Add/Remove to SciTE Tab. then click on Add button and it's done !
      Right click on SciTE Editor and choose SciTE Hopper in Contextual Menu for run it when you need it !
      Update of 07 Dec 2017
      TinyAu3Search is replaced by StringFinder

      Previous downloads : 1287
      Script and compiled version are available in the download section
       
      Thanks to Ashalshaikh, Melba23, Th3 MMA, Alzri2, taitel, Manadar, taz742, Yashield, Authenticity, Xenobiologist for their help
      and asdf8 for his >Includes Helper and azjio for his >FileSearch.

      Hope it help you and happy Scripting !

       
    • wakillon
      By wakillon
      For more details go to the Topic
    • JaredStroeb
      By JaredStroeb
      I need to open an application and send it keys in Session 0.  I have exe's working locally, I can see the application open in session 0 through interactive services, but my send commands do not go to the application.  The following article running-autoit-session-0, directs me to use ControlSend() however my application has no controls that can be identified by AutoIt v3 Window Info.  Get All Windows Controls also returned nothing for the application's handle.  
      What are my options?  
      Can this be done with AutoIt?
      Is there a different "relatively simple" library/tool to use? (I am familiar with C# if there is a viable library there )

       
    • Skysnake
      By Skysnake
      Scite comes up occasional, almost incidentally, in some support topics.  I have not found a "Scite" topic in the forums, so this is where I will start.  I have recently been using Scite intensively, specifically with a large project and I have certain issues.  I know that Scite is not an AutoIt product, but it is so closely integrated to the core release that it makes sense to raise issues and request support here.  If this is not the right please refer me to the right forum.
      Thx
       
      Skysnake
    • TrashBoat
      By TrashBoat
      I've messed around in scite theme settings and it left this blue bar , how can i get rid of it?
      Image (imgur)