Jump to content

This site uses cookies. By continuing to browse the site you are agreeing to our use of cookies. Find out more here. X
X


Photo

_GetSavedSource() - Retrieve the saved source file from an AutoIt exe.


  • Please log in to reply
39 replies to this topic

#1 guinness

guinness

    I've a handle on the fiction

  • Developers
  • 15,709 posts

Posted 13 December 2011 - 09:36 PM

For those of us who use SciTE4AutoIt3 then you would've come across (at some stage) the directive #AutoIt3Wrapper_Res_SaveSource, it allows you to save the script to the compiled exe thus allowing you to retrieve at a later stage, great if you accidentally delete your source file.

_GetSavedSource() allows you to extract the source file from the compiled executable and save to a file of your choice.

Note: You must use #AutoIt3Wrapper_Res_SaveSource=Y at the top of the script for this to work & it must be compiled.

Function:
AutoIt         
#include-once #include <APIConstants.au3> ; Included with WinAPIEx.au3 #include <FileConstants.au3> #include <WinAPIEx.au3> ; Download From http://www.autoitscript.com/forum/topic/98712-winapiex-udf/ by Yashied. ; #FUNCTION# ==================================================================================================================== ; Name ..........: _GetSavedSource ; Description ...: Retrieve the source file from a compiled executable, #AutoIt3Wrapper_Res_SaveSource=Y must be used beforehand to embed the file to the executable. ; Syntax ........: _GetSavedSource([$sExecutable = ''[, $sSaveFilePath = '']]) ; Parameters ....: $sExecutable         - [optional] Executable to retrieve the source file from. ;                  Use a blank string or the Default keyword to use the current executable. Default is ''. ;                  $sSaveFilePath       - [optional] FilePath to save the source file to. Nore: The file doesn't have to exist. Default is ''. ;                  Use a blank string or the Default keyword to save to the current directory and using the script's name with the au3 prefix. Default is ''. ; Return values .: Success - True ;                  Failure - False and sets @error to non-zero. ; Author ........: guinness ; Remarks .......: ; Example .......: Yes ; Note ..........: Thanks to Jos, Yashied & Zedna. ; =============================================================================================================================== Func _GetSavedSource($sExecutable = '', $sSaveFilePath = '')     Local Const $STR_NOCASESENSEBASIC = 2 ; Not case sensitive, using a basic comparison     If StringStripWS($sExecutable, $STR_STRIPALL) = '' Or $sExecutable = Default Then         $sExecutable = @ScriptFullPath     EndIf     If StringStripWS($sSaveFilePath, $STR_STRIPALL) = '' Or $sSaveFilePath = Default Then         $sSaveFilePath = @ScriptDir & '\' & StringLeft(@ScriptName, StringInStr(@ScriptName, '.', $STR_NOCASESENSEBASIC, -1) - 1)     EndIf     Local $hInstance = _WinAPI_LoadLibraryEx($sExecutable, $LOAD_LIBRARY_AS_DATAFILE)     If $hInstance = 0 Then         Return SetError(1, 0, False)     EndIf     Local $hResource = _WinAPI_FindResource($hInstance, $RT_RCDATA, 999) ; Get the source file from the executable.     If @error Then         Return SetError(2, 0, False) ; The source file isn't present.     EndIf     Local $iSize = _WinAPI_SizeOfResource($hInstance, $hResource)     Local $hData = _WinAPI_LoadResource($hInstance, $hResource)     Local $pData = _WinAPI_LockResource($hData)     Local $tData = DllStructCreate('byte[' & $iSize & ']', $pData)     Local $hFilePath = FileOpen($sSaveFilePath, $FO_OVERWRITE + $FO_BINARY)     If $hFilePath = -1 Then         _WinAPI_FreeLibrary($hInstance)         Return SetError(3, 0, False) ; An error occurred writing the source file.     EndIf     FileWrite($hFilePath, DllStructGetData($tData, 1))     FileClose($hFilePath)     Return _WinAPI_FreeLibrary($hInstance) EndFunc   ;==>_GetSavedSource
Example 1 of Function:
#AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w- 4 -w 5 -w 6 -w 7 #AutoIt3Wrapper_Res_SaveSource=Y ; Use the full version of SciTE4AutoIt3 by Jos. #AutoIt3Wrapper_UseX64=N #include '_GetSavedSource.au3' If @Compiled = 0 Then     Exit MsgBox($MB_SYSTEMMODAL, 'Compile first', 'Please compile this script first and then run the compiled file, you''ll see a new file called "' & _ScriptName() & '.au3' & '" is created in the same directory.') EndIf _GetSavedSource(@ScriptFullPath, @ScriptDir & '\' & _ScriptName() & '.au3') ; Return the @ScriptName minus the .exe or .au3 extension. Func _ScriptName()     Local Const $STR_NOCASESENSEBASIC = 2 ; Not case sensitive, using a basic comparison     Return StringLeft(@ScriptName, StringInStr(@ScriptName, '.', $STR_NOCASESENSEBASIC, -1) - 1) EndFunc   ;==>_ScriptName
Example 2 of Function:
AutoIt         
#AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w- 4 -w 5 -w 6 -w 7 #AutoIt3Wrapper_Res_SaveSource=Y ; Use the full version of SciTE4AutoIt3 by Jos. #AutoIt3Wrapper_UseX64=N #include <GUIConstantsEx.au3> #include '_GetSavedSource.au3' If @Compiled = 0 Then     Exit MsgBox($MB_SYSTEMMODAL, 'Compile first', 'Please compile this script first and then run the compiled file, you''ll see a new file called "' & _ScriptName() & '.au3' & '" is created in the same directory.') EndIf _IsSaveSource() ; Check if the commandline parameter 'SaveSource' has been passed to the executable. Example() Func Example()     ; The example of using AutoItWinGetTitle() can be found at: http://www.autoitscript.com/forum/topic/133648-autoitwingettitleautoitwinsettitle-an-example-of-usage/     Local $hAutoIt = AutoItWinShow() ; Get the handle of the AutoIt Hidden Window by finding out the title of the AutoIt Hidden Window.     Local $sData = FileRead(@ScriptDir & '\' & _ScriptName() & '.au3') ; Read the source file that was extracted from the executable.     If @error Then ; If the file wasn't extracted then show an error string.         $sData = '## @error - can''t open the file ##'     EndIf     AutoItWinSetText($hAutoIt, $sData) ; Set the text of the edit box using the data returned from _GetFile.     While 1         Switch GUIGetMsg()             Case $GUI_EVENT_CLOSE ; Just hit the close button to Exit the application.                 ExitLoop         EndSwitch     WEnd EndFunc   ;==>Example ; Add text to AutoIt's Hidden Window. Func AutoItWinSetText($sString, $hWnd = Default)     If IsHWnd($hWnd) = 0 Or $hWnd = Default Then         $hWnd = WinGetHandle(AutoItWinGetTitle()) ; Get the handle of the AutoIt Hidden Window by finding out the title of the AutoIt Hidden Window.     EndIf     Return ControlSetText($hWnd, '', ControlGetHandle($hWnd, '', 'Edit1'), $sString) EndFunc   ;==>AutoItWinSetText ; Display AutoIt's Hidden Window. Returns the handle of the window. Func AutoItWinShow()     Local $hWnd = WinGetHandle(AutoItWinGetTitle()) ; Get the handle of the AutoIt Hidden Window by finding out the title of the AutoIt Hidden Window.     WinMove($hWnd, '', (@DesktopWidth / 2) - 250, (@DesktopHeight / 2) - 250, 500, 500) ; Move the AutoIt Hidden Window and re-size for a better view of the data that will be set.     WinSetState($hWnd, '', @SW_SHOW) ; Show the AutoIt Hidden Window, normally this is hidden, but in the interest of this example I'm displaying it.     Return $hWnd EndFunc   ;==>AutoItWinShow ; Check if the commandline parameter 'SaveSource' has been passed to the executable. Func _IsSaveSource()     If StringInStr($CmdLineRaw, 'SaveSource') Then         Return _GetSavedSource(@ScriptFullPath, @ScriptDir & '\' & _ScriptName() & '.au3')     EndIf EndFunc   ;==>_IsSaveSource ; Return the @ScriptName minus the .exe or .au3 extension. Func _ScriptName()     Local Const $STR_NOCASESENSEBASIC = 2 ; Not case sensitive, using a basic comparison     Return StringLeft(@ScriptName, StringInStr(@ScriptName, '.', $STR_NOCASESENSEBASIC, -1) - 1) EndFunc   ;==>_ScriptName

