Jump to content
Sign in to follow this  
Mechaflash

Spawn a temporary process for a function?

Recommended Posts

Mechaflash

I'm pretty sure that the only answer to this is "Run another exe" but I'm going to ask anyway...

I have a function in AdLibRegister() that checks for the connection to a network drive. If it fails, I want to be able to, pop up a msgbox informing the user. And as we all know... AdLibRegister() IS NOBODY'S BITCH!!! (it doesn't wait for any command to complete before moving on including msgbox). So I was wondering if it was possible to temporarily spawn the msgbox in its own process so it would show up?


Spoiler

“Hello, ladies, look at your man, now back to me, now back at your man, now back to me. Sadly, he isn’t me, but if he stopped using ladies scented body wash and switched to Old Spice, he could smell like he’s me. Look down, back up, where are you? You’re on a boat with the man your man could smell like. What’s in your hand, back at me. I have it, it’s an oyster with two tickets to that thing you love. Look again, the tickets are now diamonds. Anything is possible when your man smells like Old Spice and not a lady. I’m on a horse.”

 

Share this post


Link to post
Share on other sites
guinness

Something like this?

Local $aChangeText[4] = [3, 'Enable', 'Disable', 'Quit']
_MsgBoxEx(3, 'Title', 'Text', 0, $aChangeText)

Func _MsgBoxEx($iFlag, $sTitle, $sText, $iTimeOut = 0, $aButtonText = "")
    Local $iPID, $sMsgBox = '"' & "ConsoleWrite(MsgBox(" & $iFlag & ', ""' & $sTitle & '"", ""' & $sText & '"", ' & $iTimeOut & '"))', $sStdoutRead
    ConsoleWrite($sMsgBox & @LF)
    $iPID = Run(@AutoItExe & ' /AutoIt3ExecuteLine ' & $sMsgBox, '', @SW_SHOW, 6)
    Do
        Sleep(10)
    Until WinExists($sTitle)
    If IsArray($aButtonText) Then
        For $i = 1 To $aButtonText[0]
            ControlSetText($sTitle, '', 'Button' & $i, $aButtonText[$i])
        Next
    ElseIf $aButtonText <> '' Then
        ControlSetText($sTitle, '', 'Button1', $aButtonText)
    EndIf

    While ProcessExists($iPID)
        $sStdoutRead = StdoutRead($iPID)
        If Number($sStdoutRead) Then
            Return $sStdoutRead
        EndIf
        Sleep(10)
    WEnd
    If IsArray($aButtonText) Then
        Return SetError(1, 0, 0)
    EndIf
    Return SetError(1, 0, 1)
EndFunc   ;==>_MsgBoxEx

UDF List:

 
_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_ArrayFilter/_ArrayReduce_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_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()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_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_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 22/04/2018

Share this post


Link to post
Share on other sites
Mechaflash

It looks like it's dependent on AutoIt.exe existing on the machine in question?


Spoiler

“Hello, ladies, look at your man, now back to me, now back at your man, now back to me. Sadly, he isn’t me, but if he stopped using ladies scented body wash and switched to Old Spice, he could smell like he’s me. Look down, back up, where are you? You’re on a boat with the man your man could smell like. What’s in your hand, back at me. I have it, it’s an oyster with two tickets to that thing you love. Look again, the tickets are now diamonds. Anything is possible when your man smells like Old Spice and not a lady. I’m on a horse.”

 

Share this post


Link to post
Share on other sites
guinness

No it doesn't, it uses the compiled exe hence @AutoItExe. Please look in the help file for /AutoIt3ExecuteLine.

Also if in doubt, compile and test it!

Edited by guinness

UDF List:

 
_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_ArrayFilter/_ArrayReduce_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_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()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_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_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 22/04/2018

Share this post


Link to post
Share on other sites
guinness

The full path and filename of the AutoIt executable currently running. For compiled scripts it is the path of the compiled script.


UDF List:

 
_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_ArrayFilter/_ArrayReduce_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_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()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_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_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 22/04/2018

Share this post


Link to post
Share on other sites
Mechaflash

AHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH

I always thought that's what @ScriptFullPath was for.

I understand now.


