
Cubehead
Members-
Posts
14 -
Joined
-
Last visited
Cubehead's Achievements

Seeker (1/7)
0
Reputation
-
Convert API VB to "DllCall" function (useful for your job)
Cubehead replied to Helomotorola's topic in AutoIt Example Scripts
Hi Helomotorola,nice utility you have here. You can find some information about types in the "DllCall" section of the AutoIt documentation : http://www.autoitscript.com/autoit3/docs/f...ons/DllCall.htm -
Hi Paulie, this should fix your problem. Func _Factorial($n_Number) Local $result = 1.0 ;<== my modification For $i = $n_Number to 1 step -1 $result = $result*$i Next Return $result EndFunc Cubehead
-
Should now work under AutoIt v3.2.2, but I make no garantees. Cubehead HTTP.au3
-
Thanks a lot SmOke_N and D'oh ! I should have paused and look at the problem with a little bit of distance and from another angle. Oh well. Cubehead
-
Hi, I'm running into regular expressions trouble (again). I need to check if a string is composed of 6 hexadecimal characters. In v3.2.0.1 I used something like $nDummy = StringRegExp($strString, "^([:xdigit:]{6})$", 0). It worked perfectly. In v3.2.1.14 the pattern is not valid, and the @extended error tells me that the pattern is invalid at the "[" character. Can someone help me fix my pattern ? Thanks in advance. Cubehead
-
Hi dnsi, May be you could modify your code this way, to avoid the magic number (100 in this instance). TCPStartup() Dim Const $MAX_CONNECTIONS = 100 Dim $link[$MAX_CONNECTIONS] $vvv=0 While $vvv<$MAX_CONNECTIONS $link[$vvv]=-1 $vvv=$vvv+1 WEnd $main=TCPListen(@IPAddress1,9999) While 1=1 $i=0 While $i<$MAX_CONNECTIONS If $link[$i]=-1 Then $link[$i]=TCPAccept($main) ExitLoop EndIf $i=$i+1 WEnd $j=0 While $j<$MAX_CONNECTIONS If $link[$j]<>-1 Then $recv=TCPRecv($link[$j],10000) if $recv<>"" Then $ddd=0 While $ddd<$MAX_CONNECTIONS If $link[$ddd]<>-1 Then TCPSend($link[$ddd],$recv) EndIf $ddd=$ddd+1 WEnd EndIf EndIf $j=$j+1 WEnd WEnd Cubehead
-
I would like to check if a string is a valid login which can be between 3 and 32 character long, containing alphanumeric characters, with a possibility of the dot, hyphen or underscore, and starting with a alphabetic character. The pattern is matched, even if the string starts with a digit. Now that I think of it, maybe I should try an exclusion... Edit : found the solution. I can use ^ for a starting anchor and $ for an ending one. So my pattern should be "^([a-z][a-z0-9_.-]{2,31})$". I think that this information should go into the manual. Thanks for your time.
-
Hi, I would like to test something with this pattern "[a-z][a-z0-9_.-]{2,31}". How can I ensure that the string tested starts (or ends) with the pattern ? I've been trying to find the information in the manual (beta 3.2.1.10), without success. Thanks in advance.
-
Nice, but you could easily improve it's robustness like so : Func _xRoot( $num, $root ) If $root == 0 Then Return "Indeterminate" Else Return $num ^ ( 1 / $root ) EndIf EndFunc
-
Gah, I knew I should have double checked my post. Thanks for your answer.
-
Hi, when I use something like $var=StringRegExp($somestring, "[a-z]{1,10}") it works but if I try to use $var=StringRegExp($somestring, "[a-z]{1,}]"), I get an @error = 2. What am I doing wrong ? I'm using the v3.1.1.120 beta
-
You can also present yourself as an ingrate endowned a powerful sense of entitlement, doesn't mean you have to, now does it ? Cubehead
-
Thank you very much guys for the swift answer. Cubehead
-
Hi, I'm doing my first GUI script with AutoIt and I can't seem to be able to make the combo box control work properly. It doesn't show the dropdown list on my computer. I'm using the v3.1.1.61 (beta). Does anybody knows what I'm doing wrong ? The code follows. #include <GUIConstants.au3> #include <GUICombo.au3> #NoTrayIcon ;Variables $strModem="" $strLogin="" $strPassword="" $strMGCPName="" $nDummy=0 ;Création de la fenêtre principale $wndMain=GUICreate("Configurateur", 400, 270) ;Création des boutons $btnConf=GUICtrlCreateButton("&Configurer", 5, 240, 100, 25) $btnExpert=GUICtrlCreateButton("&Expert", 105, 240, 100, 25) $btnQuitter=GUICtrlCreateButton("&Quitter", 295, 240, 100, 25) ;Création du groupe $grpGroup=GUICtrlCreateGroup("",5 ,5, 390, 225) $lblModem=GUICtrlCreateLabel("Modem :", 40, 40, 100, 25) $cbxModem=GUICtrlCreateCombo("Hitachi AH4021", 140, 40, 200, 25, $CBS_DROPDOWNLIST); <== This the problematic part. GUICtrlSetData($cbxModem, "Thomson ST530v5|Comtrend CT633", "Hitachi AH4021") GUISetState() $lblLogin=GUICtrlCreateLabel("Nom d'utilisateur :", 40, 80, 100, 25) $inpLogin=GUICtrlCreateInput("", 140, 80, 200, 20) $lblPassword=GUICtrlCreateLabel("Mot de passe :", 40, 120, 100, 25) $inpPassword=GUICtrlCreateInput("", 140, 120, 200, 20) $lblMGCPName=GUICtrlCreateLabel("Code téléphonie :", 40, 160, 100, 25) $inpMGCPName=GUICtrlCreateInput("", 140, 160, 200, 20) GUICtrlCreateGroup("",-99 ,-99, 1, 1) ;Création de la fenêtre secondaire $wndExpert=GUICreate("Configurateur", 270, 180, -1, -1, -1, $WS_EX_TOPMOST, $wndMain) ;Création des boutons $btnRenewIP=GUICtrlCreateButton("&Renouveler l'adresse IP", 5, 150, 150, 25) $btnOK=GUICtrlCreateButton("&Ok", 165, 150, 100, 25) ;Création du groupe $grpGroup2=GUICtrlCreateGroup("Mode de connexion",60 ,20 , 160, 90) $rdoPPPOA = GUICtrlCreateRadio("PPPoA", 80, 40, 120, 20) ;GUICtrlSetState ($rdoPPPOA, $GUI_CHECKED) $PPPoA=1 $rdoPPPOE = GUICtrlCreateRadio("PPPoE", 80, 80, 120, 20) GUICtrlCreateGroup("",-99 ,-99, 1, 1) GUISwitch($wndMain) GUISetState(@SW_SHOW) While 1 $msg = GUIGetMsg(1) Select Case $msg[0] = $btnOK $nDummy=ShowMainWindow() $nDummy=CheckRadioButton() Case $msg[0] = $btnExpert $nDummy=ShowExpertWindow() Case $msg[0] = $btnRenewIP $nDummy=OnRenewIPButtonclick() Case $msg[0] = $btnConf $nDummy=OnConfButtonclick() Case $msg[0] = $btnQuitter $nDummy=ConfirmExit() Case $msg[0] = $GUI_EVENT_CLOSE And $msg[1] = $wndMain $nDummy=ConfirmExit() Case $msg[0] = $GUI_EVENT_CLOSE And $msg[1] = $wndExpert $nDummy=ShowMainWindow() EndSelect Wend ;Affiche la fenêtre principale Func ShowMainWindow() GUISetState(@SW_HIDE) GUISwitch($wndMain) GUISetState(@SW_SHOW) Return 0 EndFunc ;Affiche la fenêtre expert Func ShowExpertWindow() GUISwitch($wndExpert) If $PPPoA==1 Then GUICtrlSetState($rdoPPPOA, $GUI_CHECKED) Else GUICtrlSetState($rdoPPPOE, $GUI_CHECKED) EndIf GUISetState(@SW_SHOW) Return 0 EndFunc ;Vérifie l'état des boutons radio de la fenêtre expert Func CheckRadioButton() If GUICtrlRead($rdoPPPOA)==$GUI_CHECKED Then $PPPoA=1 Else $PPPoA=0 EndIf Return 0 EndFunc ;Gère le click sur le bonton Configurer Func OnConfButtonclick() ;récupération des paramètres $strModem=GUICtrlRead($cbxModem) $strLogin=GUICtrlRead($inpLogin) $strPassword=GUICtrlRead($inpPassword) $strMGCPName=GUICtrlRead($inpMGCPName) If $strModem=="" Then MsgBox(16, "Erreur", "Veuiilez sélectionner un modem") Return 1 ElseIf $strLogin=="" Then MsgBox(16, "Erreur", "Veuillez rentrer votre nom d'utilisateur") Return 2 ElseIf $strPassword=="" Then MsgBox(16, "Erreur", "Veuillez rentrer votre mot de passe") Return 3 Else MsgBox(64, "Information", $strModem & " " & $strLogin & " " & $strPassword & " " & $strMGCPName) Return 0 EndIf EndFunc ;Gestion du bouton Renouveller l'IP Func OnRenewIPButtonclick() MsgBox(4096+64, "Information", "IP release/renew") Return 0 EndFunc ;Confirmation de sortie Func ConfirmExit() If MsgBox(32+4, "Confirmation", "Êtes-vous sûr de vouloir quitter ?")==6 Then Exit EndIf Return 0 EndFuncThanks in advance. Cubehead