Jump to content
Sign in to follow this  
spanznet

'Run' only works on C: drive

Recommended Posts

spanznet

stuck on one last little thing, my .exe will only execute this part of the code if it is run from my c: drive (Win7 x64).

Run(@WorkingDir & "\" & $SDDBname, @WorkingDir, @SW_SHOW)

if it is run from any other drive, it just hangs there and does nothing. Is there something better then @WorkingDir??

Share this post


Link to post
Share on other sites
hawky358

I assume you mean the folder in which the script is?

Use @scriptdir

Edited by hawky358

Share this post


Link to post
Share on other sites
spanznet

I assume you mean the folder in which the script is?

Use @scriptdir

yes, within the folder my .exe is run is another program (from $SDDBname) that needs to be run. just tried @ScriptDir and it has the same problem, works fine on C: drive but not any other drive (internal or external).

Share this post


Link to post
Share on other sites
hawky358

Maybe post the rest of the code, since both those Macros will work in all drives.

Share this post


Link to post
Share on other sites
spanznet

this is the whole function:

Func downloadSDDB()
    If $iniArray[8][0] = 1 Then  ; If "SD+AV Databases" is ticked
        $stringSplitArray = StringSplit(($iniArray[8][2]), "/") 
        $SDDBname = $stringSplitArray[$stringSplitArray[0]] 
        Run(@WorkingDir & "\" & $SDDBname, @WorkingDir, @SW_SHOW)
        WinWaitActive("Setup - Signature Database Download")
        Send("{ENTER}")
        WinWaitActive("Setup - Signature Database Download", "Signature Database Download Complete")
        Send("{ENTER}")
    EndIf
EndFunc

this being my first script, there is probably better ways of doing these things, but it all works great apart from this 'Run' only working on c: drive. I just tested on my housemates PC, also a Win7 x64, and the same problem there, only works on c: drive.

thanks for any advice.

Share this post


Link to post
Share on other sites
spanznet

interesting, I just tried on my netbook in Win7 Starter x86 and WinXP x86 and it WORKED in both when running from an ext hdd. Is this some kind of 64bit problem?

Share this post


Link to post
Share on other sites
water

As the command to be run is "calculated" during run time make sure the variable has the desired value.

Func downloadSDDB()
    If $iniArray[8][0] = 1 Then ; If "SD+AV Databases" is ticked
        $stringSplitArray = StringSplit(($iniArray[8][2]), "/") 
        $SDDBname = $stringSplitArray[$stringSplitArray[0]] 
        MsgBox(0,"","WorkingDir: " & @WorkingDir & @CRLF & "$SDDBName: " & $SDDBName)   ; <== Inserted
        Run(@WorkingDir & "\" & $SDDBname, @WorkingDir, @SW_SHOW)
        WinWaitActive("Setup - Signature Database Download")
        Send("{ENTER}")
        WinWaitActive("Setup - Signature Database Download", "Signature Database Download Complete")
        Send("{ENTER}")
    EndIf
EndFunc

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2018-06-01 - Version 1.4.9.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-01-27 - Version 1.3.3.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites
spanznet

getting more interesting, i inserted that extra line, the MsgBox clearly displayed exactly what I have been wanting it to do all along, and when i clicked OK... it ran! maybe it just needs a small delay for some reason...

Share this post


Link to post
Share on other sites
spanznet

Ok, I have managed to get this to run correctly on ext hdd by adding a 2 second sleep in between calculating the filename and executing it. weird, but it works. I increased a few hundred ms at a time and when i got to 2000 it worked straight away.

Func downloadSDDB()
    If $iniArray[8][0] = 1 Then  ; If "SD+AV Databases" is ticked
        $stringSplitArray = StringSplit(($iniArray[8][2]), "/") 
        $SDDBname = $stringSplitArray[$stringSplitArray[0]] 
        Sleep(2000)
        Run(@WorkingDir & "\" & $SDDBname, @WorkingDir, @SW_SHOW)
        WinWaitActive("Setup - Signature Database Download")
        Send("{ENTER}")
        WinWaitActive("Setup - Signature Database Download", "Signature Database Download Complete")
        Send("{ENTER}")
    EndIf
EndFunc

thanks to water. it was your informational MsgBox line that got me on the track to a solution.

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  

×