Spoiler

“Hello, ladies, look at your man, now back to me, now back at your man, now back to me. Sadly, he isn’t me, but if he stopped using ladies scented body wash and switched to Old Spice, he could smell like he’s me. Look down, back up, where are you? You’re on a boat with the man your man could smell like. What’s in your hand, back at me. I have it, it’s an oyster with two tickets to that thing you love. Look again, the tickets are now diamonds. Anything is possible when your man smells like Old Spice and not a lady. I’m on a horse.”

 

Share this post


Link to post
Share on other sites
guinness

I thought you were under that impression from your previous response.


UDF List:

 
_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_ArrayFilter/_ArrayReduce_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_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()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_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_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 22/04/2018

Share this post


Link to post
Share on other sites
guinness

Also look at _InetGetOutOfProcess to give you a better idea about that parameter.


UDF List:

 
_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_ArrayFilter/_ArrayReduce_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_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()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_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_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 22/04/2018

Share this post


Link to post
Share on other sites
Mechaflash

I looked at the helpfile in the "Running Scripts" section and found the use for /AutoIt3ExecuteLine and it actually told me exactly what I was looking for XD

Run(@AutoItExe & ' /AutoIt3ExecuteLine "msgbox(0, ''Hello World!'', ''Hi!'')"')

Looking at your link, I can see some useful ways I can use this aside from what I'm using it for now. Thanks for that guinness.


Spoiler

“Hello, ladies, look at your man, now back to me, now back at your man, now back to me. Sadly, he isn’t me, but if he stopped using ladies scented body wash and switched to Old Spice, he could smell like he’s me. Look down, back up, where are you? You’re on a boat with the man your man could smell like. What’s in your hand, back at me. I have it, it’s an oyster with two tickets to that thing you love. Look again, the tickets are now diamonds. Anything is possible when your man smells like Old Spice and not a lady. I’m on a horse.”

 

Share this post


Link to post
Share on other sites
Skitty

Monoceres made a nice little message box function that runs msgboxes in seperate threads under x86 aka 32bit operating systems, I'm not sure if his original example supported x64 systems but it's come in handy for local applications I make (things I make for myself) as putting something like this in distributed apps wont be such a smart thing due to it not working as expected on some systems for some reason.

This version was edited a little by me to make it a single function that's copy & pastable into scripts.

Global Const $hKERNEL32 = DllOpen("kernel32.dll")

For $I = 0 To 5
    MessagBox(64, "Information!", "Hey there!")
Next
Sleep(5000)


