ShadowOps Posted April 8, 2009 Share Posted April 8, 2009 I need help embedding bitmap images into a compiled script, so that my program is only one file, and not five (the script and 4 bitmaps). I am completely new to Autoit and this forum, so forgive me if I have not included enough detail, or posted wrong, or something... Link to comment Share on other sites More sharing options...
monoceres Posted April 8, 2009 Share Posted April 8, 2009 Hi and welcome. Please check the FileInstall() function in the help file. It does exactly what you need. Broken link? PM me and I'll send you the file! Link to comment Share on other sites More sharing options...
ShadowOps Posted April 8, 2009 Author Share Posted April 8, 2009 I already tried, with no success. Could you give an example on how to use it? And if I do use it, what would I do for the image location? (GuiCtrlCreatePic("???",200,40,25,25)) Link to comment Share on other sites More sharing options...
ShadowOps Posted April 8, 2009 Author Share Posted April 8, 2009 Oops! How do I delete a double post? Link to comment Share on other sites More sharing options...
monoceres Posted April 8, 2009 Share Posted April 8, 2009 (edited) The FileInstall function requires at least a temporary file during runtime.If you want to completely skip the files part you'll have to use Zedna's resource UDF Edited April 8, 2009 by monoceres Broken link? PM me and I'll send you the file! Link to comment Share on other sites More sharing options...
ShadowOps Posted April 8, 2009 Author Share Posted April 8, 2009 The FileInstall function requires at least a temporary file during runtime.If you want to completely skip the files part you'll have to use Zedna's resource UDFBut could you give me an example script? I am completely new so... Link to comment Share on other sites More sharing options...
Authenticity Posted April 8, 2009 Share Posted April 8, 2009 #include <GuiConstants.au3> FileInstall('C:\FullPath_ToFile\smile.jpg', @ScriptDir) Dim $hGUI = GUICreate('Test', 200, 200) Dim $Pic = GUICtrlCreatePic(@ScriptDir & '\smile.jpg', 0, 0) GUISetState() Do Sleep(20) Until GUIGetMsg() = $GUI_EVENT_CLOSE GUIDelete() Change the file path and name, read the help file it must be a literal string (no interpolation of @macro or variables). Compile and test. Link to comment Share on other sites More sharing options...
ShadowOps Posted April 8, 2009 Author Share Posted April 8, 2009 #include <GuiConstants.au3> FileInstall('C:\FullPath_ToFile\smile.jpg', @ScriptDir) Dim $hGUI = GUICreate('Test', 200, 200) Dim $Pic = GUICtrlCreatePic(@ScriptDir & '\smile.jpg', 0, 0) GUISetState() Do Sleep(20) Until GUIGetMsg() = $GUI_EVENT_CLOSE GUIDelete() Change the file path and name, read the help file it must be a literal string (no interpolation of @macro or variables). Compile and test. Do I need the "Dim", or can I just use this: GUICtrlCreatePic(@ScriptDir & '\smile.jpg', 0, 0) Link to comment Share on other sites More sharing options...
CodyBarrett Posted April 8, 2009 Share Posted April 8, 2009 you need the variables if you want to recall functions to that control.. but DIM not unless you have OPT('MustDeclareAllVars',1) [size="1"][font="Tahoma"][COMPLETED]-----[FAILED]-----[ONGOING]VolumeControl|Binary Converter|CPU Usage| Mouse Wrap |WinHide|Word Scrammbler|LOCKER|SCREEN FREEZE|Decisions Decisions|Version UDF|Recast Desktop Mask|TCP Multiclient EXAMPLE|BTCP|LANCR|UDP serverless|AIOCR|OECR|Recast Messenger|AU3C|Tik-Tak-Toe|Snakes & Ladders|BattleShips|TRON|SNAKE_____________________[u]I love the Helpfile it is my best friend.[/u][/font][/size] Link to comment Share on other sites More sharing options...
ShadowOps Posted April 8, 2009 Author Share Posted April 8, 2009 So than why does the below script not show an image: #include <GuiConstants.au3> #include <WindowsConstants.au3> #include <TabConstants.au3> FileInstall('C:\image.bmp', @ScriptDir) Dim $hGUI = GuiCreate("Test", 300, 300,Default,Default,-1,$WS_EX_TOOLWINDOW) GUISetState(@SW_SHOW) sleep(50) GuiCtrlCreateTab(2,2,297,397) GuiCtrlCreateTabItem("Legend") Dim $Pic = GuiCtrlCreatePic(@ScriptDir & '\image.bmp',20,20,220,280) While GuiGetMsg() <> $GUI_EVENT_CLOSE WEnd Exit Link to comment Share on other sites More sharing options...
CodyBarrett Posted April 8, 2009 Share Posted April 8, 2009 (edited) put GUISETSTATE() beneath everything but above the While EDIT here try this #include <GuiConstants.au3> #include <WindowsConstants.au3> #include <TabConstants.au3> FileInstall('C:\image.bmp', @ScriptDir & '\Image.bmp') Dim $hGUI = GuiCreate("Test", 300, 300,Default,Default,-1,$WS_EX_TOOLWINDOW) sleep(50) GuiCtrlCreateTab(2,2,297,397) GuiCtrlCreateTabItem("Legend") $Pic = GuiCtrlCreatePic(@ScriptDir & '\image.bmp',20,20,220,280) GUISetState(@SW_SHOW) While 1 $m=Guigetmsg() if $m=$GUI_EVENT_CLOSE then exit WEnd Edited April 8, 2009 by CodyBarrett [size="1"][font="Tahoma"][COMPLETED]-----[FAILED]-----[ONGOING]VolumeControl|Binary Converter|CPU Usage| Mouse Wrap |WinHide|Word Scrammbler|LOCKER|SCREEN FREEZE|Decisions Decisions|Version UDF|Recast Desktop Mask|TCP Multiclient EXAMPLE|BTCP|LANCR|UDP serverless|AIOCR|OECR|Recast Messenger|AU3C|Tik-Tak-Toe|Snakes & Ladders|BattleShips|TRON|SNAKE_____________________[u]I love the Helpfile it is my best friend.[/u][/font][/size] Link to comment Share on other sites More sharing options...
Authenticity Posted April 8, 2009 Share Posted April 8, 2009 Forgive me... It's actually like this: FileInstall('C:\image.bmp', @ScriptDir & '\') Link to comment Share on other sites More sharing options...
CodyBarrett Posted April 8, 2009 Share Posted April 8, 2009 yeah cause it looked like you werent even extracting the file... try having a file name in the dest.. like i posted [size="1"][font="Tahoma"][COMPLETED]-----[FAILED]-----[ONGOING]VolumeControl|Binary Converter|CPU Usage| Mouse Wrap |WinHide|Word Scrammbler|LOCKER|SCREEN FREEZE|Decisions Decisions|Version UDF|Recast Desktop Mask|TCP Multiclient EXAMPLE|BTCP|LANCR|UDP serverless|AIOCR|OECR|Recast Messenger|AU3C|Tik-Tak-Toe|Snakes & Ladders|BattleShips|TRON|SNAKE_____________________[u]I love the Helpfile it is my best friend.[/u][/font][/size] Link to comment Share on other sites More sharing options...
ShadowOps Posted April 8, 2009 Author Share Posted April 8, 2009 Forgive me... It's actually like this: FileInstall('C:\image.bmp', @ScriptDir & '\') Thanks, that worked! But now I want to replace "@ScriptDir" to the temp folder (C:\Documents and Settings\(USERNAME)\Local Settings\Temp). Is there a variable to that location? Link to comment Share on other sites More sharing options...
CodyBarrett Posted April 8, 2009 Share Posted April 8, 2009 autoit helpfile>Autoit>Marco Reference @TempDir [size="1"][font="Tahoma"][COMPLETED]-----[FAILED]-----[ONGOING]VolumeControl|Binary Converter|CPU Usage| Mouse Wrap |WinHide|Word Scrammbler|LOCKER|SCREEN FREEZE|Decisions Decisions|Version UDF|Recast Desktop Mask|TCP Multiclient EXAMPLE|BTCP|LANCR|UDP serverless|AIOCR|OECR|Recast Messenger|AU3C|Tik-Tak-Toe|Snakes & Ladders|BattleShips|TRON|SNAKE_____________________[u]I love the Helpfile it is my best friend.[/u][/font][/size] Link to comment Share on other sites More sharing options...
ShadowOps Posted April 8, 2009 Author Share Posted April 8, 2009 autoit helpfile>Autoit>Marco Reference@TempDirThank you for all your help, but one last thing! Now how can I delete the .bmp files in the @TempDir when I exit my script? Link to comment Share on other sites More sharing options...
Authenticity Posted April 8, 2009 Share Posted April 8, 2009 $sFile = @TempDir & '\smile.jpg' If FileExist($sFile) Then FileDelete($sFile) Read the help file next time. ;] Link to comment Share on other sites More sharing options...
ShadowOps Posted April 8, 2009 Author Share Posted April 8, 2009 $sFile = @TempDir & '\smile.jpg' If FileExist($sFile) Then FileDelete($sFile) Read the help file next time. ;] Thanks! Link to comment Share on other sites More sharing options...
ShadowOps Posted April 8, 2009 Author Share Posted April 8, 2009 $sFile = @TempDir & '\smile.jpg' If FileExist($sFile) Then FileDelete($sFile) Read the help file next time. ;] Wait... Than gives me an "unknown function name" error... Link to comment Share on other sites More sharing options...
Authenticity Posted April 8, 2009 Share Posted April 8, 2009 lol Sorry, it's actually FileExists. Anyway, read the help file (F1 from SciTE editor), it's much faster way. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now