logmein Posted February 5, 2009 Share Posted February 5, 2009 (edited) This is my script :expandcollapse popup#NoTrayIcon #include <GUIConstants.au3> #include <WindowsConstants.au3> #include <ButtonConstants.au3> #include <GDIplus.au3> #include <File.au3> #include <StaticConstants.au3> #include <Process.au3> ;form start $title = "Image Converter 1.0 - logmein" $dir1 = IniRead (@systemdir & "ImageConverter.ini","Settings","Dir1","") $dir2 = IniRead (@systemdir & "ImageConverter.ini","Settings","Dir2",@DesktopDir) #Region $Form = GUICreate($title, 462, 125, -1, -1) GUISetIcon (@ScriptDir & 'imagekonverter.ico','',-1) GUICtrlCreateGroup("Options", 8, 0, 449, 137-46) $Label1 = GUICtrlCreateLabel("Source :", 16, 24, 45, 18) $s = GUICtrlCreateInput('', 80, 24, 313, 22) GUICtrlSetData (-1,$dir1) $sb = GUICtrlCreateButton("...", 400, 23, 51, 23, 0) $Label2 = GUICtrlCreateLabel("Destination :", 16, 64, 63, 18) $d = GUICtrlCreateInput("", 80, 60, 313, 22) GUICtrlSetData (-1,$dir2) $db = GUICtrlCreateButton("...", 400, 59, 51, 23, 0) ; GUICtrlCreateGroup("", -99, -99, 1, 1) $Ok = GUICtrlCreateButton("Convert !", 184, 144-46, 115, 25, $BS_DEFPUSHBUTTON) GUICtrlSetFont(-1, 10, 800, 0, "ABC Sans Serif") $web = GUICtrlCreateLabel ('Home',430,100,50,25) GUICtrlSetFont (-1,8.5,400,4) GUICtrlSetColor (-1,0x0000ff) GUICtrlSetCursor (-1,0) GUISetState(@SW_SHOW) #EndRegion ;=================================================================================================== ======= While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $sb $z1 = FileOpenDialog("Browse for image file", GUICtrlRead($s),'Image (*.BMP;*.DIB;*.JPG;*.JPEG;*.JPE;*.JFIF;*.GIF;*.PNG;*.TIF;*.TIFF;*.JIF)', 1, "", $Form) If Not @error Then GUICtrlSetData($s, $z1) EndIf Case $db $z2 = FileSaveDialog ("Browse for destination file",GUICtrlRead ($d),'Image (*.BMP;*.DIB;*.JPG;*.JPEG;*.JPE;*.JFIF;*.GIF;*.PNG;*.TIF;*.TIFF;*.JIF)',"","",$form) If Not @error Then GUICtrlSetData($d, $z2) EndIf Case $GUI_EVENT_CLOSE _exit () Case $ok convert () Case $web _RunDos("start http://sites.google.com/site/imagekonverter/Home") EndSwitch ;tranfer () WEnd Func _exit () IniWrite(@SystemDir & "ImageConverter.ini", "Settings", "Dir1", GUICtrlRead($s)) IniWrite(@SystemDir & "ImageConverter.ini", "Settings", "Dir2", GUICtrlRead($d)) Exit EndFuncif i run the script, it show a open file dialog box? I can't find the bug! Where's it? :-(removed convert func from last edit! Edited February 5, 2009 by logmein [font=arial, helvetica, sans-serif][s]Total USB Security 3.0 Beta[/s] | [s]Malware Kill[/s] | Malware Scanner | Screen Hider | Locker | Matrix Generator[s]AUTO-SYNC 1.0 | MD5 Hash Generator | URL Checker | Tube Take [/s]| Random Text[/font] Link to comment Share on other sites More sharing options...
Manjish Posted February 5, 2009 Share Posted February 5, 2009 Ok.. Please provide all the necessary files.. n then i can help u.. the ini files.. [font="Garamond"]Manjish Naik[/font]Engineer, Global Services - QPSHoneywell Automation India LimitedE-mail - Manjish.Naik@honeywell.com Link to comment Share on other sites More sharing options...
Spiff59 Posted February 5, 2009 Share Posted February 5, 2009 (edited) For one thing, you're missing some "\" characters... $dir1 = IniRead (@systemdir & "\ImageConverter.ini","Settings","Dir1","") $dir2 = IniRead (@systemdir & "\ImageConverter.ini","Settings","Dir2",@DesktopDir) IniWrite(@SystemDir & "\ImageConverter.ini", "Settings", "Dir1", GUICtrlRead($s)) IniWrite(@SystemDir & "\ImageConverter.ini", "Settings", "Dir2", GUICtrlRead($d)) GUISetIcon (@ScriptDir & '\imagekonverter.ico','',-1) EDIT: Is probably the bad pathname in GUISetIcon causing your main troubles... EDIT2: On second glance, your GUISetIcon statement is all messed up, I think you just want: GUISetIcon (@ScriptDir & '\imagekonverter.ico') Edited February 5, 2009 by Spiff59 Link to comment Share on other sites More sharing options...
BrettF Posted February 5, 2009 Share Posted February 5, 2009 As has been said your problem lies mostly with where you use @ScriptDir, Remember that it doesn't not give the returned path a \, so you always need to add one with files See the following too: expandcollapse popup#NoTrayIcon #include <GUIConstants.au3> #include <WindowsConstants.au3> #include <ButtonConstants.au3> #include <GDIplus.au3> #include <File.au3> #include <StaticConstants.au3> #include <Process.au3> ;form start $title = "Image Converter 1.0 - logmein" $dir1 = IniRead(@SystemDir & "\ImageConverter.ini", "Settings", "Dir1", "") $dir2 = IniRead(@SystemDir & "\ImageConverter.ini", "Settings", "Dir2", @DesktopDir) #Region $Form = GUICreate($title, 462, 125, -1, -1) GUISetIcon(@ScriptDir & 'imagekonverter.ico', '', -1) GUICtrlCreateGroup("Options", 8, 0, 449, 137 - 46) $Label1 = GUICtrlCreateLabel("Source :", 16, 24, 45, 18) $s = GUICtrlCreateInput('', 80, 24, 313, 22) GUICtrlSetData(-1, $dir1) $sb = GUICtrlCreateButton("...", 400, 23, 51, 23, 0) $Label2 = GUICtrlCreateLabel("Destination :", 16, 64, 63, 18) $d = GUICtrlCreateInput("", 80, 60, 313, 22) GUICtrlSetData(-1, $dir2) $db = GUICtrlCreateButton("...", 400, 59, 51, 23, 0) GUICtrlCreateGroup("", -99, -99, 1, 1) $Ok = GUICtrlCreateButton("Convert !", 184, 144 - 46, 115, 25, $BS_DEFPUSHBUTTON) GUICtrlSetFont(-1, 10, 800, 0, "ABC Sans Serif") $web = GUICtrlCreateLabel('Home', 430, 100, 50, 25) GUICtrlSetFont(-1, 8.5, 400, 4) GUICtrlSetColor(-1, 0x0000ff) GUICtrlSetCursor(-1, 0) GUISetState(@SW_SHOW) #EndRegion ;=================================================================================================== == While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $sb $z1 = FileOpenDialog("Browse for image file", GUICtrlRead($s), 'Image (*.BMP;*.DIB;*.JPG;*.JPEG;*.JPE;*.JFIF;*.GIF;*.PNG;*.TIF;*.TIFF;*.JIF)', 1, "", $Form) If Not @error Then GUICtrlSetData($s, $z1) EndIf Case $db $z2 = FileSaveDialog("Browse for destination file", GUICtrlRead($d), 'Image (*.BMP;*.DIB;*.JPG;*.JPEG;*.JPE;*.JFIF;*.GIF;*.PNG;*.TIF;*.TIFF;*.JIF)', "", "", $Form) If Not @error Then GUICtrlSetData($d, $z2) EndIf Case $Ok ;convert() Case $web ShellExecute("http://sites.google.com/site/imagekonverter/Home");This will open in default browser. EndSwitch ;tranfer () WEnd Func OnAutoItExit() IniWrite(@SystemDir & "\ImageConverter.ini", "Settings", "Dir1", GUICtrlRead($s)) IniWrite(@SystemDir & "\ImageConverter.ini", "Settings", "Dir2", GUICtrlRead($d)) EndFunc ;==>OnAutoItExit If I changed anything, I usually used a comment... Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version! Link to comment Share on other sites More sharing options...
logmein Posted February 5, 2009 Author Share Posted February 5, 2009 to Manjish : the ini file doesn't important, it's only contains some settings [font=arial, helvetica, sans-serif][s]Total USB Security 3.0 Beta[/s] | [s]Malware Kill[/s] | Malware Scanner | Screen Hider | Locker | Matrix Generator[s]AUTO-SYNC 1.0 | MD5 Hash Generator | URL Checker | Tube Take [/s]| Random Text[/font] Link to comment Share on other sites More sharing options...
logmein Posted February 5, 2009 Author Share Posted February 5, 2009 i have detect the bug : GuiSetIcon if i delete it the script run without any problems i can understand how GUISETICON cause to my script? [font=arial, helvetica, sans-serif][s]Total USB Security 3.0 Beta[/s] | [s]Malware Kill[/s] | Malware Scanner | Screen Hider | Locker | Matrix Generator[s]AUTO-SYNC 1.0 | MD5 Hash Generator | URL Checker | Tube Take [/s]| Random Text[/font] Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted February 5, 2009 Moderators Share Posted February 5, 2009 (edited) logmein,You are using the wrong parameters with GUISetIcon. You have coded GUISetIcon (@ScriptDir & 'imagekonverter.ico','',-1). From the Help file:GUISetIcon ( iconfile [, iconID [, winhandle]] )Parametersiconfile used to display the icon in the title area. iconID [optional] The ID of the icon in the iconfile. (Default is -1). winhandle [optional] Windows handle as returned by GUICreate (default is the previously used window). So passing '' as a parameter is causing a crash as AutoIt tries to cope with what should be a number. As you are using GUISetIcon immediately after creating the GUI, there is no need to include the winhandle parameter either. So you should find that:GUISetIcon (@ScriptDir & 'imagekonverter.ico')will work for you. It does for me!M23 Edited February 5, 2009 by Melba23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area 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