ur

How to check whether a file copied completely?

8 posts in this topic

There is a build machine in the network where it will automatically download the code from source repository and compile using visual studio and compresses the complete code in a zip file.

I have added a line at the end of the build script(written in python on that machine) to copy that zip file to my ESX Virtual machine.

Where I kept a AutoIT exe to wait for the zip file, once it is copied then I will extract the contents and find only the dll files in the extracted folder and do the Install creation using Installshield silently and copy the created setup files to anther machine.

I wrote the script till the setup files creation.

 

But now the problem is, when the zip file is copying through network, the autoit script is detecting it even the copy is still in progress and trying to extract the zip file and failing.

Even when I am checking whether the file in use is not working.

 

Any suggestion on how to check whether the copy is completed.?

Share this post


Link to post
Share on other sites



FileGetSize to compare the size from thee network and the file on the machine. When they match the file is copied completely and can be extracted.

Share this post


Link to post
Share on other sites
14 minutes ago, InunoTaishou said:

FileGetSize to compare the size from thee network and the file on the machine. When they match the file is copied completely and can be extracted.

We can't access the server machine shared folders as they are restricted, only our machines can e accessed through server machine, so I am copying the file from there itself to my machine.

Is there anyway to check in our machine itself instead of accessing the server machine?

Share this post


Link to post
Share on other sites

How is your machine going to know everything is copied when it doesn't know big the file is supposed to be?

You could try adding another some more code on the machine sending the file to send to your machine that it's done when it's done copying. Open a TCP connection and send a finished value when it's done copying?

You could try

_WinAPI_FileInUse

It might return true if the file is being recognized as still downloading.

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

One method that I have used, is to check the file size or modified time in a loop and when the value has not changed for a certain period of time, it should then be safe to assume that the download has completed.

Edited by Bowmore

"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to build bigger and better idiots. So far, the universe is winning."- Rick Cook

Share this post


Link to post
Share on other sites
On 11/20/2016 at 9:57 PM, Bowmore said:

One method that I have used, is to check the file size or modified time in a loop and when the value has not changed for a certain period of time, it should then be safe to assume that the download has completed.

Thanks Bowmore,I will try this approach.

If possible, can you please share that part of your code.

Share this post


Link to post
Share on other sites

How about this?

You python script copies first the zip file, and then a 'token.txt' file... Your AutoIt script waits not for the zip, but instead for the txt file.

Logically, the txt can only be created/copied AFTER the zip file...

When the AutoIt script finds the txt, it now knows the zip must exist, deletes the txt (as a cleanup for the next cycle) and proceeds to process the zip...

This way everything will only start once the zip has been copied in full, without having the check Windows process etc.

-Skysnake


Skysnake

Why is the snake in the sky?

Share this post


Link to post
Share on other sites

This is the sort of thing I have used .

#include <FileConstants.au3>


Global $sFilepath = "P:\Users\Roy Kirby\Pictures\Africa 2002\01\2002-05_slide_02.tif"

; $stablefor  and $iTmeout values are in seconds
; use values appropriate for the time the file is expected to take to download or copy
If CheckFileIsStable($sFilepath, 30, 300) Then
    MsgBox(0, "CheckFile", $sFilepath & " - has been stable for at least 30 seconds so it has probably finished copying")
Else
    MsgBox(0, "CheckFile", $sFilepath & " - has not been stable for at least 30 seconds in the last 5 minutes so it has probably stil copying")
EndIf

Func CheckFileIsStable($sFilepath, $stablefor = 60, $iTmeout = 1800)
    Local $sPrevFileTime = "A"
    Local $sFileTime = ""
    Local $iPrevFileaize = -1
    Local $iFilesize = 0
    Local $bFileIsStable = False
    Local $iTimeoutTimer = TimerInit()

    Do
        $iFilesize = FileGetSize($sFilepath)
        If @error = 0 Then
            $sFileTime = FileGetTime($sFilepath, $FT_MODIFIED, $FT_STRING)
            If @error = 0 Then
                If ($sPrevFileTime = $sFileTime) And ($iPrevFileaize = $iFilesize) Then
                    ; File has not changed since last check
                    $bFileIsStable = True
                Else
                    $sPrevFileTime = $sFileTime
                    $iPrevFileaize = $iFilesize
                    Sleep($stablefor * 1000)
                EndIf
            EndIf
        EndIf
    Until $bFileIsStable Or TimerDiff($iTimeoutTimer) > ($iTmeout * 1000)

    Return $bFileIsStable