All of the above has been included in a ZIP file. Attached File  GetSavedSource.zip   3.46KB   188 downloads
Previously downloaded 100+

Edited by guinness, 20 May 2013 - 11:10 PM.

  • yahaosoft likes this

Example List: _AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUISetIcon()_Icon_Clear()/_Icon_Set()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingFileInstallrGeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIGetBkColor()LockFile()PasswordValidPasteBinPosts Per DayPreExpandQueue()SciTE JumpSHELLHOOKShunting-YardSignature CreatorStack()StringAddLF()/StringStripLF()StringEOLToCRLF()WM_COPYDATAMore Examples...
Updated: 12/04/2014








#2 JScript

JScript

    I'm back ... I miss, why not!

  • Active Members
  • PipPipPipPipPipPip
  • 1,070 posts

Posted 13 December 2011 - 10:18 PM

Wow, excellent, I had already done another way, but yours is much more elegant, thanks for sharing!
Regards,

João Carlos.
http://notebook.forumais.com (Forum Maintenance Notebooks and Desktop)http://autoitbrasil.com/ (AutoIt v3 Brazil!!!)
Spoiler

Posted Image Download Dropbox - Simplify your life!Your virtual HD wherever you go, anywhere!       


#3 guinness

guinness

    I've a handle on the fiction

  • Developers
  • 15,709 posts

