Sign in to follow this  
Followers 0
GoogleDude

I am new so go easy!

9 posts in this topic

#1 ·  Posted (edited)

hi everyone i am new so please bare with me if I ask a dumb question.

I have set some $vars already in my script but need help converting them into the correct format!

I want to convert the below

7z a -tzip -r c:\archive.zip "C:\Documents and Settings\Google\Application Data\Folder\*"

into something like below but its not working.

when C:\Documents and Settings\Google\Application Data\Folder is already equal to $var

$var = "C:\Documents and Settings\Google\Application Data\Folder"

RunWait('7z a -tzip -r c:\archive.zip $var')

I read into autoit.chm but did not find an answer.

please help..

thanks for any help anyone can provide.

GoogleDude

Edited by GoogleDude

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

your trying to get the location out of the string?

Edited by thatsgreat2345

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

No I already did a $FolderPath = RegRead(HK_Local_Machine\Software\blah\blah", "ProfileLocation") in order to set the var? I just need to correct format of the RunWait function with the 7z.exe command in it.

I want to replace the "C:\Documents and Settings\Google\Application Data\Folder" with $FolderPath var!

I am using SciTech that I downloaded from AutoIt Site but everytime I try to check the format it doesnt come out right and in turn does not run. keeps telling me I have a bad formatted tring in the RunWait line.

hope this helps make sense of it.

GoogleDude

Edited by GoogleDude

Share this post


Link to post
Share on other sites

HI,

maybe:

MsgBox(0,"Test the path", '7z a -tzip -r c:\archive.zip ' & $var)
;RunWait('7z a -tzip -r c:\archive.zip ' & $var)
RunWait(@ComSpec & ' /c 7z a -tzip -r c:\archive.zip ' & $var, '', @SW_SHOW)

So long,

Mega


Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Share this post


Link to post
Share on other sites

Great that put me one step closer however it is still not working 100% like I was thinking it would. Problem is now that when it runs the RunWait function is it not putting the double quotes around the resulting path of the $var there for breaking the 7z.exe command with its args.

Works

7z a -tzip -r c:\archive.zip "C:\Documents and Settings\Google\Application Data\Folder"

Does not work. Just sits at spanning....... Im thinking it is becuase it does not have the double quotes around the folder path to zip up since there are spaces.

7z a -tzip -r c:\archive.zip C:\Documents and Settings\Google\Application Data\Folder

The test results in MsgBox show it with out quotes around the path.

thank you for your help everyone/anyone.

GoogleDude

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

This is my whole script im using its really small but yet simple.

If Not IsDeclared("Answer") Then Dim $Answer
$Answer = MsgBox(262180,"Backup Config Folder?","Do you want to Backup your Profile Data?")
Select
    Case $Answer = 6 ;Yes
        $ProfilePath = RegRead ( "HKEY_LOCAL_MACHINE\SOFTWARE\Key\SubKey", "Profile" )
        DirCreate(@TempDir & "\_temp")
        FileInstall("7z.exe", @TempDir & "\_temp" & "\7z.exe")
        MsgBox(0,"Test the path", "7z.exe a -tzip -r c:\archive.zip " & $ProfilePath)
        RunWait(@ComSpec & " /c %temp%\_temp\7z.exe a -tzip -r c:\archive.zip " & $ProfilePath)
        Exit
EndSelect
Exit
Edited by GoogleDude

Share this post


Link to post
Share on other sites

My Objective here is really just to read a registry value for a local path and zip that whole folder up and place the zip file on the desktop or where ever. If I am going about this the wrong way I am open to any suggestions that any of the AutoIt Pro's might have.

GoogleDude

Share this post


Link to post
Share on other sites

My Objective here is really just to read a registry value for a local path and zip that whole folder up and place the zip file on the desktop or where ever. If I am going about this the wrong way I am open to any suggestions that any of the AutoIt Pro's might have.

GoogleDude

What about this?

If Not IsDeclared("Answer") Then Dim $Answer
$Answer = MsgBox(262180,"Backup Config Folder?","Do you want to Backup your Profile Data?")
Select
    Case $Answer = 6;Yes
        $ProfilePath = RegRead ( "HKEY_LOCAL_MACHINE\SOFTWARE\Key\SubKey", "Profile" )
        DirCreate(@TempDir & "\_temp")
        FileInstall("7z.exe", @TempDir & "\_temp" & "\7z.exe")
        MsgBox(0,"Test the path", "7z.exe a -tzip -r c:\archive.zip " & $ProfilePath)
        RunWait(@ComSpec & " /c %temp%\_temp\7z.exe a -tzip -r c:\archive.zip " & Chr(34) & $ProfilePath & Chr(34))
        Exit
EndSelect
Exit

Share this post


Link to post
Share on other sites

@ ChrisL

You da man. Lucky you im married and have 3 kids or I would kiss you. :P

Many thanks,

GoogleDude

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