Running Macro from CMD line syntax ?

Help with writing and playing macros

Running Macro from CMD line syntax ?

Postby Trevor » Thu Dec 02, 2004 12:12 pm

I have a Macro that I've created to add a dummy row to the top of an HTM Table to get around some Microsoft glitch in determining variable type. I called the Macro "RemoveLines" and saved a MAC file to \\TOROON63724\d$\InetPub\ftproot\TIASftp\TIAS.MAC

I've tried a few variations, like below, and keep getting a syntax error.
Can someone help me with the correct syntax. Thanks.

C:\Progra~1\UltraEdit\UEDIT32.EXE \\TOROON63724\d$\InetPub\ftproot\TIASftp\613525.htm /M="\\TOROON63724\d$\InetPub\ftproot\TIASftp\TIAS/RemoveLines"

The HTM file generates the error "Do you want to convert \\path\filename.htm to DOS format?" Upon clicking No it fails with the syntax error message. Any idea how to get around the convert question? I believe my syntax is correct maybe just a switch. I tested it on a dummy plain text file and syntactically it works fine :?: .
User avatar
Trevor
Newbie
 
Posts: 2
Joined: Thu Dec 02, 2004 12:00 am
Location: Barrie, Ontario, Canada

Re: Running Macro from CMD line syntax ?

Postby Trevor » Thu Dec 02, 2004 4:02 pm

Reverting back to DOS, joy oh bliss.
Had to tildefy all elements of the path, take off "Auto detect Unix files" in configuration and all is well.

C:\Progra~1\UltraE~1\UEDIT32.EXE \\TOROON63724\d$\InetPub\ftproot\TIASftp\613525.htm /M,E,1="\\TOROON63724\d$\InetPub\ftproot\TIASftp\TIAS.MAC/RemoveLines"
User avatar
Trevor
Newbie
 
Posts: 2
Joined: Thu Dec 02, 2004 12:00 am
Location: Barrie, Ontario, Canada

Re: Running Macro from CMD line syntax ?

Postby Lars » Wed Jan 05, 2005 1:09 pm

Getting syntax errors from a batch file, confused as to what I'm doing wrong.

---------------------------
UltraEdit
---------------------------
C:\WINDOWS\system32\,E,1="C:\Loz.MAC leanPE contains an invalid path.
---------------------------
OK
---------------------------

The command line I'm using in the batch file is:

start uedit32.exe C:\pinginfo.txt /M,E,1="C:\Loz.MAC /CleanPE"

I've tried it without the start, and had no luck. I've trimmed the pathing down to just being on the root of the C: drive for the time being, just to get it working.

Any help is appreciated.
User avatar
Lars
Newbie
 
Posts: 1
Joined: Wed Jan 05, 2005 12:00 am

Re: Running Macro from CMD line syntax ?

Postby Mofi » Mon Jan 10, 2005 4:15 am

Remove the space between the name of the macro file and the macro name, then it should work. If not, specify whole path to uedit32.exe in "" if it contains spaces ("C:\Program Files\UltraEdit\uedit32.exe").

So try this

start "C:\Program Files\UltraEdit\uedit32.exe" C:\pinginfo.txt /M,E,1="C:\Loz.MAC/CleanPE"

If still not working, try to get start.exe from Windows 95. I also use start in some batch files and encountered problems with the NT versions (NT4, Win2000, WinXP) of it. Now I use start.exe from Win95 (size 9 kB) on all platforms and this one works fine.
User avatar
Mofi
Grand Master
Grand Master
 
Posts: 4058
Joined: Thu Jul 29, 2004 11:00 pm
Location: Vienna

Re: Running Macro from CMD line syntax ?

Postby linus » Mon Jan 10, 2005 6:56 am

Lars,

I was having a similar problem with this yesterday... using macros for the first time.

For me, it worked *only* if ultraedit was *closed* before I ran it from the command line.