Posted 13 December 2011 - 10:22 PM

How did you do it? FileInstall?

Example List: _AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUISetIcon()_Icon_Clear()/_Icon_Set()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingFileInstallrGeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIGetBkColor()LockFile()PasswordValidPasteBinPosts Per DayPreExpandQueue()SciTE JumpSHELLHOOKShunting-YardSignature CreatorStack()StringAddLF()/StringStripLF()StringEOLToCRLF()WM_COPYDATAMore Examples...
Updated: 12/04/2014


#4 JScript

JScript

    I'm back ... I miss, why not!

  • Active Members
  • PipPipPipPipPipPip
  • 1,070 posts

Posted 13 December 2011 - 10:25 PM

No, it's much like the way you did, but a bit archaic...

This line could be inside the UDF, so ensure that the "Source" is written!
#AutoIt3Wrapper_Res_SaveSource=Y ; Use the full version of SciTE4AutoIt3 by Jos.
I tested here and works that way!

Regards,

João Carlos.
http://notebook.forumais.com (Forum Maintenance Notebooks and Desktop)http://autoitbrasil.com/ (AutoIt v3 Brazil!!!)
Spoiler

Posted Image Download Dropbox - Simplify your life!Your virtual HD wherever you go, anywhere!       


#5 guinness

guinness

    I've a handle on the fiction

  • Developers
  • 15,709 posts

Posted 13 December 2011 - 10:30 PM

OK cool. About your suggestion I'm not going to do that as a general rule of thumb (I don't know what Jos' take is on this) is to have the directives at the top of the script and secondly this should be used by someone who kind of knows what they're already doing. :)

Example List: _AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUISetIcon()_Icon_Clear()/_Icon_Set()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingFileInstallrGeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIGetBkColor()LockFile()PasswordValidPasteBinPosts Per DayPreExpandQueue()SciTE JumpSHELLHOOKShunting-YardSignature CreatorStack()StringAddLF()/StringStripLF()StringEOLToCRLF()WM_COPYDATAMore Examples...
Updated: 12/04/2014


#6 JScript

JScript

    I'm back ... I miss, why not!

  • Active Members
  • PipPipPipPipPipPip
  • 1,070 posts

Posted 13 December 2011 - 10:36 PM

Yeah, that's true, you're right! But your UDF is really good, you can be sure!
Regards,

João Carlos.
http://notebook.forumais.com (Forum Maintenance Notebooks and Desktop)http://autoitbrasil.com/ (AutoIt v3 Brazil!!!)
Spoiler

Posted Image Download Dropbox - Simplify your life!Your virtual HD wherever you go, anywhere!       


#7 martin

martin

    ~~\o/~~~/0\=¬''~~~

  • MVPs
  • 7,313 posts

Posted 14 December 2011 - 12:26 AM

I like your script guinness. Thanks :)

Would it be better to have in your example a section like the following to show how it could be included in any script?

