Jump to content

regarding on opening a custom file in notepad++


vk41
 Share

Recommended Posts

This is my task which I am doing in AutoIT. Basic Info : I have a folder name "vk" and it has 5 subfolders named vk1 vk2 vk3 vk4 vk5. Each Subfolder has a file ,basically a keil project. Like

vk1 has first.uvproj

vk2 has sec.uvproj

vk3 has third.uvproj

and so on..

Now my requirement is to write a script where in the script has to go in vk1,vk2,vk3,vk4,vk5 folders and

open first.uvproj in notepad++
Do some operation
Close it

Next it has to open sec.uvproj
Do some operation
Close it

Next it has to open
third.uvproj
Do some operation
Close it and so on..

Till now I have done this for one file using paths hardcoded.

Here is a script

$notepad_pp_path = 'C:\Program Files\Notepad++\notepad++.exe'
$uvproj_path = 'K:\vk\vk1\vk1.uvproj'


Local $iPID = Run($notepad_pp_path)
Sleep(500)
;~ ; Wait for the Notepad become active
WinWaitActive("[Class:Notepad++]")
Sleep(500)


If WinWait("Open","",$time_stamp) then
   Sleep(500)
   WinActivate("Open","")
   Sleep(500)
   ControlSetText("Open","","Edit1",$uvproj_path)
   Sleep(1000)
   ControlClick("Open","","[CLASS:Button; TEXT:&Open]")
   Sleep(1000)
   ;Click on language and select xml
   Send("!{L}")
   Sleep(1000)
...
...
...
   ProcessClose($iPID)
Endif
 

How to make it happen for all other folders.

Can any one help ?

Thanks

Link to comment
Share on other sites

  • Moderators

_FileListToArrayRec is what you'll first need.

But here's a very silly question (well not silly to me), why don't you just use the FileRead (to a string), make changes to the string, FileWrite changes back (you'll have to delete old content or rename it to .bak extension as a backup (safer))?

Edit:

This would avoid having to use notepad++ totally.

Edited by SmOke_N

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

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