Jump to content

run notepad++ and receive parameter from command line


jloyzaga
 Share

Recommended Posts

I can run this and notepad++ opens the file Run("C:\Program Files (x86)\Notepad++\notepad++.exe E:\icare\icare\NI-WI-NBSE-ERR.xml")

But what I want is to run the .au3 or exe from command line and send it the file as parameter -am I being to simplistic in hoping its this easy?

#include <FileConstants.au3>
#include <MsgBoxConstants.au3>
#include <Array.au3>
#include <File.au3>
;E:\icare\icare\NI-WI-NBSE-ERR.xml
;Run("C:\Program Files (x86)\Notepad++\notepad++.exe E:\icare\icare\NI-WI-NBSE-ERR.xml")

Run("C:\Program Files (x86)\Notepad++\notepad++.exe " & $CmdLine[0] )
sleep (200)
Send("{CTRLDOWN}a{CTRLUP}")
sleep (500)
Send("{CTRLDOWN}a{CTRLUP}{CTRLDOWN}s{CTRLUP}{CTRLDOWN}{SHIFTDOWN}b{CTRLUP}{SHIFTUP}")
sleep (500)
Send("{CTRLDOWN}{ALTDOWN}s{ALTUP}{CTRLUP}")
sleep (500)
Send("E:\icare\icare\NI_WI_MONTHLY_INSTALMENTS_c2base64-7.txt")
sleep (500)
Send("{ENTER}")

 

Link to comment
Share on other sites

CmdLine[0] is the count, you need to use CmdLine[1]

Also you can use ^ in place of Control + in place of Shift so something like this:

If $CmdLine[0] > 0 Then
    If FileExists($CmdLine[1]) Then
        Run(@ProgramFilesDir & '\Notepad++\notepad++.exe "' & $CmdLine[1] & '"')
        Send("^a")
        Send("^a^s^+b")
        sleep (500)
        Send("^!s")
        sleep (500)
        Send("E:\icare\icare\NI_WI_MONTHLY_INSTALMENTS_c2base64-7.txt")
        sleep (500)
        Send("{ENTER}")
    EndIf
EndIf

 

Edited by Subz
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

×
×
  • Create New...