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                                                          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                                                          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                                                          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

    • tremolux66
      By tremolux66
      I use a monospace font for editing AutoIt scripts in SciTE (currently, CourierNew 9pt). Regardless of what font size I set in the configuration, when I start SciTE to resume editing the script text is one size smaller than I specified. When I type Ctrl+<numpad-slash> the text changes to the desired size. The same is true of the output pane, and I have to reset the size for both areas every time I start SciTE.
      IIRC, I've made few other changes to the configuration (e.g., changed the search highlight color and disabled Tidy), so this behavior seems odd. About SciTE says it's version 3.6.0 (Aug. 4, 2015).
      Any idea how to fix this?
    • user4157124
      By user4157124
      As they're opinion-based to some degree; how are AutoIt's best practices decided and do suggestions get considered?
      Some suggestions :
      For...To...Step...Next -loop variable-naming like $iN ($i1, $i2, etc.) : conforms to recommended naming convention, identifies level (albeit inverted to ExitLoop and ContinueLoop's convention) and enables SciTE selection-highlighting (requires minimum of 3 characters). Minimize logic in global scope, separate data & settings from logic, use of vertical space, project organization (folder structure, resource- and include file management). Example (loop variable-naming, minimizing logic in global scope and separation of settings from logic) :
      #include <Array.au3> Global Enum $RANDOM_RETURNFLOAT, _ $RANDOM_RETURNINTEGER Global Enum $EXITCODE_NONE Global Const $g_sChar0 = '-' Global Const $g_sChar1 = '+' Global Const $g_iAmountX = 10 Global Const $g_iAmountY = $g_iAmountX Main() Func Main() Local $aArray[$g_iAmountY][$g_iAmountX] For $i1 = 0 To $g_iAmountY - 1 For $i2 = 0 To $g_iAmountX - 1 $aArray[$i1][$i2] = Random(0, 1, $RANDOM_RETURNINTEGER) ? $g_sChar1 : $g_sChar0 Next Next _ArrayDisplay($aArray) Exit $EXITCODE_NONE EndFunc Example (project organization) :
      + project_folder + bak [backup files] + bin [distributed binaries and dependencies] + inc [non-standard include files] + res [resource files (icons, file+install files, etc.)] + usr [configuration files, databases, etc.] - script.au3 - script.exe Example (use of vertical space) :
      Func _DigitalRoot($iNum) Local $sNum = '' Local $aNum While $iNum > 9 $sNum = String($iNum) $aNum = StringSplit($sNum, '') $iNum = 0 For $i1 = 1 To $aNum[0] $iNum += Int($aNum[$i1]) Next WEnd Return $iNum EndFunc
    • wimhek
      By wimhek
      LS
      Is it possible to open file(s) in scite in read only mode ?
      If so, How ?
       
      Thnx
       
    • Hoth2001
      By Hoth2001
      I installed AutoIt to my computer 3 days ago...and have invested the last 3 days learning how to use it.
      As learned in the tutorials, whenever opening I new file in Scite editor I'd immediatley save the file
      I left the Scite Editor open for the past 3 consecutive days on my laptop
       
      No problem
       
      Today I closed Autoit for the first time, restarted my computer, and opened up the Scite Editor
      Now whenever I try to save a file I am prevented from doing so because I apparently don't have permission!?  
      And whenever I try to run any of the programs I've created over the past 3 days now I keep getting annoying popup notifications before I run them
       
      Problem
       
      To go around the issue, I copied a program originally saved in the AUtoIt folder to another folder (since I was barred from saving it in it's original AutoIt location)
      NOw when I run the code the mouse coordiantes are all off
      and I still get that pesky notification whenever I try to run a program
       
      Big Problem!!!
      Anyone have any clue why I'm going through this BS?
       
      1. I checked my User settings and YES I am the administrator on this cpu
      2. I tried to de-select the "read only" attribute for the AutoIt folder (everytime after doing this successfully the folder immediately and automatically reverts back to "read only")
       
      Any help would be MOST appreciated. I've attached screen shots of the annoying bus I keep getting
       
       


    • algiuxas
      By algiuxas
      Hello everybody!
      I get these weird errors in SciTE console:
      [0801/210405:ERROR:tcp_socket_win.cc(335)] bind() returned an error: Only one usage of each socket address (protocol/network address/port) is normally permitted. (0x2740) [0801/210405:ERROR:devtools_http_handler.cc(229)] Cannot start http server for devtools. Stop devtools. [0801/210405:ERROR:browser_gpu_channel_host_factory.cc(119)] Failed to launch GPU process. [0801/210405:ERROR:browser_gpu_channel_host_factory.cc(119)] Failed to launch GPU process. My script:
      #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <Misc.au3> #NoTrayIcon $title = "Hello" $txt = "..." ; TODO: Make 4 of them ;~ #Region ### START Koda GUI section ### Form= ;~ $1_GUI = GUICreate($title, 370, 120, -1, -1) ;~ GUISetBkColor(0xFFFFFF) ;~ $1_B1 = GUICtrlCreateButton("B1", 136, 80, 107, 25) ;~ GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") ;~ $1_B2 = GUICtrlCreateButton("B2", 248, 80, 107, 25) ;~ GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") ;~ GUICtrlCreateLabel($txt, 16, 24, 338, 52) ;~ GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif") ;~ GUICtrlSetColor(-1, 0x000000) ;~ GUISetState(@SW_SHOW) ;~ #EndRegion ### END Koda GUI section ### #Region ### START Koda GUI section ### Form= $2_GUI = GUICreate($title, 370, 0?"Hi :)":120, -1, -1) GUISetBkColor(0xFFFFFF) $2_B1 = GUICtrlCreateButton("B1", 136, 80, 107, 25) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") $2_B2 = GUICtrlCreateButton(0?":D":"B2", 248, 80, 107, 25) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") GUICtrlCreateLabel($txt, 16, 24, 338, 52) GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif") GUICtrlSetColor(-1, 0x000000) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### $u32dll = DllOpen("user32.dll") ;~ Opt("GUIOnEventMode", 1) ;~ GUICtrlSetOnEvent(-3, "_Exit") ; TODO: Fix, doesn't work with 2 GUI at the same time ;~ GUICtrlSetOnEvent($B11, "_Exit") ;~ GUICtrlSetOnEvent($B21, "_Exit") ;~ GUICtrlSetOnEvent($B12, "_Exit") ;~ GUICtrlSetOnEvent($B22, "_Exit") ;~ $pos1 = WinGetPos($GUI1) ;~ $pos2 = WinGetPos($GUI1) While 1 ;~ $pos1 = WinGetPos($GUI1) ;~ $pos2 = WinGetPos($GUI1) ;~ $x = $pos1[0] - 370 ;~ $y = $pos1[1] ;~ WinMove($GUI2, "", $x, $y, $pos1[2], $pos1[3], 1) ; Press middle mouse button to close (it's gonna be a non malicious prank for my friend) If _IsPressed(4, $u32dll) Then Exit $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE _Exit() ;~ Case $1_B1 ;~ _Exit() ;~ Case $1_B2 ;~ _Exit() Case $2_B1 _Exit() Case $2_B2 _Exit() EndSwitch WEnd Func _Exit() ; TODO: ... ;~ GUIDelete($1_GUI) GUIDelete($2_GUI) Exit EndFunc ;==>_Exit How to get rid of these errors?