Func MessagBox($iFlag, $sTitle, $sBody, $hWnd = 0); monoceres remote msgbox code suited for this script.

    If @OSArch <> "X86" Then Return MsgBox($iFlag, $sTitle, $sBody, "", $hWnd)
    Local $aResult = DllCall($hKERNEL32, "handle", "OpenProcess", "dword", 42, "bool", False, "dword", @AutoItPID)
    If @error Then
        MsgBox($iFlag, $sTitle, $sBody, "", $hWnd)
        Return SetError(@error, @extended, 0)
    EndIf
    Local $hProcess = $aResult[0]
    Local $DataBuffer = DllStructCreate("wchar modulename[11];char function[12];" & _
            "wchar title[" & StringLen($sTitle) + 1 & "];wchar body[" & StringLen($sBody) + 1 & "]")
    DllStructSetData($DataBuffer, "modulename", "User32.dll")
    DllStructSetData($DataBuffer, "function", "MessageBoxW")
    DllStructSetData($DataBuffer, "title", $sTitle)
    DllStructSetData($DataBuffer, "body", $sBody)
    $aResult = DllCall($hKERNEL32, "ptr", "VirtualAllocEx", "handle", $hProcess, "ptr", 0, "ulong_ptr", DllStructGetSize($DataBuffer), "dword", 0x00001000, "dword", 0x00000004)
    If @error Then
        MsgBox($iFlag, $sTitle, $sBody, "", $hWnd)
        Return SetError(@error, @extended, 0)
    EndIf
    Local $RemoteData = $aResult[0]
    If Not $RemoteData Then Return 0
    $aResult = DllCall($hKERNEL32, "handle", "GetModuleHandleW", "wstr", "Kernel32.dll")
    If @error Then
        MsgBox($iFlag, $sTitle, $sBody, "", $hWnd)
        Return SetError(@error, @extended, 0)
    EndIf
    Local $Loadlibrary = DllCall($hKERNEL32, "ptr", "GetProcAddress", "ptr", $aResult[0], "str", "LoadLibraryW")
    $Loadlibrary = $Loadlibrary[0]
    Local $GetProcAddress = DllCall($hKERNEL32, "ptr", "GetProcAddress", "ptr", $aResult[0], "str", "GetProcAddress")
    $GetProcAddress = $GetProcAddress[0]
    Local $CodeBuffer = DllStructCreate("byte[48]")
    $aResult = DllCall($hKERNEL32, "ptr", "VirtualAllocEx", "handle", $hProcess, "ptr", 0, "ulong_ptr", DllStructGetSize($DataBuffer), "dword", 0x00001000, "dword", 0x00000040)
    If @error Then
        MsgBox($iFlag, $sTitle, $sBody, "", $hWnd)
        Return SetError(@error, @extended, 0)
    EndIf
    Local $RemoteCode = $aResult[0]
    DllStructSetData($CodeBuffer, 1, _
            "0x" & _
            "68" & Hex(Binary($RemoteData)) & _                                                                                 ; push RemoteData.modulename
            "B8" & Hex(Binary($Loadlibrary)) & _                                                                                 ; mov eax,LoadLibrary
            "FFD0" & _                                                                                                             ; call eax
            "68" & Hex(Binary($RemoteData + (DllStructGetPtr($DataBuffer, "function") - DllStructGetPtr($DataBuffer)))) & _     ; push RemoteData.function
            "50" & _                                                                                                             ; push eax
            "B8" & Hex(Binary($GetProcAddress)) & _                                                                                 ; mov eax,GetProcAddress
            "FFD0" & _                                                                                                             ; call eax
            "68" & Hex(Binary($iFlag)) & _                                                                                         ; push iFlag
            "68" & Hex(Binary($RemoteData + (DllStructGetPtr($DataBuffer, "title") - DllStructGetPtr($DataBuffer)))) & _         ; push sTitle
            "68" & Hex(Binary($RemoteData + (DllStructGetPtr($DataBuffer, "body") - DllStructGetPtr($DataBuffer)))) & _         ; push sBody
            "68" & Hex(Binary($hWnd)) & _                                                                                         ; push hWnd
            "FFD0" & _                                                                                                             ; call eax
            "C3") ; Ret

    DllCall($hKERNEL32, "bool", "WriteProcessMemory", "handle", $hProcess, "ptr", $RemoteCode, "ptr", DllStructGetPtr($CodeBuffer), _
            "ulong_ptr", DllStructGetSize($CodeBuffer), "ulong_ptr*", 0)
    If @error Then
        MsgBox($iFlag, $sTitle, $sBody, "", $hWnd)
        Return SetError(@error, @extended, 0)
    EndIf
    DllCall($hKERNEL32, "bool", "WriteProcessMemory", "handle", $hProcess, "ptr", $RemoteData, "ptr", DllStructGetPtr($DataBuffer), _
            "ulong_ptr", DllStructGetSize($DataBuffer), "ulong_ptr*", 0)
    If @error Then
        MsgBox($iFlag, $sTitle, $sBody, "", $hWnd)
        Return SetError(@error, @extended, 0)
    EndIf
    Local $call = DllCall($hKERNEL32, "int", "CreateRemoteThread", "ptr", $hProcess, "ptr", 0, "int", 0, "ptr", $RemoteCode, "ptr", 0, "int", 0, "dword*", 0)
    Local $hThread = $call[0]
    DllCall($hKERNEL32, "bool", "VirtualFreeEx", "handle", $hProcess, "ptr", $RemoteCode, "ulong_ptr", DllStructGetSize($CodeBuffer), "dword", 0x00008000)
    If @error Then
        MsgBox($iFlag, $sTitle, $sBody, "", $hWnd)
        Return SetError(@error, @extended, 0)
    EndIf
    $call = DllCall($hKERNEL32, "ptr", "GetExitCodeThread", "ptr", $hThread, "dword*", 0)
    Return $call[2]
