Sign in to follow this  
Followers 0
Diana (Cda)

Translating working bat to AI re commandline RAR ...

6 posts in this topic

I honestly could have sworn that I had asked this at some point in the distant past but many searches didn't yield the thread. Perhaps it was in another forum or a newsgroup, even though I thought I asked the exact same question <g>. Anyway, can't find it here. It's late and it could be my eyes or that I'm tired <g>, but begging the group's indulgence.

For once, I really managed to plough very far along before hitting a brick wall. Very pleased with that. I've created 3 scripts that work in tandem. The first is actually a batch file which I don't know how to deal with re switching over to AI syntax and format. I found the exact coding online and so far several tests have yielded viable compression results.

The last 2 scripts I couldn't get to work together in 1 file, but when separated they do the job. I'm not worried about those 2 at this point. I'll get to them later once the bat file deal with.

The bat is there here; can anyone tell me how to do the exact same thing in AI, please? This backs up a folder to a compressed RAR.

"C:\Program Files\WinRAR\Rar.exe" a "C:\Documents and Settings\RGAUDREA\Favorites\01.rar" C:\DOCUME~1\RGAUDREA\FAVORI~1\01

I can't stand batch files, they're so darned hard to work with and don't know how to take care of the absolute paths. With AI, I have lots of tricks up my sleeve re relative paths and LFNs are much better supported!

Anyway, thank you in advance! If I can automate my daily backup with commandline RARing via AI, that will save me quite a bit of time.

Cheers. :)

Share this post


Link to post
Share on other sites



Help file quote:

_RunDOS

--------------------------------------------------------------------------------

Executes a DOS command in a hidden command window.

#include <Process.au3>

_RunDOS ( $sCommand )

Parameters

$sCommand Command to execute

Return Value

Success: Returns the exit code of the command

Failure: Depends on RunErrorsFatal setting

Every command in the batch file is a simple DOS comand, so in order to convert the batch file to AutoIt, you only need to change the synthax as above.

Keep in mind that: to use quotes you have to "double" them.

#include <Process.au3>
_RunDOS ( '""C:\Program Files\WinRAR\Rar.exe"" a ""C:\Documents and Settings\RGAUDREA\Favorites\01.rar"" C:\DOCUME~1\RGAUDREA\FAVORI~1\01')

SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script

wannabe "Unbeatable" Tic-Tac-Toe

Paper-Scissor-Rock ... try to beat it anyway :)

Share this post


Link to post
Share on other sites

Run('"C:\Program Files\WinRAR\Rar.exe" a "C:\Documents and Settings\RGAUDREA\Favorites\01.rar" "C:\DOCUME~1\RGAUDREA\FAVORI~1\01"')

Share this post


Link to post
Share on other sites

Help file quote:

Every command in the batch file is a simple DOS comand, so in order to convert the batch file to AutoIt, you only need to change the synthax as above.

Keep in mind that: to use quotes you have to "double" them.

#include <Process.au3>
_RunDOS ( '""C:\Program Files\WinRAR\Rar.exe"" a ""C:\Documents and Settings\RGAUDREA\Favorites\01.rar"" C:\DOCUME~1\RGAUDREA\FAVORI~1\01')
(Love your avatar!!! <g>)

Run('"C:\Program Files\WinRAR\Rar.exe" a "C:\Documents and Settings\RGAUDREA\Favorites\01.rar" "C:\DOCUME~1\RGAUDREA\FAVORI~1\01"')

Wow, that is so cool, thanks! I'll try both examples out at work tonight when I attempt my new backup routine with this instead of the batch.

'course, will be even better with AI's syntax, something along the lines of ...:

*
Run('"C:\Program Files\WinRAR\Rar.exe" a "C:\Documents and Settings\RGAUDREA\Favorites\01.rar" "C:\DOCUME~1\RGAUDREA\FAVORI~1\01"')oÝ÷ Û^f{%j׫Û"-ZÞiÜ«jx§¶k¢æåz[`Ò-®'¶n¶)íêÞ«b½êZ¶º×hmëmè^j[aʧÊ%¢êì~ëzV­÷©jØljÂ.²çh"È­i¢Ë"nW­¢ë¥«a²«zȧqè­ßÛ%G9$ájÝý³r"wuçm+-¡·¢-«ZÖÞx,ºh±çeɦåzÚ.±âÅ6ÃÚºÚ"µÍÚ[ÛYH   ÔØÙÜË]LÉÝÂÔ[ÔÈ
    ÌÎNÉ][ÝÐÙÜ[Q[Ñ  [È ][ÝÉÌLÕÚ[TÌLÔ^I][ÝÉ][ÝÈH ][ÝÐÙÙ[Q    [È ][ÝÉÌLÑ]Ü]ÉÎLÉÍÌK][ÝÉ][ÝÈ ][ÝÐÙÙ[Q    [È ][ÝÉÌLÑ]Ü]ÉÎLÉÍÌI][ÝÉÌÎNÊoÝ÷ ضØrrhº»0'!ºË¦y©ì³)ík¬¢F²nëpØhºÖ¥Ø^ªê-zȧ¶«zÊ&zZqì!z·­ì­éè²ȧØb²h Ùè¶Ø^
+«­¢+Ø¥¹±Õ±ÐíAɽÍ̹ÔÌÐì)}IÕ¹=L¡Aɽɵ¥±Í¥ÈµÀìÅÕ½ÐìÀäÈí]¥¹IHÀäÈíIȹáÅÕ½ÐìUÍÉAɽ¥±¥ÈµÀìÅÕ½ÐìÀäÈíٽɥÑÌäÈìÐàìĹÉÈÅÕ½ÐìUÍÉAɽ¥±¥ÈµÀìÅÕ½ÐìÀäÈíٽɥÑÌäÈìÐàìÄÅÕ½Ðì¤

Thanks much guys, you're the best! :)

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

carefull there, the macro's just plop in a string, so use string contacts to piece your line together-

Run('"'&@ProgramFilesDir & '\WinRAR\Rar.exe" a '&'"'&@UserProfileDir & '\Favorites\01.rar" ' & '"'& @UserProfileDir & '\Favorites\01"')
Edited by evilertoaster

Share this post


Link to post
Share on other sites

carefull there, the macro's just plop in a string, so use string contacts to piece your line together-

Run('"'&@ProgramFilesDir & '\WinRAR\Rar.exe" a '&'"'&@UserProfileDir & '\Favorites\01.rar" ' & '"'& @UserProfileDir & '\Favorites\01"')
Hah, knew I was missing something! <lol>

I'll give this a try at work on Monday. What I do know is that even with the bat file along with the 2 AI scripts, the backing up process got a whole lot easier! If the daily backup process to the USB flash drive was revolutionized with this 3-script process, I can't wait till I can accomplish the same with just one mouse click on _one_ AI one!

Thanks. :)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0