Jump to content

Opening a custom file in notepad++


vk41
 Share

Recommended Posts

Hi,

I have a single file (which is not a text file), the file is name1.uvproj(basically this is keil uvision project file) . I want to open name1.uvproj using notepad++.

So far I am lucky enough to open it using RUN () command. But I have hardcoded the path here, I do not want to hardcode it.

Script.au3

Run('C:\Program Files\Notepad++\notepad++.exe' &' K:\vijay\name1.uvproj')
This works fine.No issues here.

But I if I modify the script slightly, then it doesnt work.

Script1.au3

$notepad_path = 'C:\Program Files\Notepad++\notepad++.exe'
$file_path = 'K:\vijay\name1.uvproj'

Run($notepad_path & $file_path)
This wont work.

I dont want to hardcode the path like I did in script.au3

Can any one help me out with this.

 

 

 

Link to comment
Share on other sites

  • Moderators

His path to notepad has a space in it.  He needs to wrap that in quotes as well.

Run('"' & $notepad_path & '" "' & $file_path & '"')

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

@vk41 - You could also benefit from checking out directory macros (@ProgramFilesDir), especially with SciTE and auto-complete.

As well as that, when troubleshooting or testing, you should be using either a MsgBox or the console to check on the status of your path variables. This should always be your first step, as it will show things like missing spaces and whether quotes etc are correct ... though it won't tell you if you forget to use them at all.

Edited by TheSaint

Make sure brain is in gear before opening mouth!
Remember, what is not said, can be just as important as what is said.

Spoiler

What is the Secret Key? Life is like a Donut

If I put effort into communication, I expect you to read properly & fully, or just not comment.
Ignoring those who try to divert conversation with irrelevancies.
If I'm intent on insulting you or being rude, I will be obvious, not ambiguous about it.
I'm only big and bad, to those who have an over-active imagination.

I may have the Artistic Liesense ;) to disagree with you. TheSaint's Toolbox (be advised many downloads are not working due to ISP screwup with my storage)

userbar.png

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