Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Please help: Replace selected file name with string
#1
Hi,

Please forgive my ignorance/newbish question. (I have tried hard to find an answer on my own...)

I was just about to break out the champagne (well, Guinness actually) on the completion of the first bit of my first real-application macro, but I can't get past one part.

Basically I'm using the stock/unmodified "BrowseForFolder" function to select a path/filename, returned as "s", to be renamed or copied with the string "zz" (derived from date+user-inputed text, re-formatted all lowercase and underscores replacing spaces).

ISSUES:
1. I get an error message saying "this destination does not support long file names" (see attached jpg) and asks me for a new name (for the sourcefile!!??) if the source file is more than a certain number of characters. Otherwise works well so far.

2. Is there a way to limit file selection to certain file types/extensions (e.g., MP3, WAV

This computer is running XP Pro, QM version 2.1.8.8

Thanks in advance for any and all help.

Cheers,

Steve Murphy

--------------
Here's the code if it helps, should run anywhere:

Code:
Copy      Help
;(a) = original text
;(t) = date
;(z) = lowercase(a)
;(u) = underscores instead of spaces in (z)
;(zz) final format (t_u.mp3)


str t zz a
t.time("%Y%m%d")
;...
;g1
;...


inp- a "Enter Event Name:" "FTP Uploader"
if a = 0
,
,if mes("Event Name Cannot Be Blank! Please Re-Enter." "Error:" "OC1xt")='O'
,,goto g1
str z=a
,z.lcase
str u=z
,u.replacerx(" " "_")
,zz.from("C:\qm\" t "_" u ".mp3")
,,
str s
,if(BrowseForFolder(s "c:\qm\" 1 "Select File"))
,,cop s zz
,,
,,
,,

,
,


Attached Files Image(s)
   
#2
BrowseForFolder usually is used only for folders. For files use OpenSaveDialog. It allows you to specify file types. You probably use BrowseForFolder because need both files and folders. You can download the latest Quick Macros version and use menus. Now menus can be used instead of standard file/folder selection dialogs, and you may find it faster. Usage examples - Run Program dialog (function TO_FileRun), Open Folder dialog, and some other dialogs from the floating toolbar.

Quote:I get an error message saying "this destination does not support long file names"

This message is not generated by QM. If long filenames are not supported, format the filename differently.

Quote:Is there a way to limit file selection to certain file types/extensions (e.g., MP3, WAV

BrowseForFolder does not allow it. Use OpenSaveDialog, or QM 2.2.0.9 and menu.
#3
Thanks, man. Fantastic app, btw...will definitely support, as well as pass the word.

I'll give the menus a try. Here's something interesting about that message: First, it's a message I've never seen before, nor have I had any trouble whatsoever regarding "long filenames". It's all moot anyway, since I no longer get the message since installing 2.2.0.9 (didn't try anything between).

I'm trying hard not to abuse question-asking privileges, and have made significant progress in other areas of El Macro del Diablo (I'll think about renaming once it actually works...). I hit another roadblock-- will start new topic.

Cheers,

Steve
#4
Quote:it's a message I've never seen before

I also never saw it, and have no ideas why it was in QM 2.1.8 and why disappeared in QM 2.2.0.


Forum Jump:


Users browsing this thread: 1 Guest(s)