EndFunc   ;==>CheckFileIsStable

 


"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to build bigger and better idiots. So far, the universe is winning."- Rick Cook

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

  • Similar Content

    • ogloed
      By ogloed
      Again, I'm struggling with DllCall(). So I have this MS C++ 6.0 compiled DLL and a manual for it. There's a function:
       
      Get information of disk arrays Declaration: VINT vr_get_array_info (VINT array_index, vr_array_info_t* pinfo); Description: Application can fetch the information of one specific disk array, which is located by index of all disk arrays in current system. Input parameters: VINT array_index : Index to all disk arrays in system, specify which disk array. vr_array_info_t *pinfo : 14 Pointer to a vr_array_info_t data structure to get the information Return value: VR_SUCCESS : Get the information successfully. VR_ERR_NOT_INITED : Raid lib hasn’t been initialized. VR_ERR_INVALID_INDEX : The input index is invalid. VR_ERR_INVALID_PARAM : Input parameter is invalid: the pointer is NULL. Here's what DLL Export Viewer says:
       
      Function Name     : int __cdecl vr_get_array_info(int,struct _vr_array_info *)
      Here's what is this _vr_array_info:
       
      typedef struct _vr_array_info { VWORD status; // current status of disk array VBYTE raidType;// same as Disk_Array.raidType, but value 0xFF means // a stand-alone disk. When it's a stand-alone disk, // only arDevices[0] and diskNum has meaning, and diskNum should // always be 1 . VBYTE diskNum;// count of valid arDevices[] members. // Note: disk array maybe incomplete, i.e. , some disk in the array maybe missing, // corresponding device ptr arDevices[i]->pRealDevice should be NULL. VDWORD capacityLow;// (Unit: sector) VDWORD capacityHigh;// (Unit: sector) // following 8 bytes define the real-capcity (in sector) of every disk in array VDWORD realCapacityLow; // (Unit: sector) VDWORD realCapacityHigh; // (Unit: sector) VDWORD stripeSize; // valid when raid is raid0, raid5 or raid01, in Kbytes VDWORD blockSize; // valid when raid is RAID5, in Kbytes VBOOL bNeedMigration; // the raid need migration // only valid when raid0/raid5/matrixRaid VBOOL bNeedInit; // the raid need initialization, only valid for RAID5 VBOOL bOptimized; // only for RAID5, this RAID5 access was optimized VBYTE systemDisk; /* does the devices within this disk array contain system files of current running OS ? the probably value are: VR_DEVICE_NOT_SYS_DISK VR_DEVICE_MAYBE_SYS_DISK VR_DEVICE_SYS_DISK they are defined in this file */ VWORD raid_index;// only raid index, no meaning with stand-alone disk VINT index; // all device index, including all raid and stand-alone disk } vr_array_info_t;

      Here's my code (function names are actually decorated, so):
       
      Local $pTest $hDLL = DllOpen(@ScriptDir & "\drvInterface.dll") ;~ VINT vr_init (void); ConsoleWrite("vr_init..." & @CRLF) $sTest = DllCall($hDLL, "int:cdecl", "?vr_init@@YAHXZ") ;~ VINT vr_get_controller_num (VINT *pnumber); ConsoleWrite("vr_get_controller_num..." & @CRLF) $sTest = DllCall($hDLL, "int:cdecl", "?vr_get_controller_num@@YAHPAH@Z", "int*", "$pTest") $iControllerNumber = $sTest[1] ConsoleWrite("$iControllerNumber = " & $iControllerNumber & @CRLF) ;~ VINT vr_get_device_num (VINT *pnumber); ConsoleWrite("vr_get_device_num..." & @CRLF) $sTest = DllCall($hDLL, "int:cdecl", "?vr_get_device_num@@YAHPAH@Z", "int*", "$pTest") $iDeviceNumber = $sTest[1] ConsoleWrite("$iDeviceNumber = " & $iDeviceNumber & @CRLF) ;~ VINT vr_get_array_num (VINT only_raid, VINT *pnumber); ConsoleWrite("vr_get_array_num..." & @CRLF) $sTest = DllCall($hDLL, "int:cdecl", "?vr_get_array_num@@YAHHPAH@Z", "int", 0, "int*", "$pTest") $iArrayNumber = $sTest[2] ConsoleWrite("$iArrayNumber = " & $iArrayNumber & @CRLF) $vr_array_info = DllStructCreate("ushort status;byte raidType;byte diskNum;dword capacityLow;dword capacityHigh;dword stripeSize;dword blockSize;boolean bNeedMigration;boolean bNeedInit;boolean bOptimized;byte systemDisk;byte raid_index;int index") ;~ VINT vr_get_array_info (VINT array_index, vr_array_info_t* pinfo); ConsoleWrite("vr_get_array_info..." & @CRLF) $sTest = DllCall($hDLL, "int:cdecl", "?vr_get_array_info@@YAHHPAU_vr_array_info@@@Z", "int", 0, "struct*", $vr_array_info) ;~ void vr_exit (void); ConsoleWrite("vr_exit..." & @CRLF) $sTest = DllCall($hDLL, "none", "?vr_exit@@YAXXZ") DllClose($hDLL) Exit Everything works fine up to vr_get_array_info part. This is where I get a "memory cannot be 'read'" Windows error ("Instruction at 0x7c93a514 referenced memory at 0x00000000").

      What am I doing wrong? Please help.
      drvInterface.dll
      ProgGuide.pdf
    • ogloed
      By ogloed
      Hello!
      There's a DLL, which I want to use in my script. There's the manual for that DLL. I'm trying to use any function from the manual in DllCall() and I get @error=3 ("function" not found in the DLL file). Why is that? How do I fix it?
      PEiD says that DLL is "Microsoft Visual C++ 6.0 DLL". Is that compatible with AutoIt? How do I use it? Please help.
       
      ProgGuide.pdf
      drvInterface.dll
    • caramen
      By caramen
      Hello Guys,
      I am trying to make a screenshoot copy it to clipboard and paste it into a word document i want to do that to simplify my procedures création. 
       
      I am trying to use the way of sending Keys "^c" & "^v" i tryed also CTRLDOWN and c but no one of these is working. 
       
      First question :
      Why that's not working? 
      Is there anyother way i can work with ?
       
      I watched the help file for FileCopy but it s only moving Files and not copy them. 
       
      Maybe you can see somthing going wrong in my script but i guess it s not a syntax problem. 
      #cs ---------------------------------------------------------------------------- AutoIt Version: 3.3.14.2 Author: myName Script Function: Template AutoIt script. #ce ---------------------------------------------------------------------------- ; Script Start - Add your code below here #include <ScreenCapture.au3> #include <MsgBoxConstants.au3> HotKeySet("{F2}", "Capture") HotKeySet("{F3}", "Windows") HotKeySet("{F4}", "Copy") Global $Numero = 0 Attendre () Capture() Func Capture() ; Capture full screen $Numero = $Numero+1 _ScreenCapture_Capture (@DesktopDir & "\ScreenCapture\Image"&$Numero&".jpg") ShellExecute( @DesktopDir &"\ScreenCapture\Image"&$Numero&".jpg") Sleep (500) Run("C:\WINDOWS\EXPLORER.EXE /Select, /n,/e," & @DesktopDir & "\ScreenCapture\Image"&$Numero&".jpg" ) WinWaitActive("ScreenCapture") Sleep(1500) Send("^c") ;~ Send ("{CTRLDOWN}") ;~ Sleep(10) ;~ Send ("C") ;~ Sleep(10) ;~ Send ("{CTRLUP}") EndFunc ;==>Example Func Windows () Global $Windows = WinGetTitle("[active]") MsgBox($MB_SYSTEMMODAL, "Windows", "Windows selected for copy is : "&@CRLF&$Windows) EndFunc Func Copy () WinActivate (""&$Windows) Sleep (100) Send("^v") ;~ Send ("{CTRLDOWN}") ;~ Sleep(10) ;~ Send ("V") ;~ Sleep(10) ;~ Send ("{CTRLUP}") EndFunc Func Attendre () While 1 Sleep (10) ;~ GUICreate ("Help",100,100) WEnd EndFunc  
    • junkew
      By junkew
      Since W8.1 (actually IE 11 with W7 will work also) microsoft has a Javascript runtime that can be called from scripting languages
      As shown in this example from C++: https://iobservable.net/blog/2013/11/12/introduction-to-jsrt/
      By loading either JSCRIPT9.DLL or CHAKRA.DLL you can embed ECMA JavaScript in your application
      And implemented here in AutoHotKey https://autohotkey.com/boards/viewtopic.php?f=6&t=5739
      Triggered by other threads: 
      https://www.autoitscript.com/forum/topic/185883-accessing-autoit-variables/ https://iobservable.net/blog/2013/11/12/introduction-to-jsrt/ https://www.autoitscript.com/forum/topic/184824-chakracore-udf-executing-javascript-in-autoit/ http://eclipsesource.com/blogs/2016/04/06/getting-started-with-microsoft-chakracore/
        This code is almost working but unfortunately not with the expected output. Someone seeing what is wrong? 
      It runs completely but gives ???? as output so I assume I get a pointer or something through which I should deal with using other JSRT functions
      ;~ https://iobservable.net/blog/2013/11/ #AutoIt3Wrapper_UseX64=N ; Create callback function. Local $hPrintf = DllCallbackRegister("_printf", "long", "wstr;long;wstr") ;~ #RequireAdmin Example() Func Example() Local $hJSRuntime = DllOpen("c:\windows\system32\jscript9.dll") Local $script = "native.printf('number=%#x string=%s\n', 255, 'test')" ;~ Local $script = "(()=>{return 'Hello world!';})()" ;~ Local $script = "var x='helloworld'; return x;" ;~ Local $script = "var x=10;" & @CRLF & "var y=11;" ;~ Local $script = "(42);" ;~ Local $script = "(" & @CRLF ;~ $script=$script & "host.echo(JSON.stringify({foo:'bar'}));)" & @CRLF ;~ $script=$script & "42 // The script's result :) "& @CRLF ;~ $script=$script & ")"& @CRLF ;~ $script=$script & "class Host {"& @CRLF ;~ $script=$script & " echo(s) {"& @CRLF ;~ $script=$script & " MsgBox %s%"& @CRLF ;~ $script=$script & " }"& @CRLF ;~ $script=$script & "}"& @CRLF Local $aResult Local $JsRuntimeVersion = -1 local $runtime local $context ;~ typedef void *JsRuntimeHandle; ;~ // Create a runtime. ;~ Edge mode signature STDAPI_(JsErrorCode) JsCreateRuntime( ;~ _In_ JsRuntimeAttributes attributes, ;~ _In_opt_ JsThreadServiceCallback threadService, ;~ _Out_ JsRuntimeHandle *runtime); ;~ Legacy mode signature ;~ STDAPI_(JsErrorCode) JsCreateRuntime( ;~ _In_ JsRuntimeAttributes attributes, ;~ _In_ JsRuntimeVersion version, ;~ _In_opt_ JsThreadServiceCallback threadService, ;~ _Out_ JsRuntimeHandle *runtime ;~ ); ;~ JsCreateRuntime(JsRuntimeAttributeNone, nullptr, &runtime); $aResult=DllCall($hJSRuntime, "int", "JsCreateRuntime", "int", 0, "int", $JsRuntimeVersion, "ptr", 0, "ptr*", $runtime) consolewrite("Error 1: " & @error & @CRLF) if @error=0 Then consolewrite($aResult[0] & ";" &$aResult[1] & ";" & $aResult[2] & ";" & $aResult[3]& ";" & $aResult[4] & @CRLF) $runtime=$aresult[4] EndIf ;~ // Create an execution context. ;~ // Edge mode signature ;~ STDAPI_(JsErrorCode) JsCreateContext( ;~ _In_ JsRuntimeHandle runtime, ;~ _Out_ JsContextRef *newContext); ;~ // Legacy mode signature ;~ STDAPI_(JsErrorCode) JsCreateContext( ;~ _In_ JsRuntimeHandle runtime, ;~ _In_ IDebugApplication *debugApplication, ;~ _Out_ JsContextRef *newContext ;~ ); ;~ JsCreateContext(runtime, &context); $aResult=DllCall($hJSRuntime, "int", "JsCreateContext", "ptr", $runtime, "ptr", 0 , "ptr*", $context) consolewrite("Error 2: " & @error & @CRLF) if @error=0 Then consolewrite($aResult[0] & ";" & $aResult[1] & ";" & $aResult[2] & ";" & $aResult[3] & @CRLF) $context=$aresult[3] EndIf ;~ // Now set the current execution context. ;~ STDAPI_(JsErrorCode) JsSetCurrentContext( ;~ _In_ JsContextRef context ;~ ); ;~ JsSetCurrentContext(context); $aResult=DllCall($hJSRuntime, "int", "JsSetCurrentContext", "ptr", $context) consolewrite("Error 3: " & @error & @CRLF) if @error=0 Then consolewrite($aResult[0] & ";" & $aResult[1] & @CRLF) EndIf ; Get the Global object for adding stuff ;~ STDAPI_(JsErrorCode) JsGetGlobalObject( ;~ _Out_ JsValueRef *globalObject ;~ ); ;~ JsValueRef global; ;~ JsGetGlobalObject(&global); local $global $aResult=DllCall($hJSRuntime, "int","JsGetGlobalObject", "ptr*", $global) consolewrite("Error 4: " & @error & @CRLF) if @error=0 Then consolewrite($aResult[0] & ";" & $aResult[1] & @CRLF) $global=$aresult[1] EndIf ; Get a property ID for the name "host" ;~ STDAPI_(JsErrorCode) JsGetPropertyIdFromName( ;~ _In_z_ const wchar_t *name, ;~ _Out_ JsPropertyIdRef *propertyId ;~ ); ;~ DllCall("jscript9\JsGetPropertyIdFromName", "wstr", "host", "ptr*", hostPropertyId) ;~ local $hostPropertyID ;~ $aResult=DllCall($hJSRuntime, "int","JsGetPropertyIdFromName", "wstr", "host", "ptr*", $hostPropertyId) ;~ consolewrite("Error 5: " & @error & @CRLF) ;~ if @error=0 Then ;~ consolewrite($aResult[0] & ";" & $aResult[1] & ";" & $aResult[2] & @CRLF) ;~ EndIf ;~ JsPropertyIdRef nativeProp; ;~ JsGetPropertyIdFromName(L"native", &nativeProp); local $nativeProp $aResult=DllCall($hJSRuntime, "int","JsGetPropertyIdFromName", "wstr", "native", "ptr*", $nativeProp) consolewrite("Error 5: " & @error & @CRLF) if @error=0 Then consolewrite($aResult[0] & ";" & $aResult[1] & ";" & $aResult[2] & @CRLF) $nativeProp=$aresult[2] EndIf ;~ STDAPI_(JsErrorCode) JsCreateObject( ;~ _Out_ JsValueRef *object ;~ ); ;~ JsValueRef nativeObj; ;~ JsCreateObject(&nativeObj); local $nativeObj $aResult=DllCall($hJSRuntime, "int","JsCreateObject", "ptr*", $nativeObj) consolewrite("Error 6: " & @error & @CRLF) if @error=0 Then consolewrite($aResult[0] & ";" & $aResult[1] & ";" & @CRLF) $nativeObj=$aresult[1] EndIf ;~ JsPropertyIdRef printfProp; ;~ JsGetPropertyIdFromName(L"printf", &printfProp); local $printfProp $aResult=DllCall($hJSRuntime, "int","JsGetPropertyIdFromName", "wstr", "printf", "ptr*", $printfProp) consolewrite("Error 7: " & @error & @CRLF) if @error=0 Then consolewrite($aResult[0] & ";" & $aResult[1] & ";" & @CRLF) $printfProp=$aresult[2] EndIf ;~ JsValueRef printfFunc; ;~ JsCreateFunction(PrintFormat, nullptr, &printfFunc); local $printfFunc ;~ STDAPI_(JsErrorCode) JsCreateFunction( ;~ _In_ JsNativeFunction nativeFunction, ;~ _In_opt_ void *callbackState, ;~ _Out_ JsValueRef *function ;~ ); $aResult=DllCall($hJSRuntime, "int","JsCreateFunction", "ptr", DllCallbackGetPtr($hPrintf), "ptr*", 0, "ptr*", $printfFunc) consolewrite("Error 8: " & @error & @CRLF) if @error=0 Then consolewrite($aResult[0] & ";" & $aResult[1] & ";" & $aResult[2] & ";" & $aResult[3] & @CRLF) $printfFunc=$aresult[3] EndIf ;~ JsSetProperty(nativeObj, printfProp, printfFunc, true); ;~ STDAPI_(JsErrorCode) JsSetProperty( ;~ _In_ JsValueRef object, ;~ _In_ JsPropertyIdRef propertyId, ;~ _In_ JsValueRef value, ;~ _In_ bool useStrictRules ;~ ); $aResult=DllCall($hJSRuntime, "int","JsSetProperty", "ptr", $nativeObj, "ptr", $printfProp, "ptr", $printfFunc, "int", true) consolewrite("Error 9: " & @error & @CRLF) if @error=0 Then consolewrite($aResult[0] & ";" & $aResult[1] & ";" & $aResult[2] & ";" & $aResult[3] & @CRLF) EndIf ;~ JsSetProperty(global, nativeProp, nativeObj, true); $aResult=DllCall($hJSRuntime, "int","JsSetProperty", "ptr", $global, "ptr", $nativeProp, "ptr", $nativeobj, "int", true) consolewrite("Error 10: " & @error & @CRLF) if @error=0 Then consolewrite($aResult[0] & ";" & $aResult[1] & ";" & $aResult[2] & ";" & $aResult[3] & @CRLF) EndIf ;~ STDAPI_(JsErrorCode) JsCreateFunction( ;~ _In_ JsNativeFunction nativeFunction, ;~ _In_opt_ void *callbackState, ;~ _Out_ JsValueRef *function ;~ ); ; Get a JsValueRef for our Host object ;~ hostRef := ToJsValue(Host) ;~ $aResult=DllCall($hJSRuntime, "int","JsVariantToValue", "ptr", &variant, "ptr*", valref) ; Pass our Host object to the script engine ;~ DllCall("jscript9\JsSetProperty", "ptr", globalObject, "ptr", hostPropertyId, "ptr", hostRef, "int", true) ;~ // Run the script. ;~ STDAPI_(JsErrorCode) JsRunScript( ;~ _In_z_ const wchar_t *script, ;~ _In_ JsSourceContext sourceContext, ;~ _In_z_ const wchar_t *sourceUrl, ;~ _Out_ JsValueRef *result ;~ ); local $currentSourceContext=1 ;~ JsRunScript(script.c_str(), currentSourceContext++, L"", &result); local $result="" local $sourceURL="" $aResult=DllCall($hJSRuntime, "int", "JsRunScript", "WSTR", $script, "UINT*",$currentSourceContext, "wstr", "dummysource.js", "WSTR*", $result) consolewrite("Error 11: " & @error & @CRLF) if @error=0 Then consolewrite($aResult[0] & ";" & $aResult[1] & ";" & $aResult[2] & ";" & $aResult[3] & ";" & $aResult[4] & @CRLF) EndIf ;~ // Convert your script result to String in JavaScript redundant if your script returns a String ;~ JsValueRef resultJSString; ;~ STDAPI_(JsErrorCode) JsConvertValueToString( ;~ _In_ JsValueRef value, ;~ _Out_ JsValueRef *stringValue ;~ ); ;~ JsConvertValueToString(result, &resultJSString); ;~ $aResult=DllCall($hJSRuntime, "int", "JsConvertValueToString", "WSTR", $script, "long", 1, "WSTR*",0, "WSTR*", $result) ;~ consolewrite("Error 4: " & @error & @CRLF) ;~ if @error=0 Then ;~ consolewrite($aResult[0] & ";" & $aResult[1] & ";" & $aResult[2] & ";" & $aResult[3] & ";" & $aResult[4] & @CRLF) ;~ EndIf ;~ ;~ // Project script result back to C++. ;~ const wchar_t *resultWC; ;~ size_t stringLength; ;~ JsStringToPointer(resultJSString, &resultWC, &stringLength); ;~ wstring resultW(resultWC); ;~ cout << string(resultW.begin(), resultW.end()) << endl; ;~ system("pause"); ;~ // Dispose runtime ;~ JsSetCurrentContext(JS_INVALID_REFERENCE); ;~ JsDisposeRuntime(runtime); return 0; EndFunc ;==>Example ; Create callback function. ;~ JsValueRef CALLBACK PrintFormat(JsValueRef callee, bool isConstructCall, JsValueRef *arguments, unsigned short argumentCount, void *callbackState) ;~ { ;~ const wchar_t *format; ;~ size_t length; ;~ JsStringToPointer(arguments[1], &format, &length); ;~ VARIANT variant; ;~ JsValueToVariant(arguments[2], &variant); ;~ const wchar_t *str; ;~ JsStringToPointer(arguments[3], &str, &length); ;~ wprintf(format, variant.intVal, str); ;~ return JS_INVALID_REFERENCE; ;~ } func _printf($x, $y, $z) consolewrite("there we are") consolewrite($x) return 0 EndFunc  
    • odaylton
      By odaylton
      Text translated from Portuguese by google - please apologize for any errors
       
      Hello I would like to know how to open the window below
      The image is in Portuguese (my win XP)


      It is usually opened by the user through the Explorer
      1) right mouse button
      2) Open with ...
      3) Choose Program ...
      4) This window lets you choose a program from the list or use the browse button.
      So I want this
      I want the user to choose a program from the list of installed programs on the machine.
      Please, if there is a simpler way to get the list of installed programs in Windows favor of me a clue ...
      Thanks in advance