Sign in to follow this  
Followers 0
Dr.Chi

Alternative to FileInstall?

15 posts in this topic

First, this is not another "Why can't I use variables in FileInstall" question.

This is a "Help me figure out how to do this" question.

Following a suggestion elsewhere on the forums I am using an argument in all my scripts to get back the original .au3 file from a compiled exe in case I lost the original source (which has happened to me twice recently.

That part is working fine, but I have to constantly remember to change a line in my script.

In effect here is what I want to do: FileInstall(@ScriptFullPath, "C:\")

I know I can't do that though.

I'm forced to use: FileInstall("D:\Scripts\SourceFile.au3", "C:\") in all my scripts.

Problem is, "SourceFile.au3" always needs to be the actual name of the current script I'm editing. I'm trying to remember to always change that to the name of the script I'm creating, but I know for a fact I'll forget at some point.

Is there any alternative to automate this in my script?

Share this post


Link to post
Share on other sites



You could use these two directives to run a script that changes the macro to a string (and change it back to a macro afterwards if neccesary).

#AutoIt3Wrapper_Run_Before=
#AutoIt3Wrapper_Run_After=

You can read more about these and other directives by checking the page "AutoIt3Wrapper" in the SciTE helpfile (you will probably need to install the FULL SciTE package if you haven't)

Share this post


Link to post
Share on other sites

Interesting, I never thought of macroing my editor. (I use Notepad++, not used SciTE)

I'll give it a try.

Still with advanced as AutoIt is, you'd think there'd be a way to write it in the script.

Share this post


Link to post
Share on other sites

Macroing the editor? No no, #AutoIt3Wrapper is a separate program that runs when you press compile from SciTE. Can't you use that in Notepad++?

As Obama would say: Yes you can.

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

I don't know how to compile in Notepad++. I've just been using Aut2Exe when I'm done editing my script.

Maybe I should start using SciTE instead...

Share this post


Link to post
Share on other sites

I don't know how to compile in Notepad++. I've just been using Aut2Exe when I'm done editing my script.

Maybe I should start using SciTE instead...

Notepad++ is a nice editor too using the same SciLexer as SciTE, but you will have to set all configuration options yourself where SciTE is already done.

I remember others already did some work on configuring Notepad++ but cannot remember who it was on this forum at this moment.

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 (edited)

It depends on how complex or not you want the process to be in NPP,

I would recommend using the NPPExec console or the Execute (F6) menu option, both you will find in the Plugins-NppExec menu.

alternatively the quickest way is to use the Run menu Option (F5).

Example:

1) Press F5 to bring up the Run Dialog.

2) Type the correct path to AutoItWrapper or Aut2Exe into the combo field like so::

c:\wuh\Aut2Exe.exe /in $(FULL_CURRENT_PATH)

3) Click the save button in the dialog, this should bring up another window in which you name your menu item + set the shortcut keys for it.

4) Click ok, now the item should be added to the Run Menu for easy invocation.

If you want to find out a complete list of the types of macros $(...) that Npp supports, either type help into the NppExec console, or read the man pages.

Vlad

Edited by Mobius

Share this post


Link to post
Share on other sites

Thanks Mobius, I now have Au32Exe running in npp. I've never used AutoitWrapper, I'm going to look for it and read up on it.

Share this post


Link to post
Share on other sites

#10 ·  Posted (edited)

In Scite/Wrapper there is option for that:

#AutoIt3Wrapper_Res_SaveSource=y ;(Y/N) Save a copy of the Scriptsource in the EXE resources. default=N

Edited by Zedna

Share this post


Link to post
Share on other sites

#AutoIt3Wrapper_Res_SaveSource=y ;(Y/N) Save a copy of the Scriptsource in the EXE resources. default=N

If you used that param in AutoItWrapper, how would you later go about getting the source back out of the exe?

Share this post


Link to post
Share on other sites

#12 ·  Posted (edited)

If you used that param in AutoItWrapper, how would you later go about getting the source back out of the exe?

Use Reshacker.exe or resource Windows API functions for extraction.

You may look at my Resource UDF as example of using resource API functions.

Link is in my signature.

Edited by Zedna

Share this post


Link to post
Share on other sites

I see. I got that to work, thanks! I can now see the source in ResHack.

However, is there some param I can add to the wrapper so that I don't have to run "UPX -d" before I can see the source files?

I see if I so RES_FILE_ADD it says it'll do that, but what if I am not wanting to add another file to the exe?

Share this post


Link to post
Share on other sites

#14 ·  Posted (edited)

I see.  I got that to work, thanks!  I can now see the source in ResHack.

However, is there some param I can add to the wrapper so that I don't have to run "UPX -d" before I can see the source files?

I see if I so RES_FILE_ADD it says it'll do that, but what if I am not wanting to add another file to the exe?

To see all wrapper options press Ctrl+F1 in Scite

#AutoIt3Wrapper_useupx=n
#AutoIt3Wrapper_Res_SaveSource=y 
#AutoIt3Wrapper_run_after=upx.exe --best --compress-resources=0 "%out%"
Edited by Zedna

Share this post


Link to post
Share on other sites

I was forgetting the "#AutoIt3Wrapper_useupx=n" line.

This works great, thanks!

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
Sign in to follow this  
Followers 0