If @Compiled And $CmdLine[1] = 'ExtractSource' Then     _GetSavedSource(@ScriptFullPath, @ScriptDir & '' & @ScriptName & '.au3') EndIf

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

#8 guinness

guinness

    I've a handle on the fiction

  • Developers
  • 15,709 posts

Posted 14 December 2011 - 12:27 AM

Yeh I could provide a second example, I see no harm in doing that. Thanks martin.

Example List: _AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUISetIcon()_Icon_Clear()/_Icon_Set()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingFileInstallrGeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIGetBkColor()LockFile()PasswordValidPasteBinPosts Per DayPreExpandQueue()SciTE JumpSHELLHOOKShunting-YardSignature CreatorStack()StringAddLF()/StringStripLF()StringEOLToCRLF()WM_COPYDATAMore Examples...
Updated: 12/04/2014


#9 guinness

guinness

    I've a handle on the fiction

  • Developers
  • 15,709 posts

Posted 14 December 2011 - 03:18 PM

I updated the UDF as well as added an advanced example as suggested by martin. I've also included all of this in a ZIP for your convenience.

Example List: _AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUISetIcon()_Icon_Clear()/_Icon_Set()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingFileInstallrGeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIGetBkColor()LockFile()PasswordValidPasteBinPosts Per DayPreExpandQueue()SciTE JumpSHELLHOOKShunting-YardSignature CreatorStack()StringAddLF()/StringStripLF()StringEOLToCRLF()WM_COPYDATAMore Examples...
Updated: 12/04/2014


#10 BrewManNH

BrewManNH

    באָבקעס מיט קודוצ׳ה

  • MVPs
  • 9,549 posts

Posted 24 February 2012 - 05:48 PM

I recently came across this function again because I was looking for a way to do what this does, excellent resource. Definitely going to be using this more often as I compile scripts that do stupid things to my files when I'm not paying attention to where I'm using them. :S

Just a couple of caveats though, this will NOT work for obfuscated scripts if you use anything other than /striponly or /striponlyincludes. It's a security measure so that you're not putting your obfuscated script where someone can find it easily. Second, there's a bug in the second example script, it will never find the extracted script and display it because it's looking for the wrong file name. Small change needed to look for the correct file name.

    $sData = _GetFile(@ScriptDir & "" & _ScriptNameStrip() & ".au3") ; Read the source file that was extracted from the executable.     If @error Then ; If the file wasn't extracted then show an error string.         $sData = "## @error - can't open the file ##"     EndIf

This is located at around the 8th line of the Main() function.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to an XP machine, and I'm not going to.

 

How to ask questions the smart way!

 

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.
Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.
_FileGetProperty - Retrieve the properties of a file SciTE Toolbar - A toolbar demo for use with the SciTE editorGUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.
GUIToolTip UDF Demo - Demo script to show how to use the GUIToolTip UDF to create and use customized tooltips. Latin Square password generator

 

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.


#11 guinness

guinness

    I've a handle on the fiction

  • Developers
  • 15,709 posts

Posted 24 February 2012 - 10:35 PM

Thanks BrewManNH, simple mistake I failed to find.

Cheers for pointing out the caveats too, hopefully people won't start asking why isn't this possible :)

Example List: _AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUISetIcon()_Icon_Clear()/_Icon_Set()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingFileInstallrGeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIGetBkColor()LockFile()PasswordValidPasteBinPosts Per DayPreExpandQueue()SciTE JumpSHELLHOOKShunting-YardSignature CreatorStack()StringAddLF()/StringStripLF()StringEOLToCRLF()WM_COPYDATAMore Examples...
Updated: 12/04/2014


#12 BrewManNH

BrewManNH

    באָבקעס מיט קודוצ׳ה

  • MVPs
  • 9,549 posts

Posted 24 February 2012 - 10:43 PM

Hopefully some one reads that before deleting their script accidently like I've done when testing a filemove operation on the wrong folder.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to an XP machine, and I'm not going to.

 

How to ask questions the smart way!

 

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.
Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.
_FileGetProperty - Retrieve the properties of a file SciTE Toolbar - A toolbar demo for use with the SciTE editorGUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.
GUIToolTip UDF Demo - Demo script to show how to use the GUIToolTip UDF to create and use customized tooltips. Latin Square password generator

 

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.


#13 guinness

guinness

    I've a handle on the fiction

  • Developers
  • 15,709 posts

