AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Noob help on using txt files to fill in names

 
Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
Libby71



Joined: 11 Mar 2010
Posts: 1

PostPosted: Thu Mar 11, 2010 3:39 am    Post subject: Noob help on using txt files to fill in names Reply with quote

I have a text file with names in descending chronological order, such as:
001
002
ect... up tp 100
I want to open up my program, change the name to the first text file name 001, and save as 001, then close. Then do it again using 002, ect until all the names on the text file have been saved. What code would you recommend doing this? Any help would greatly be appreciated. thank you.
Back to top
View user's profile Send private message
TLM



Joined: 21 Aug 2006
Posts: 2926
Location: The Shell

PostPosted: Thu Mar 11, 2010 4:24 am    Post subject: Re: Noob help on using txt files to fill in names Reply with quote

Libby71 wrote:
I have a text file with names in descending chronological order..
You don't need a text file for this part. You could simply create a variable with an ascending name like this:
Code:
fileExt = .txt ; Change the extension to the desired one.
varName := 1001
Loop, 100
{
   tooltip % "FileName: " currentFile := SubStr(varName++,2,3) fileExt
   ; currentFile is the variable that holds the file number.
   sleep, 80
}


Libby71 wrote:
I want to open up my program, change the name to the first text file name 001, and save as 001, then close. Then do it again using 002, ect until all the names on the text file have been saved. What code would you recommend doing this? Any help would greatly be appreciated. thank you.
It would be a good idea to do the 'fill in the save dialog with the variable part' separately then add it to the loop process. Something like this:
Code:
fileExt = .txt ; Change the extension to the desired extension.
varName := 1001
Loop, 100
{
   Send, {CTRLDOWN}s{CTRLUP} ; Or command to open the save dialog.

   WinWait, Save As,
   IfWinNotActive, Save As, , WinActivate, Save As,
   WinWaitActive, Save As,

   currentFile := SubStr(varName++,2,3) fileExt

   ControlSetText, Edit1, % currentFile, ahk_class #32770
   ControlGetText, controlText, Edit1, % currentFile, ahk_class #32770

   if !(controlText)
      ControlClick, Button2, ahk_class #32770

   WinWaitClose
   sleep, 80
}
If you need more help with this, please let us know what application your trying to save from.

hth
_________________
paradigm.shift:=(•_•)┌П┐RTFM||^.*∞
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group