Jump to content

File install syntax error


noobish
 Share

Recommended Posts

There is another issue i have my firends.In this script made by user JLogan3013 i want to make it an install of an image where the script it is so a user to be able to execute the script/exe and instal a wallpaper.

But when i use the fileinstall function i get a syntax error.

[autoit

FileInstall(@ScriptDir "\ss.bmp", @ScriptDir "\ss.bmp')

$oShell = ObjCreate("WScript.Shell")

$oFSO = ObjCreate("Scripting.FileSystemObject")

$Wallpaper = @ScriptDir & "\ss.bmp"

$oShell.RegWrite("HKCU\Control Panel\Desktop\Wallpaper", $WallPaper)

$oShell.RegWrite("HKCU\Control Panel\Desktop\WallpaperStyle", "2")

$oShell.Run("%windir%\System32\RUNDLL32.EXE user32.dll,UpdatePerUserSystemParameters", 1, True)[/autoit]

Any ideas, Thank you .

Link to comment
Share on other sites

"This must be a literal string; it cannot be a variable or the result of a function call"

That is in bold in the help file for that paramater.

basic rule while finding your scripting feet, is to open the helpfile on every function you are using

and read it as you go along several times.

you know it makes sense.

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Link to comment
Share on other sites

Thank you johhOne, But it throws ths error again.

: ERROR: syntax error (illegal character)

FileInstall(@ScriptDir & "ss.bmp", @ScriptDir & "

the whole script

FileInstall(@ScriptDir & "ss.bmp", @ScriptDir & "ss.bmp')
$oShell = ObjCreate("WScript.Shell")
$oFSO = ObjCreate("Scripting.FileSystemObject")
$Wallpaper = @ScriptDir & "ss.bmp"

$oShell.RegWrite("HKCUControl PanelDesktopWallpaper", $WallPaper)
$oShell.RegWrite("HKCUControl PanelDesktopWallpaperStyle", "2")
$oShell.Run("%windir%System32RUNDLL32.EXE user32.dll,UpdatePerUserSystemParameters", 1, True)

Thank you once again.

Link to comment
Share on other sites

"This is a literal string"

$ThisIsAVariable.

@ThisIsAMacroVariable.

EDIT:

Did you know there are examples of how to use each function, in the help file?

At the bottom they are.

Both source and destination are literal strings in FileInstall example.

But only the source need to be.

Edited by JohnOne

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Link to comment
Share on other sites

Thank you for the lesson,now i have no errors,but the script it doesn't install the .bmp image.

here is the script

FileInstall("C:ss.bmp", "@ScriptDir ss.bmp")
$oShell = ObjCreate("WScript.Shell")
$oFSO = ObjCreate("Scripting.FileSystemObject")
$Wallpaper = @ScriptDir & "ss.bmp"

$oShell.RegWrite("HKCUControl PanelDesktopWallpaper", $WallPaper)
$oShell.RegWrite("HKCUControl PanelDesktopWallpaperStyle", "2")
$oShell.Run("%windir%System32RUNDLL32.EXE user32.dll,UpdatePerUserSystemParameters", 1, True)

I dont like bother you guys and allready you have helped me very very much ,but i just want a compiled .exe which when a user executes to install a .bmp image which later the same script will install the same .bmp image as wallpaper.

Link to comment
Share on other sites

You know something guys, you all rock inside here,i know this is easy stuff for you but the help you give is awesome .

I have no words this is it, thank you Jos ,

You should kick my ass now but i will make another question, does this script will work on x64 machines.

And how to make that script to use and a .png image also.

I am extremely obligated to all of you.

Link to comment
Share on other sites

I shouldn't bump this, but just wanted to ask how to make this script use a .png or .jpeg image. This one works only with .bmp image.

$oShell = ObjCreate("WScript.Shell")
$oFSO = ObjCreate("Scripting.FileSystemObject")
$Wallpaper = @ScriptDir & "ss.bmp"

$oShell.RegWrite("HKCUControl PanelDesktopWallpaper", $WallPaper)
$oShell.RegWrite("HKCUControl PanelDesktopWallpaperStyle", "2")
$oShell.Run("%windir%System32RUNDLL32.EXE user32.dll,UpdatePerUserSystemParameters", 1, True)
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...