Posted 24 February 2012 - 10:57 PM

We all strive for perfection but alas we're only human! I've been known to delete the wrong file, but thank goodness I still had SciTE open!

Example List: _AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUISetIcon()_Icon_Clear()/_Icon_Set()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingFileInstallrGeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIGetBkColor()LockFile()PasswordValidPasteBinPosts Per DayPreExpandQueue()SciTE JumpSHELLHOOKShunting-YardSignature CreatorStack()StringAddLF()/StringStripLF()StringEOLToCRLF()WM_COPYDATAMore Examples...
Updated: 12/04/2014


#14 Zedna

Zedna

    AutoIt rulez!

  • MVPs
  • 8,557 posts

Posted 24 April 2012 - 06:27 PM

Nice guinness!

I have tip for improvement: Make parameters optional also change order of optional parameters

example of calling (first one is the most frequent use)
_GetSavedSource() _GetSavedSource("123.au3") _GetSavedSource("123.au3", @ScriptFullPath)


AutoIt         
#AutoIt3Wrapper_Res_SaveSource=Y #include-once #include <APIConstants.au3> ; Included with WinAPIEx.au3 #include <FileConstants.au3> #include <WinAPIEx.au3> ; Download From <a href='http://www.autoitscript.com/forum/topic/98712-winapiex-udf/' class='bbc_url' title=''>http://www.autoitscript.com/forum/topic/98712-winapiex-udf/</a> by Yashied. ; #FUNCTION# ==================================================================================================================== ; Name ..........: _GetSavedSource ; Description ...: Retrieve the source file from a compiled executable, #AutoIt3Wrapper_Res_SaveSource=Y must be used beforehand to embed the file to the executable. ; Syntax ........: _GetSavedSource($sExecutable, $sSaveFilePath) ; Parameters ....: $sExecutable - Executable to retrieve the source file from. (See remarks.) ;                $sSaveFilePath - FilePath to save the source file to. Nore: The file doesn't have to exist. ; Return values .: Return value from _WinAPI_FreeLibrary or 0 and sets @error to non-zero. ; Author ........: guinness ; Modified ......: ; Remarks .......: $sSaveFilePath doesn't have to exist, but if it does then it will be overwritten. ; Related .......: WinAPIEx.au3 by Yashied is required [<a href='http://www.autoitscript.com/forum/topic/98712-winapiex-udf/]' class='bbc_url' title=''>http://www.autoitscript.com/forum/topic/98712-winapiex-udf/]</a> ; Link ..........: ; Example .......: Yes ; Note ..........: Thanks to Jos & Yashied. ; =============================================================================================================================== Func _GetSavedSource($sSaveFilePath = '', $sExecutable = '')     Local $hData, $hFilePath, $hInstance, $hResource, $iSize, $pData, $tData     If $sSaveFilePath = '' Then $sSaveFilePath = @ScriptDir & "" & StringRegExpReplace(@ScriptName, ".[^.]*$", "") & ".au3" ; SRE by MrCreatoR.     If $sExecutable = '' Then $sExecutable = @ScriptFullPath     $hInstance = _WinAPI_LoadLibraryEx($sExecutable, $LOAD_LIBRARY_AS_DATAFILE)     If $hInstance = 0 Then Return SetError(1, 0, 0)     $hResource = _WinAPI_FindResource($hInstance, $RT_RCDATA, 999) ; Get the source file from the executable.     If @error Then Return SetError(2, 0, 0) ; The source file isn't present.     $iSize = _WinAPI_SizeOfResource($hInstance, $hResource)     $hData = _WinAPI_LoadResource($hInstance, $hResource)     $pData = _WinAPI_LockResource($hData)     $tData = DllStructCreate('byte[' & $iSize & ']', $pData)     $hFilePath = FileOpen($sSaveFilePath, $FO_OVERWRITE + $FO_BINARY)     FileWrite($hFilePath, DllStructGetData($tData, 1))     FileClose($hFilePath)     Return _WinAPI_FreeLibrary($hInstance) EndFunc   ;==>_GetSavedSource _GetSavedSource() _GetSavedSource("123.au3") _GetSavedSource("123.au3", @ScriptFullPath)

Edited by Zedna, 24 April 2012 - 06:28 PM.


#15 guinness

guinness

    I've a handle on the fiction

  • Developers
  • 15,709 posts

