Sign in to follow this  
Followers 0
Iuli

RegWrite function

6 posts in this topic

#1 ·  Posted (edited)

Hi,

I'm quite new to AutoIT programming.

Here's my problem : When i try to compile a program i wrote i get the following error :

D:\Unlimited Projects\temp\XtraApps\ViApply.au3(8,115) : ERROR: syntax error (illegal character)
    RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run","ViOrb","REG_SZ",@ProgramFilesDir & "\ViStart\ViStart.exe")

What have i did wrong ?

Edited by Iuli

[size="2"]SFXMaker[/size] - The most complete switchless installer creator software[indent][/indent]

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Hi,

I'm quite new to AutoIT programming.

Here's my problem : When i try to compile a program i wrote i get the following error :

D:\Unlimited Projects\temp\XtraApps\ViApply.au3(8,115) : ERROR: syntax error (illegal character)
    RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run","ViOrb","REG_SZ",@ProgramFilesDir & "\ViStart\ViStart.exe")

What have i did wrong ?

hi and welcome,

post yuor code until line 8

regwrite is correct and work fine

Edited by silvano

Share this post


Link to post
Share on other sites

hi and welcome,

post yuor code until line 8

regwrite is correct and work fine

I think he's got an unpaired single or double quote, or an open paren with no close.. etc., on a line above that one.

:)


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Ok, here's my code:

$mem = MemGetStats() 
;MsgBox(0, " The ammount of memory", "You have " & $mem[1] & " KB of RAM")
DirCopy(@ScriptDir & "\Movie Maker",@ProgramFilesDir & "\Movie Maker",1)
If $mem[1] > 510000 Then
    DirCopy(@ScriptDir & "\ViStart",@ProgramFilesDir & "\ViStart",1)
    RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run","ViStart","REG_SZ", @ProgramFilesDir & "\ViStart\ViStart.exe")
    DirCopy(@ScriptDir & "\ViOrb",@ProgramFilesDir & "\ViOrb",1)
    RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run","ViOrb","REG_SZ", @ProgramFilesDir & "\ViOrb\ViOrb.exe')
    DirCopy(@ScriptDir & "\LClock",@ProgramFilesDir & "\LClock",1)
    RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run","LClock","REG_SZ", @ProgramFilesDir & "\LClock\LClock.exe')
    DirCopy(@ScriptDir & "\Sidebar",@ProgramFilesDir & "\Sidebar",1)
    RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run","Sidebar","REG_SZ", @ProgramFilesDir & "\Sidebar\Sidebar.exe')
    DirCopy(@ScriptDir & "\ToolTip",@ProgramFilesDir & "\ToolTip",1)
    RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run","ToolTip","REG_SZ", @ProgramFilesDir & "\ToolTip\VisualToolTip.exe')
    DirCopy(@ScriptDir & "\Yodm3D",@ProgramFilesDir & "\Yodm3D",1)
    RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run","Yodm3D","REG_SZ", @ProgramFilesDir & "\Yodm3D\Yodm3D.exe')
    DirCopy(@ScriptDir & "\GlassToast",@ProgramFilesDir & "\GlassToast",1)
    RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run","GlassToast","REG_SZ", @ProgramFilesDir & "\GlassToast\GlassToas.exe')
    DirCopy(@ScriptDir & "\Madotate",@ProgramFilesDir & "\Madotate",1)
    RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run","Madotate","REG_SZ", @ProgramFilesDir & "\Madotate\Madotate.exe')
    Run(@ScriptDir & "\TopDesk\TopDesk153Setup.exe" & " /S /NCRC",@SW_HIDE)
    WinWaitClose("TopDesk 1.5.3 Setup")
Else
    DirCopy(@ScriptDir & "\WinFlip",@ProgramFilesDir & "\WinFlip",1)
    RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run","WinFlip","REG_SZ", @ProgramFilesDir & "\WinFlip\WinFlip.exe')
    Run(@ScriptDir & "VisualPatch.exe" & " /S /NCRC",@SW_HIDE)
EndIf   
Exit
Edited by Iuli

[size="2"]SFXMaker[/size] - The most complete switchless installer creator software[indent][/indent]

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

Welcome,

And here is fixed code.

$mem = MemGetStats()
;MsgBox(0, " The ammount of memory", "You have " & $mem[1] & " KB of RAM")
DirCopy(@ScriptDir & "\Movie Maker", @ProgramFilesDir & "\Movie Maker", 1)
If $mem[1] > 510000 Then
    DirCopy(@ScriptDir & "\ViStart", @ProgramFilesDir & "\ViStart", 1)
    RegWrite("HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run", "ViStart", "REG_SZ", '"' & @ProgramFilesDir & '\ViStart\ViStart.exe"')
    DirCopy(@ScriptDir & "\ViOrb", @ProgramFilesDir & "\ViOrb", 1)
    RegWrite("HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run", "ViOrb", "REG_SZ", '"' & @ProgramFilesDir & '\ViOrb\ViOrb.exe"')
    DirCopy(@ScriptDir & "\LClock", @ProgramFilesDir & "\LClock", 1)
    RegWrite("HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run", "LClock", "REG_SZ", '"' & @ProgramFilesDir & '\LClock\LClock.exe"')
    DirCopy(@ScriptDir & "\Sidebar", @ProgramFilesDir & "\Sidebar", 1)
    RegWrite("HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run", "Sidebar", "REG_SZ", '"' & @ProgramFilesDir & '\Sidebar\Sidebar.exe"')
    DirCopy(@ScriptDir & "\ToolTip", @ProgramFilesDir & "\ToolTip", 1)
    RegWrite("HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run", "ToolTip", "REG_SZ", '"' & @ProgramFilesDir & '\ToolTip\VisualToolTip.exe"')
    DirCopy(@ScriptDir & "\Yodm3D", @ProgramFilesDir & "\Yodm3D", 1)
    RegWrite("HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run", "Yodm3D", "REG_SZ", '"' & @ProgramFilesDir & '\Yodm3D\Yodm3D.exe"')
    DirCopy(@ScriptDir & "\GlassToast", @ProgramFilesDir & "\GlassToast", 1)
    RegWrite("HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run", "GlassToast", "REG_SZ", '"' & @ProgramFilesDir & '\GlassToast\GlassToas.exe"')
    DirCopy(@ScriptDir & "\Madotate", @ProgramFilesDir & "\Madotate", 1)
    RegWrite("HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run", "Madotate", "REG_SZ", '"' & @ProgramFilesDir & '\Madotate\Madotate.exe"')
    Run('"' & @ScriptDir & '\TopDesk\TopDesk153Setup.exe /S /NCRC"', '', @SW_HIDE)
    WinWaitClose("TopDesk 1.5.3 Setup")
Else
    DirCopy(@ScriptDir & "\WinFlip", @ProgramFilesDir & "\WinFlip", 1)
    RegWrite("HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run", "WinFlip", "REG_SZ", '"' & @ProgramFilesDir & '\WinFlip\WinFlip.exe"')
    Run('"' & @ScriptDir & '\VisualPatch.exe" /S /NCRC', '', @SW_HIDE)
EndIf
Exit

If you open a string with a double quote, then you need close the string with a double quote i.e. "string". Same goes for single quotes i.e 'string'. Single quotes can help retain double quotes as in the fixed code above so your paths with spaces will not error when executed from the registry.

:)

Edit:

Your Run() funcs were missing the workingdir parameter also.

Edited by MHz

Share this post


Link to post
Share on other sites

Thnx for the fix. As i said, i'm new to AutoIT !


[size="2"]SFXMaker[/size] - The most complete switchless installer creator software[indent][/indent]

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