Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to can use "for" to save multiple files with diff. names
#1
Goal:
I have something stored in clipboard and want to save it as a text file using Notepad to paste it.
Then I want to save with a new name each time I store something new in clipboard and paste to a new Notepad.
For this purpose, I thought in naming the files with numbers and using the command for to run the loop until the number of events are finished.

My trial:
Below you find how I was trying to solve the problem:

Code:
Copy      Help
int i = 1
int j = 5
for(i 1 j);
    out i
run "notepad.exe"
'Cv             ;; Ctrl+V
'A{}            ;; Alt
'fa             ;; F A
'"i" Y        ;; File Name and Enter

Problem: When I run the code above I obtain a list of numbers in the output window from QM and only one file is saved with the name i.txt instead of multiple files named as 1.txt, 2.txt, 3.txt and 4.txt as I've wished to obtain.

I wonder if someone could help me to fix this issue.
Thanks in advance
Emerson
#2
without notepad
Macro Macro1830
Code:
Copy      Help
int i j=5
for(i 1 j)
,out i
,str s.getclip
,s.setfile(F"$desktop$\test save files {i}.txt")

with notepad
Macro Macro1831
Code:
Copy      Help
int i j=5
for(i 1 j)
,out i
,int w
,run "notepad.exe" "" "" "" 0x2800 win("Untitled - Notepad" "Notepad") w
,'Cv             ;; Ctrl+V
,'A{fa}            ;; Alt+F A
,str fileName.expandpath(F"$desktop$\test save files {i}.txt")
,'(fileName) Y      ;; File Name and Enter
,clo w


Forum Jump:


Users browsing this thread: 1 Guest(s)