This might have something to do with the preferences setting which is set to open all files in one running copy of uedit32. Maybe if it was set to open new files in a new process, then these problems wouldnt occur, but I havent tried that myself.

Cheers,
Linus
User avatar
linus
Newbie
 
Posts: 1
Joined: Mon Jan 10, 2005 12:00 am

Re: Running Macro from CMD line syntax ?

Postby rezneuk » Mon Aug 15, 2005 10:03 am

Hello, my first post here :)

I have the same problem.
Is there a way to start macros via command line when uedit is allready running in background?

Still runnig v9.20

greets
User avatar
rezneuk
Newbie
 
Posts: 2
Joined: Sun Aug 14, 2005 11:00 pm

Re: Running Macro from CMD line syntax ?

Postby Mofi » Mon Aug 15, 2005 10:49 am

For problems with windows start command see also my post at DOS script to start UltraEdit.

To avoid problems with running a macro from command line while an instance of UltraEdit is already active, run UltraEdit with the macro AND with a special ini-file, also specified at command line. This ini-file could be a simple copy of existing uedit32.ini, but it is important that following setting exists in this ini-file:

[Settings]
Multiple Instances=1

Example:

The special ini-file for macro execution on command line is named uemacro.ini and stored in the program directory of UltraEdit, which is by default for English windows environment "C:\Program Files\UltraEdit". The command line is now:

"C:\Program Files\UltraEdit\uedit32.exe" "Your file to modify.txt" /i="C:\Program Files\UltraEdit\uemacro.ini" /M,E,1="Your macro file with path/macro name"

If you run this from a batch file with the start command, add start "UltraEdit" at the beginning of the command line above.
User avatar
Mofi
Grand Master
Grand Master
 
Posts: 4058
Joined: Thu Jul 29, 2004 11:00 pm
Location: Vienna

Re: Running Macro from CMD line syntax ?

Postby rezneuk » Mon Aug 15, 2005 11:56 am

Danke schön :)
User avatar
rezneuk
Newbie
 
Posts: 2
Joined: Sun Aug 14, 2005 11:00 pm

Re: Running Macro from CMD line syntax ?

Postby H.P.W » Fri Jan 12, 2007 10:23 pm

Hello,

I am using Uedit 12.20b and try to launch a macro via cmd-line.

Code: Select all
uedit32 /M="C:\Programme\UltraEdit\OpenAndInsert.mac/OpenAndInsert"


with this macro OpenAndInsert.mac:

Code: Select all
InsertMode
ColumnModeOff
HexOff
UnixReOff
"Testoutput"


But edit start with a blank window and nothing appears.
What do I miss?
User avatar
H.P.W
Newbie
 
Posts: 4
Joined: Fri Jan 12, 2007 12:00 am

Re: Running Macro from CMD line syntax ?

Postby Mofi » Sat Jan 13, 2007 1:18 pm

When using the macro command line parameter UltraEdit assumes that it is used only in combination with at least 1 file opened too.

I THINK, on start of UltraEdit first all the settings in configurations files are loaded and applied, then the files are loaded, then the additional parameters on the command line are executed including your macro specification and last it checks if a file is open and if not it creates a new file if the config setting Create new EDIT file when opening with no other files is checked.

Try it with following macro:

InsertMode
ColumnModeOff
HexOff
UnixReOff
IfNameIs ""
NewFile
EndIf
"Testoutput"
User avatar
Mofi
Grand Master
Grand Master
 
Posts: 4058
Joined: Thu Jul 29, 2004 11:00 pm
Location: Vienna

Re: Running Macro from CMD line syntax ?

Postby H.P.W » Sat Jan 13, 2007 1:26 pm

Mofi,

Thanks a lot, your macro works correctly.
Maybe it should be mentioned more specificly in the doc.

Hans-Peter
User avatar
H.P.W
Newbie
 
Posts: 4
Joined: Fri Jan 12, 2007 12:00 am


Return to Macros