EndFunc   ;==>MessagBox
Edited by CaptainClucks

Things that I've done..

Icon Resource Editor: icon resource editor 

AutoIt Piano: a piano

AutoIt Unlocker: unlocks files when you want to delete them

Colorful tooltips: a wrapper for the tool tips UDF

Rouge GoogleBot: a full screen animation

ASciTE text editor: a text editor written in autoit

Warning: Posts by this user are subject to change or may disappear without notice.

Share this post


Link to post
Share on other sites
Mechaflash

It looks like it's dependent on AutoIt.exe existing on the machine in question?

No it doesn't,

Upon some testing, I've found that I do have to have AutoIt.exe on the user's machine lol. That sucks =/

Edited by Mechaflash

Spoiler

“Hello, ladies, look at your man, now back to me, now back at your man, now back to me. Sadly, he isn’t me, but if he stopped using ladies scented body wash and switched to Old Spice, he could smell like he’s me. Look down, back up, where are you? You’re on a boat with the man your man could smell like. What’s in your hand, back at me. I have it, it’s an oyster with two tickets to that thing you love. Look again, the tickets are now diamonds. Anything is possible when your man smells like Old Spice and not a lady. I’m on a horse.”

 

Share this post


Link to post
Share on other sites
guinness

How rude. Please refrain from using language like that and secondly I use this all the time. Do yourself a favour and provide some code, as you've implemented this wrong somehow. On second thoughts search the forum before being rude to someone.

Edited by guinness

UDF List:

 
_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_ArrayFilter/_ArrayReduce_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_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()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_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_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 22/04/2018

Share this post


Link to post
Share on other sites
BrewManNH

It depends on the line you're running, but if it's something internal to AutoIt then AutoIt does not have to be installed on the user's machine to run the line from a compiled script.


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 XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

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.

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 editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites
Mechaflash

How rude. Please refrain from using language like that and secondly I use this all the time. Do yourself a favour and provide some code, as you've implemented this wrong somehow. On second thoughts search the forum before being rude to someone.

I'm sorry that I came off as rude.

However I am 100% in the wrong. My first test was running it as a script which the msgbox worked, but @AutoItExe returned the path to AutoIt.exe in my programfiles.

Second test I compiled and ran as an exe and the msgbox didn't work. At that point I was convinced that what was stated about @AutoItExe was wrong.

After you rebutted, I did a third test checking @AutoItExe from a compiled exe via TrayTip() and sure enough, it pointed to my compiled exe.

The following is the code used:

Run(@AutoItExe & ' /AutoIt3ExecuteLine "msgbox(64 + 262144, @ScriptName, ''Connection Re-Established!'')"')

EDIT: To note... none of the examples included the command being ran inside a function via AdLibRegister(). It's set to run every 15 seconds, and it completes in under 2 seconds when the function initiates. The msgbox is called at the very tail end.

EDIT2: Adding full code. Had to remove sensitive information:

#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Outfile=..LoginScript.exe
#AutoIt3Wrapper_Res_requestedExecutionLevel=asInvoker
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#include <Misc.au3>
AdlibRegister("_CheckDriveMaps", 15000)

While 1
    Sleep(10)
    If _IsPressed("1B") Then Exit
WEnd

Func _CheckDriveMaps()
    Local $sMsg = "", $sError = ""
    Static Local $iSilent = False
    If DriveStatus("x:") = "INVALID" And Not $iSilent Then ; No access to X drive and silent switch enabled
        If _LoudCheckDriveMaps($sMsg, $sError) Then ; run the drive map checker with messages
            Return True
        Else
            $iSilent = True
            Return False
        EndIf
    ElseIf DriveStatus("x:") = "INVALID" And $iSilent Then
        If _SilentCheckDriveMaps($sMsg, $sError) Then  ; else run the drive map checker without messages
            $iSilent = False ; if it checks out, resets the silent switch
            Return True
        Else
            Return False
        EndIf
    EndIf
EndFunc

