ur

Special character with recorded au3 and include file problem

9 posts in this topic

I have recorded a gui installation and modified the au3 file as per my requirement.

But the problem is, whenever I try to compile the au3 file, I am getting a special character on top of the file.

aaaa.PNG

Can you suggest how to resolve this as it is appearing everytime during compilation.

And also I am trying to include a au3 file which is separate folder so I am adding the <..\Library.au3> line.

It is able to pick that but in that file "Library.au3" there is a file install line.

FileInstall(".\SendMail.ps1", @ScriptDir & "\SendMail.ps1")

Library.au3 is being used by many other codes in the previous folder..

But the current file is looking for the ps1 file in current folder.

So is there any option to tell the compiler to pick the dependent files relative to Library.au3 instead of the current code.

Share this post


Link to post
Share on other sites



What is the .au3 file encoding?

With regards to FileInstall, in your library any reason you can't use an absolute path rather than a relative path for your source?

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

On ‎2‎/‎13‎/‎2017 at 6:56 PM, Subz said:

What is the .au3 file encoding?

With regards to FileInstall, in your library any reason you can't use an absolute path rather than a relative path for your source?

Because I have synced this with GitHub and the work is not fixed to one machine, as workstations may vary I am keeping everything relative to the sourcecode folder.

May be a silly question, how to check the encoding?

Edited by ur

Share this post


Link to post
Share on other sites

Thanks @Subz

I have changed the encoding of the file to UTF-8 using Notepad++.

utf-8.png

After that I am not getting that special character.

Could you suggest for the relative path file issue also.

Share this post


Link to post
Share on other sites

Does anyone compile library.au3 directly?  Are all scripts in child folders? for example

  • library.au3
  • sendmail.ps1
    • Scripts Sub Folder
    • Script1 to Compile.au3
    • Script2 to Compile.au3

If so you could change the library.au3 to use FileInstall('..\SendMail.au3', @ScriptDir & '\SendMail.au3'), but this all depends on your folder structure, I personally work the other way around for example:

  • Script1 to Compile.au3
  • Script2 to Compile.au3
    • Resources Sub folder
    • library.au3
    • sendmail.ps1

Share this post


Link to post
Share on other sites

library.au3 is the common one with the team and also for other tools, if any common functionaly one is there, we are saving those to library.au3 so that we can use it for multiple tools and also for future purpose to reduce redundancy.

So it is there in parent folder.

I am able to compile my au3 by including it as "../library.au3".

But the dependent files sendmail.ps1 it is checking in my au3 directory instead of the library.au3 folder.

 

Share this post


Link to post
Share on other sites

You could change the library.au3 FileInstall to:

FileInstall("..\SendMail.ps1", @ScriptDir & "\SendMail.ps1")

But that would mean your team would always have to create scripts at the same level as your current script.  Alternatively just remove the FIleInstall from the library leave SendMail.ps1 in the parent folder and then add the line above to your individual scripts.

 

 

Share this post


Link to post
Share on other sites

Can we keep any conditional logic for this include of files also??

so that for my code I will skip this fileinstall.

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

    • TrashBoat
      By TrashBoat
      How do i add a path to a file in Include.
      I want my script to get the udf in the same folder as the script/exe:
      Include "@ScriptDir/udf.au3" can this be done?
    • pedrit0
      By pedrit0
      Hi all.
      I have created an external au3 (a library of functions and vars) that is #included in a main script that i must compile.
      I wish that the content of the library is not merged with the main script when compiling.
      My goal is to keep the ability to modify the library even after the main exe is compiled and that these changes are effective when executing the exe.
      I guess this is not possible using the standard #include method.
      Is there a way to do that ?
      thx a lot :-)
    • xiantez
      By xiantez
      Hey AutoIT Community,
      Just wanted to know if there is a way I can #include all *.au3 files in my script without having to #include each individual .au3 file. For instance, currently I have a laundry list of #includes like this:
      #include <IE.au3>
      #include <Inet.au3>
      #include <AutoItConstants.au3>
      #include <GUIConstantsEx.au3>
      #include <GDIPlus.au3>
      #include <GuiMenu.au3> 
      [ECT...ECT...]
      Would there be a way I could include all of the files above or all  .au3 file in a one liner? That way I do not have to burn up a bunch of lines of code for just my includes.... Your help is greatly appreciated...
    • MattG1991
      By MattG1991
      Hello all, 
      I've written a script that pulls info from some web pages, saves the results to variables, and prints it out to a Word document. I've tried to make this script work with a minimum of user interaction. I've noticed an issue happens when I run the script and I have another window set as active, like SciTE for example. It inserts an "ETX" character. I've done this with Notepad too. It displays an upside down L character. Any particular reason why? Unfortunately, I can't post any code. Basically, it gets a collection of tags, applies a test to find the values I want, then pulls the innerhtml from said tag. Then it assigns the results to a global variable.  Any help would be appreciated. 
    • Miliardsto
      By Miliardsto
      Is there possibility to do it like this?
      Cause as I see compiler doesn't see If statement in case of #include functions.
      It includes these two files all time.
      If $var == True Then #include 'func/funcsByTabs/main_Moda.au3' Else #include 'func/funcsByTabs/main_Others.au3' EndIf