Posted 24 April 2012 - 06:32 PM

Good idea Zedna. I'll update accordingly. Thanks.

Example List: _AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUISetIcon()_Icon_Clear()/_Icon_Set()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingFileInstallrGeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIGetBkColor()LockFile()PasswordValidPasteBinPosts Per DayPreExpandQueue()SciTE JumpSHELLHOOKShunting-YardSignature CreatorStack()StringAddLF()/StringStripLF()StringEOLToCRLF()WM_COPYDATAMore Examples...
Updated: 12/04/2014


#16 guinness

guinness

    I've a handle on the fiction

  • Developers
  • 15,709 posts

Posted 24 April 2012 - 07:26 PM

Updated the original code with the suggestion provided by Zedna, now the parameters are optional and will use the current executable and save to a file using the script's name and au3 prefix e.g. @ScriptDir & 'Example.au3'.

Edited by guinness, 24 April 2012 - 07:26 PM.

Example List: _AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUISetIcon()_Icon_Clear()/_Icon_Set()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingFileInstallrGeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIGetBkColor()LockFile()PasswordValidPasteBinPosts Per DayPreExpandQueue()SciTE JumpSHELLHOOKShunting-YardSignature CreatorStack()StringAddLF()/StringStripLF()StringEOLToCRLF()WM_COPYDATAMore Examples...
Updated: 12/04/2014


#17 guinness

guinness

    I've a handle on the fiction

  • Developers
  • 15,709 posts

Posted 06 October 2012 - 01:36 PM

I found a small issue in _ScriptName (the function used in the example) which would return the incorrect scriptname. Please see the original post for more details about this function.

Example List: _AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUISetIcon()_Icon_Clear()/_Icon_Set()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingFileInstallrGeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIGetBkColor()LockFile()PasswordValidPasteBinPosts Per DayPreExpandQueue()SciTE JumpSHELLHOOKShunting-YardSignature CreatorStack()StringAddLF()/StringStripLF()StringEOLToCRLF()WM_COPYDATAMore Examples...
Updated: 12/04/2014


#18 guinness

guinness

    I've a handle on the fiction

  • Developers
  • 15,709 posts

Posted 23 October 2012 - 09:30 PM

I've updated the UDF by changing the return values to True or False instead of True and 0. I also updated the second example by using the functions I created in the thread AutoItWinGetTitle()/AutoItWinSetTitle(). See the original post for more details.

Example List: _AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUISetIcon()_Icon_Clear()/_Icon_Set()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingFileInstallrGeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIGetBkColor()LockFile()PasswordValidPasteBinPosts Per DayPreExpandQueue()SciTE JumpSHELLHOOKShunting-YardSignature CreatorStack()StringAddLF()/StringStripLF()StringEOLToCRLF()WM_COPYDATAMore Examples...
Updated: 12/04/2014


#19 JScript

JScript

    I'm back ... I miss, why not!

  • Active Members
  • PipPipPipPipPipPip
  • 1,070 posts

Posted 24 October 2012 - 01:24 AM

It would be better if the source it were saved encrypted and compressed in resource!

JS
http://notebook.forumais.com (Forum Maintenance Notebooks and Desktop)http://autoitbrasil.com/ (AutoIt v3 Brazil!!!)
Spoiler

Posted Image Download Dropbox - Simplify your life!Your virtual HD wherever you go, anywhere!       


#20 BrewManNH

BrewManNH

    באָבקעס מיט קודוצ׳ה

  • MVPs
  • 9,549 posts

Posted 24 October 2012 - 03:21 AM

I would think that you wouldn't be embedding your source code if you didn't want anyone to be able to access it later. Which is why this won't work with an obfuscated script, if you've gone through the trouble of obfuscation, you usually don't want anyone to be able to read it. You can always encrypt the file before embedding it, but that kind of defeats the purpose of embedding it in the first place. The source code for the script isn't that hard to get at in a compiled exe anyways if you really wanted to get at it.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to an XP machine, and I'm not going to.

 

How to ask questions the smart way!

 

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.
Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.
_FileGetProperty - Retrieve the properties of a file SciTE Toolbar - A toolbar demo for use with the SciTE editorGUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.
GUIToolTip UDF Demo - Demo script to show how to use the GUIToolTip UDF to create and use customized tooltips. Latin Square password generator

 

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users