AutoHotkey Community

It is currently May 26th, 2012, 6:31 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 11 posts ] 
Author Message
PostPosted: June 9th, 2009, 1:04 pm 
Offline

Joined: February 24th, 2009, 9:43 am
Posts: 12
I am trying to create a script that will open all the text files from the current folder I have open and Save As UTF-8 but I can't even get the files to open. Can I get some help?

Code:
#g::
Run Danish.txt
Sleep 150
Send ^s
WinWait Save As
Send !e{down 4}{tab}
Sleep 150
Run Norwegian.txt
Sleep 150
Send ^s
WinWait Save As
Send !e{down 4}{tab}
sleep 150
Run Swedish.txt
Sleep 150
Send ^s
WinWait Save As
Send !e{down 4}{tab}
return


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 9th, 2009, 1:15 pm 
Offline

Joined: October 9th, 2008, 6:04 am
Posts: 180
Location: Finland
is this what u r looking for:

Code:
Run, %A_WorkingDir%\something.txt

_________________
was i wrong, it makes me a very sad panda!


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 9th, 2009, 1:22 pm 
Offline

Joined: February 24th, 2009, 9:43 am
Posts: 12
Nope, I tried

Code:
Run,%A_WorkingDir%\Danish.txt

And that didn't open it either


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 9th, 2009, 1:24 pm 
Offline

Joined: October 9th, 2008, 6:04 am
Posts: 180
Location: Finland
uh, sorry i misunderstood what u were askin =P

_________________
was i wrong, it makes me a very sad panda!


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 9th, 2009, 2:25 pm 
Offline

Joined: February 24th, 2009, 9:43 am
Posts: 12
I am not having much luck with this at all.

What I want to do is open any txt files in the current active folder and save them as UTF-8

Any help please?


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 9th, 2009, 4:00 pm 
Offline

Joined: February 24th, 2009, 9:43 am
Posts: 12
Alternatively, is there a way to open selected files?

I think I am going to have another problem as there doesn't seem to be a shortcut for the Save As in Notepad but if I can resolve one step at a time instead of pulling my hear out.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 10th, 2009, 6:07 am 
Offline

Joined: October 9th, 2008, 6:04 am
Posts: 180
Location: Finland
dont know if this will help u either, but..
this open all txt files from folder C:\test

Code:
Loop, C:\test\*.txt
  Run, %A_LoopFileFullPath%

_________________
was i wrong, it makes me a very sad panda!


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 10th, 2009, 7:18 am 
Offline

Joined: February 24th, 2009, 9:43 am
Posts: 12
That works by defining a folder but it doesn't help me as I need to open the txt files int eh active folder. I have to keep changing folders all the time so I need a way to loop through selected files or all files in the active open folder.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 10th, 2009, 7:44 am 
Offline

Joined: October 9th, 2008, 6:04 am
Posts: 180
Location: Finland
Its a little bit hard, but if you are always on the same part of the disk, like c:\, then this might work for you.

Code:
#g::
  WinGetActiveTitle, ActiveWindow
  IfExist, C:\%ActiveWindow%\
  {
    Loop, C:\%ActiveWindow%\*.txt
      Run, %A_LoopFileFullPath%
  }   
Return

_________________
was i wrong, it makes me a very sad panda!


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 10th, 2009, 7:48 am 
Offline

Joined: February 24th, 2009, 9:43 am
Posts: 12
Thanks, I will give that a try.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 10th, 2009, 7:53 am 
This may work for you (since you said they're all in different folders), I'm not exactly sure what you want to do.

Make some files to test on before you go screwing with the real stuff. Also, when you do go working with the real files, make sure to make backups first...just incase.

Just so you understand, I recorded alot of this with the AutoScriptWriter. All it does is run each .txt file in the folder you have currently active, and re-save them using the UTF-8 format using keyboard shortcuts.

Code:
SetTitleMatchMode, 2

^+c::
{
controlgettext, path, Edit1, A
loop, %path%\*.txt,
{
run, %A_LoopFileFullPath%
WinWait, Notepad,
IfWinNotActive, Notepad, , WinActivate, Notepad,
WinWaitActive, Notepad,
MouseClick, left,  112,  13
Sleep, 100
Send, {ALTDOWN}{ALTUP}{ENTER}{DOWN}{DOWN}{DOWN}{ENTER}
WinWait, Save As,
IfWinNotActive, Save As, , WinActivate, Save As,
WinWaitActive, Save As,
Send, {TAB}{TAB}{TAB}{TAB}{DOWN}{DOWN}{DOWN}{ENTER}{LEFT}{ENTER}
WinWait, Notepad,
IfWinNotActive, Notepad, , WinActivate, Notepad,
WinWaitActive, Notepad,
Send, {ALTDOWN}{F4}{ALTUP}
}
}


Report this post
Top
  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 11 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: rbrtryn, SKAN and 55 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group