pad.mattdiesel.co.uk

Snippet - Run file with Sandboxie using autoit

Run file with Sandboxie using autoit (AutoIt)

Answer to http://stackoverflow.com/questions/22896004/run-file-with-sandboxie-using-autoit/22917567?noredirect=1
Created 2014-04-07 18:09:50.853170 by Matt.
Modified 2014-04-07 18:15:29.287210 by Matt.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
Local $sFolder = "C:\Sandbox\12313\DefaultBox\user\current\My Documents\iMacros\Downloads\"
Local $sFilePattern = "Buble_Hit_*.exe"

Local $sFile = _FindFile($sFolder & $sFilePattern)
If @error Then
	MsgBox(0, "Not Found", "Couldn't find the file to run.")
	Exit
EndIf

Run($sFile, $sFolder)


Func _FindFile($wildcard)
	Local $hSearch = FileFindFirstFile($wildcard)
	If $hSearch = -1 Then Return SetError(1, 0, "")

	Local $ret = FileFindNextFile($hSearch)
	Local $found = Not @error
	FileClose($hSearch)

	If Not $found Then Return SetError(1, 0, "")
	Return $ret
EndFunc   ;==>_FindFile