Le bouton quit ne réagit au click que sur la partie située en dessous du texte du bouton, alors que le bouton situé au milieu à droite, qui est une copie juste renommée, fonctionne correctement.
► Afficher le textecode
;==========================================================================
; AutoIt Version: 3.0
; Language: English
; Platform: Linux
; Author: Alain Aupeix
; Script Function: create a launcher to open the passed URL with K-Meleon
;==========================================================================
$Version = "0.1"
$DatVers = "2012/03/18"
$author = "JujuLand"
#include <GuiConstantsEx.au3>
#include <AVIConstants.au3>
#include <TreeViewConstants.au3>
#include <GuiTreeView.au3>
#include <Array.au3>
#include <WinAPI.au3>
#include <WindowsConstants.au3>
;============
; GUI options
;============
Opt("GUIOnEventMode",1)
Opt("MouseCoordMode",2)
$CRLF = chr(13) & chr(10)
$UserProfile = envget("USERPROFILE")
$TuxProfile = "\home\" & EnvGet("USERNAME")
$temp=Envget("TEMP")
$Tuxtemp=StringReplace(RegRead("HKLM\Software\Win2Tux\devices\" & StringLeft($temp,1),"") & StringMid($temp,3),"\","/")
$Icon=""
$comment=""
$path=""
$type=""
$convert=RegRead("HKLM\Software\Win2Tux\desktop","convert")
$vers=RegRead("HKLM\Software\Win2Tux\desktop","ImageMagick")
;=====================
; Messages translation
;=====================
$Language=RegRead("HKLM\Software\Win2Tux\Language","")
$txt1="URL Launcher on Desktop Creation"
$txt2="URL"
$txt3="Name"
$txt4="Comment"
$txt5="Icon"
$txt6="Location"
$txt7="Browse"
$txt8="Restore"
$txt9="Create"
$txt10="Quit"
$txt11="Launcher created"
$txt12=" by "
$txt13="Desktop"
$txt14=" Default Icon"
$nbmess=14
$Win2Tux=RegRead("HKLM\Software\Win2Tux","")
if FileExists($Win2Tux & "\" & $language & ".ini")=1 then
For $i = 1 to $nbmess
Assign("txt" & $i, IniRead($Win2Tux & "\" & $language & ".ini", "URL2Km", "txt" & $i, Eval("txt" & $i)))
Next
endif
;=====================
; No parameter, fix it
;=====================
$defURL=""
if $cmdline[0]>0 then
$defURL= $cmdline[1]
endif
;===================
; Fix default values
;===================
$defIconPath=RegRead("HKLM\Software\Win2Tux\desktop","IconPath")
$TuxIconPath=StringReplace(StringMid($defIconPath,3),"\","/")
$defIconName=RegRead("HKLM\Software\Win2Tux\desktop","Icon")
$defIcon = $defIconPath & "\" & $defIconName
$defpath=RegRead("HKLM\Software\Win2Tux\desktop","locationPath")
$defcomment=$txt11 & $txt12 & "URL2Km"
$deftype=".xpm"
;=====================================
; Parse parameters and launch K-Meleon
;=====================================
$defname=StringMid($defURL,StringInStr($defURL,"//")+2)
if StringInStr($defname,"/")>0 Then
$defname=StringLeft($defname,StringInStr($defname,"/")-1)
EndIf
$URL=$defURL
$name=$defname
$IconName=$defIconName
$comment=$defcomment
$Icon= $defIcon
$iconPath=$defIconPath
$path=$defpath
$type=$deftype
;=========================================================================================
; GUI
;=========================================================================================
$MyGUI=GuiCreate($txt1, 487, 210)
GuiCtrlCreateLabel($txt3 & ":", 10, 20)
$URLName=GuiCtrlCreateInput( $name, 100, 18, 260, 20)
$restore1=GUICtrlCreateButton($txt8,365, 20, 52, 20)
GuiCtrlCreateLabel($txt2 & ":", 10, 50)
$URLEdit=GuiCtrlCreateInput( $URL, 100, 48, 260, 20)
$restore2=GUICtrlCreateButton($txt8,365, 50, 52, 20)
GuiCtrlCreateLabel($txt4 & ":", 10, 80)
$URLComment=GuiCtrlCreateInput( $Comment, 100, 78, 260, 20)
$restore3=GUICtrlCreateButton($txt8,365, 80, 52, 20)
GuiCtrlCreateLabel($txt5 & ":", 10, 110)
$URLIcon=GuiCtrlCreateInput( $Icon, 100, 108, 260, 20)
$Iconlabel=GuiCtrlCreateLabel($txt14, 420, 5)
GUICtrlSetFont($IconLabel, 6.5, 400, 0,"Arial Bold")
if FileExists($defIconPath & "\Win2Tux.xpm")=0 Then
Filecopy($Win2Tux & "\Icons\Win2Tux.xpm",$defIconPath & "\Win2Tux.xpm")
Filecopy($Win2Tux & "\Icons\K-Meleon.xpm",$defIconPath & "\K-Meleon.xpm")
Filecopy($Win2Tux & "\Icons\Html.xpm",$defIconPath & "\Html.xpm")
EndIf
if FileExists($deficon)=0 Then
URLIcon()
sleep(3000)
EndIf
$image=GUICtrlCreatePic($Win2Tux & "\Images\" & StringReplace($IconName,".xpm",".jpg"), 427, 18, 48, 48)
$restore4=GUICtrlCreateButton($txt8,365, 110, 52, 20)
$Browse4=GUICtrlCreateButton($txt7, 425, 110, 52, 20)
GuiCtrlCreateLabel($txt6 & ":", 10, 140)
$location=GuiCtrlCreateInput( $path, 100, 138, 260, 20)
$restore5=GUICtrlCreateButton($txt8,365, 140, 52, 20)
$Browse5=GUICtrlCreateButton($txt7, 425, 140, 52, 20)
$htitle=GuiCtrlCreateLabel("----------[ URL2Km " & $version & " (" & $datVers & ") ]-----------------------------------------------------------------------------------------------------------------",0,166,500,30)
GUICtrlSetFont($htitle, 7, 400, 0,"Arial Bold")
$Create=GUICtrlCreateButton($txt9,175, 178, 100, 25)
$_Win2Tux=GUICtrlCreateButton("Win2Tux",365, 178, 52, 25)
$Quit=GUICtrlCreateButton($txt10,425, 178, 52, 25)
$Quit_OK=GUICtrlCreateButton($txt10&"_OK",425, 78, 52, 25)
;=========================
; Define GUICtrl functions
;=========================
;Close
GUISetOnEvent($GUI_EVENT_CLOSE,"Quit")
GUICtrlSetOnEvent($Quit, "Quit")
GUICtrlSetOnEvent($Quit_OK, "Quit")
;Win2Tux
GUICtrlSetOnEvent($_Win2Tux, "Win2Tux")
;Launcher name
GUICtrlSetOnEvent($URLName, "URLName")
GUICtrlSetOnEvent($restore1, "restore1")
;URL
GUICtrlSetOnEvent($URLEdit, "URLEdit")
GUICtrlSetOnEvent($restore2, "restore2")
;Comment
GUICtrlSetOnEvent($URLComment, "URLComment")
GUICtrlSetOnEvent($restore3, "restore3")
;Icon
GUICtrlSetOnEvent($URLIcon, "URLIcon")
GUICtrlSetOnEvent($restore4, "restore4")
GUICtrlSetOnEvent($Browse4, "Browse4")
;Location
GUICtrlSetOnEvent($location, "location")
GUICtrlSetOnEvent($restore5, "restore5")
GUICtrlSetOnEvent($Browse5, "Browse5")
;===============
; Boucle OnEvent
;===============
GuiSetState()
While true
Sleep(1000)
WEnd
;==================
; GUICtrl functions
;==================
Func Quit()
Exit
EndFunc
Func Win2Tux()
$cmd='"'& $Win2Tux & "\Win2Tux.exe"& '"'
run($cmd)
sleep(5000)
Quit()
EndFunc
;=====
; Name
;=====
Func URLName()
EndFunc
Func restore1()
if $defname <> GUICtrlRead($URLname) Then
GUICtrlSetData($URLname,$defname)
EndIf
EndFunc
;=====
; URL
;=====
Func URLEdit()
EndFunc
Func restore2()
if $defURL <> GUICtrlRead($URLEdit) Then
GUICtrlSetData($URLEdit,$defURL)
EndIf
EndFunc
;========
; Comment
;========
Func URLComment()
EndFunc
Func restore3()
if $defcomment <> GUICtrlRead($URLComment) Then
GUICtrlSetData($URLComment,$defcomment)
EndIf
EndFunc
;=====
; Icon
;=====
Func URLIcon()
if FileExists(GUICtrlRead($URLIcon))=0 then
GUICtrlSetData($URLIcon,$deficon)
Else
$IconName=GUICtrlRead($URLIcon)
while StringInStr($IconName,"\")>0
$IconName=StringMid($IconName,StringInStr($IconName,"\")+1)
WEnd
msgbox(0,"file",$IconName)
if FileExists($Win2Tux & "\Images\" & StringReplace($IconName,".xpm",".jpg"))=0 Then
if $vers<675 Then
runwait($convert & ' "' & Anti2Slash(GUICtrlRead($URLIcon)) & '" ' & $Win2Tux & "\Images\" & StringReplace($IconName,".xpm",".jpg"))
Else
runwait($convert & ' -background grey -alpha remove "' & Anti2Slash(GUICtrlRead($URLIcon)) & '" ' & $TuxTemp & "/icon.jpg")
EndIf
EndIf
GUICtrlSetImage($Image, $Win2Tux & "\Images\" & StringReplace($IconName,".xpm",".jpg"))
EndIf
EndFunc
Func Browse4()
$newIcon=FileOpenDialog("Search for an icon",$iconPath,"Icon files(*.xpm;*.jpg)",1)
msgbox(0,"result",$newIcon)
if $newIcon<>GUICtrlRead($URLIcon) and $newIcon<>"" then
GUICtrlSetData($URLIcon,$newIcon)
$Icon=$newIcon
EndIf
EndFunc
Func restore4()
if $deficon <> GUICtrlRead($URLIcon) Then
GUICtrlSetData($URLIcon,$deficon)
EndIf
EndFunc
;=========
; Location
;=========
Func location()
if FileExists(GUICtrlRead($location)&"\*.*")=0 then
GUICtrlSetData($location,$defpath)
EndIf
EndFunc
Func restore5()
if $defpath <> GUICtrlRead($location) Then
GUICtrlSetData($location,$defpath)
EndIf
EndFunc
;===================================================================================
; Decode path
;===================================================================================
Func Calculate($V)
$W = ""
do
$X = StringLeft($V,2)
if $X = "00" then
$V = ""
else
$V = StringMid($V,3)
$W = $W & chr(Dec($X))
endif
until StringLen($V)=0
$V = $W
if StringLeft($V,2)="gui.." then
$V = $TuxProfile & "/.wine" & StringMid($V,3)
endif
Return $V
EndFunc
;===============================
; Convert Win path to Linux path
;===============================
Func Anti2Slash($V)
$V=StringReplace($V, "\", "/")
$W = $V
$disk = StringMid(RegRead("HKLM\System\MountedDevices","\DosDevices\" & StringLeft($W,2)),3)
$V = Calculate($disk)
if $V<>"/" Then
$V = $V & "/" & StringMid($W,4)
Else
$V = $V & StringMid($W,4)
EndIf
Return $V
EndFunc
;===================================================================================
; End of file
;===================================================================================
Si quelqu'un a une idée ...
PS: devrait pouvoir être lancé sans risque, car il n'y a pas encore de RegWrite, jusque quelques RegRead qui ne devraient pas trop poser de problème pour une éventuelle exécution.