Func _SilentCheckDriveMaps(ByRef $sMsg, ByRef $sError)
    DriveMapDel("x:")
    If Not DriveMapAdd("x:", "192.168.0.1tmp", 0, @ComputerName & "" & @UserName, @UserName) Then
        If Not Ping("192.168.0.1") Then
            Return False
        Else
            If DriveMapAdd("x:", "192.168.0.1tmp", 0, @ComputerName & "" & @UserName, @UserName) Then
                Run(@AutoItExe & ' /AutoIt3ExecuteLine "msgbox(64 + 262144, @ScriptName, "Connection Re-Established!")"')
                Return True
            Else
                Return False
            EndIf
        EndIf
    Else
        Run(@AutoItExe & ' /AutoIt3ExecuteLine "msgbox(64 + 262144, @ScriptName, "Connection Re-Established!")"')
        Return True
    EndIf
EndFunc

Func _LoudCheckDriveMaps(ByRef $sMsg, ByRef $sError)
    $sIntro = "Connection to x: drive lost..." & @CRLF & @CRLF
    $hSplash = SplashTextOn(@ScriptName, $sIntro, @DesktopWidth / 2, @DesktopHeight / 2, 0, 200)
    $sMsg = "Clearing x: drive from network map..." & @CRLF
    ControlSetText(@ScriptName, "", $hSplash, $sIntro & $sMsg)
    DriveMapDel("x:")
    If Not DriveMapAdd("x:", "192.168.0.1tmp", 0, @ComputerName & "" & @UserName, @UserName) Then
        _CheckDriveMapAddError(@error, $sError)
        $sMsg&= "Failed to map the X drive. " & $sError & @CRLF
        ControlSetText(@ScriptName, "", $hSplash, $sIntro & $sMsg)
        $sMsg&= "Pinging server (192.168.0.1)..." & @CRLF
        ControlSetText(@ScriptName, "", $hSplash, $sIntro & $sMsg)
        If Not Ping("192.168.0.1") Then
            $sMsg&= "server (192.168.0.1) PING FAILED..." & @CRLF
            ControlSetText(@ScriptName, "", $hSplash, $sIntro & $sMsg)
            SplashOff()
            msgbox(16 + 262144, @ScriptName, "We cannot reconnect you to your X drive. Please contact ACIS.")
            Return False
        Else
            $sMsg&= "server (192.168.0.1) PING SUCCESSFUL!" & @CRLF
            ControlSetText(@ScriptName, "", $hSplash, $sIntro & $sMsg)
            If Not DriveMapAdd("x:", "192.168.0.1tmp", 0, @ComputerName & "" & @UserName, @UserName) Then
                _CheckDriveMapAddError(@error, $sError)
                $sMsg&= "Still won't connect to the X drive..." & $sError & @CRLF
                ControlSetText(@ScriptName, "", $hSplash, $sIntro & $sMsg)
                Sleep(2000)
                SplashOff()
                msgbox(16 + 262144, @ScriptName, "We cannot reconnect you to your X drive. Please contact ACIS and show them this message." & @CRLF&@CRLF& _
                    $sIntro & $sMsg)
                Return False
            Else
                Run(@AutoItExe & ' /AutoIt3ExecuteLine "msgbox(64 + 262144, @AutoItExe, ''Connection Re-Established!'')"')
;~                 msgbox( 64 + 262144, @ScriptName, "Connection Re-established!")
                Return True
            EndIf
        EndIf
    Else
        $sMsg&= "Drive map successful!"
        ControlSetText(@ScriptName, "", $hSplash, $sIntro & $sMsg)
        SplashOff()
        TrayTip(@ScriptName, @AutoItExe, 10)
        Run(@AutoItExe & ' /AutoIt3ExecuteLine "msgbox(64 + 262144, @AutoItExe, ''Connection Re-Established!'')"')
    EndIf
EndFunc

Func _CheckDriveMapAddError(Const $iError, ByRef $sError)
    Switch $iError
        Case 1
            $sError = "Undefined error. The following error was returned from the Windows API:" & @CRLF & "'" & @extended & "'" & @CRLF & @CRLF
        Case 2
            $sError = "Access to the remote share was denied" & @CRLF
        Case 3
            $sError = "The device is already assigned" & @CRLF
        Case 4
            $sError = "Invalid device name" & @CRLF
        Case 5
            $sError = "Invalid remote share" & @CRLF
        Case 6
            $sError = "Invalid password" & @CRLF
    EndSwitch
