Jump to content

Extract function from AU3


Go to solution Solved by iamtheky,

Recommended Posts

Hi guys,

Since i don't want to reinvent the wheel, i'm asking if is exist in Scite or some external example/UDF to extract a function from a script and paste it on another file. I need to get all the MsgBox from my long code and check if there are correct ( the code is multilinguage so i need to verify for every language if there is something wrong or misspelling )

The final code i'd like to have is like this:

MsgBox(16, $aArray[1][$iLang], $aArray[2][$iLang]) ; there is a comment in my language for the original one
MsgBox(16, $aArray[3][$iLang], $aArray[4][$iLang]) ; there is a comment in my language for the original one
;etc.

Thaks for the help :D

Nothing is so strong as gentleness. Nothing is so gentle as real strength

 

Link to comment
Share on other sites

  • Solution

#include <Array.au3>
  #include <File.au3>


MsgBox(0, '' , 'msgbox 1') ; there is a comment in my language for the original one
MsgBox(0, '' , 'msgbox 2') ; there is a comment in my language for the original one
;MsgBox(0, '' , 'msgbox commented should not be captured')
MsgBox(0, '' , 'msgbox 3') ; there is a comment in my language for the original one


$aThisFile = FileReadToArray(@ScriptFullPath)
Global $aMsgBoxes[0]


For $i = 0 to ubound($aThisFile) - 1
If stringleft(stringstripws($aThisFile[$i] , 8) , 6) = "MsgBox" Then _ArrayAdd($aMsgBoxes , $aThisFile[$i])
Next


_FileWriteFromArray(@ScriptDir & "\output_msgboxes.au3" , $aMsgBoxes)

ShellExecute(@ScriptDir & "\output_msgboxes.au3")

,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-.
|(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/
(_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_)
| | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) (
| | | | |)| | \ / | | | | | |)| | `--. | |) \ | |
`-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_|
'-' '-' (__) (__) (_) (__)

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...