Sign in to follow this  
Followers 0
vk41

regarding on opening a custom file in notepad++

3 posts in this topic

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

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

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

Share this post


Link to post
Share on other sites

Thanks @Smoke_N. I will try it out. 

I have just started with basics. Let me see.

Thanks once again ! 

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  
Followers 0