EndFunc

At the end of _LoudCheckDriveMaps() is where it's hitting.

Edited by Mechaflash

Spoiler

“Hello, ladies, look at your man, now back to me, now back at your man, now back to me. Sadly, he isn’t me, but if he stopped using ladies scented body wash and switched to Old Spice, he could smell like he’s me. Look down, back up, where are you? You’re on a boat with the man your man could smell like. What’s in your hand, back at me. I have it, it’s an oyster with two tickets to that thing you love. Look again, the tickets are now diamonds. Anything is possible when your man smells like Old Spice and not a lady. I’m on a horse.”

 

Share this post


Link to post
Share on other sites
guinness

Understand not everyone comes from an 'English speaking country' or has knowledge of what 'lol' actually means, plus if I'm frank, it's an overused abbreviation/expression anyway. I find it similar to the ever popular 'no offence but...' line, as clearly you're offending the person but trying to soften the blow with a pre-emptive warning.

I also would have expected someone who works in 'IT' to know better than to call someone an outright 'LIAR' before doing the appropriate testing, which you exhibited here. I also pointed you in many directions to working code that is used by so many users, so was stunned to find it didn't work without providing your 'test code', which clearly it did. Have a nice day.


UDF List:

 
_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_ArrayFilter/_ArrayReduce_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_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()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_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_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 22/04/2018

Share this post


Link to post
Share on other sites
Mechaflash

Well if it means anything at this point in time, I am very sorry that I have offended you with my post. I should've thought twice before posting it in the verbiage that I had chosen in order try and get a playful effect out of it, which clearly it did not. If you don't care to assist me any further, I would not blame you for it. However, I would much appreciate it if you could find a way to forgive me for my idiotic act and assist me further.


Spoiler

“Hello, ladies, look at your man, now back to me, now back at your man, now back to me. Sadly, he isn’t me, but if he stopped using ladies scented body wash and switched to Old Spice, he could smell like he’s me. Look down, back up, where are you? You’re on a boat with the man your man could smell like. What’s in your hand, back at me. I have it, it’s an oyster with two tickets to that thing you love. Look again, the tickets are now diamonds. Anything is possible when your man smells like Old Spice and not a lady. I’m on a horse.”

 

Share this post


Link to post
Share on other sites
Mechaflash

I also tried switching Run() to RunWait() and it creates the same effect (probably because AdLibRegister() [again] doesn't wait for any function to finish)


Spoiler

“Hello, ladies, look at your man, now back to me, now back at your man, now back to me. Sadly, he isn’t me, but if he stopped using ladies scented body wash and switched to Old Spice, he could smell like he’s me. Look down, back up, where are you? You’re on a boat with the man your man could smell like. What’s in your hand, back at me. I have it, it’s an oyster with two tickets to that thing you love. Look again, the tickets are now diamonds. Anything is possible when your man smells like Old Spice and not a lady. I’m on a horse.”

 

Share this post


Link to post
Share on other sites
Mechaflash

I went ahead and switched from using message boxes to traytips for the time being. Still would like to know why it doesn't work however.

@CaptainClucks Since it's unstable, I won't bother using it. The application will be distributed to multiple machines running x86 and x64 flavors of both Windows XP and Windows 7

@BrewMan Then I would think that the msgbox line would work for this case? But I think what's getting in the way is the fact that it's a registered function.


Spoiler

“Hello, ladies, look at your man, now back to me, now back at your man, now back to me. Sadly, he isn’t me, but if he stopped using ladies scented body wash and switched to Old Spice, he could smell like he’s me. Look down, back up, where are you? You’re on a boat with the man your man could smell like. What’s in your hand, back at me. I have it, it’s an oyster with two tickets to that thing you love. Look again, the tickets are now diamonds. Anything is possible when your man smells like Old Spice and not a lady. I’m on a horse.”

 

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  

×