Jump to content

'Run' only works on C: drive


Recommended Posts

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??

Link to comment
Share on other sites

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).

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

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...

Link to comment
Share on other sites

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.

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...