Quantcast
Channel: AutoIt v3 - General Help and Support
Viewing all 12506 articles
Browse latest View live

Code 128 Optimisation

$
0
0

Hi guys,

 

I'm working at making a ZPL template, which is gonna print also a Bar Code (Code 128).

Now, I'd like to optimize this code rather than using Subset B (Ascii) everytime.

 

To make it short, if I have this string:

WT0F525M23112013001

It needs to become like this:

:WT0F525M>523112013001

 

If I have this string:

1234567WT0F525M231120130A01

It'll be:

;123456>6WT0F525M>523112013>60A01

 

These are the outputs in order to have an optimised code 128 bar code.

":" starts the subset B at the beginning of the string. If there's a number greater (or same) than 4 digits, it'll be ";" which starts subset C.

Subset C can only work with pair digits (so every 2) and it's useless to be used with less than 4.

 

So with this rules in mind, is there any suggestion on the code I can write to have this happening?

 

Is there a way to split the string in arrays of numbers and letters? I think this will help me with controlling parts by parts

For instance WT0F525M23112013001, I'd like to see:

$array[0] -> Counter of arrays

$array[1] -> WT

$array[2] -> 0

$array[3] -> F

$array[4] -> 525

$array[5] -> M

$array[6] -> 231120130001

 

So now I could just check if it begins with a letter or with a number, and if it's a number, check its lenght, if same or greater than 4 add ";" at the beginning on the new string, then check if it's odd or even, if it's odd, add <6 and the last number afterwards in the new string then "Next" to the other container and so on..

 

Sorry for the confusion, but I'm confused myself.. I know how it works, I'm just trying to keep the code as smaller as possible and avoid useless operations.

 

Thanks


Enumeration Help

$
0
0

Hello,

 

I want to ask you how to handle the enum keyword in AutoIt, since I am not very familiar with enumerations in AutoIt.

So, I already checked the Help files description, for enums:  http://www.autoitscript.com/autoit3/files/beta/autoit3-docs/keywords/Enum.htm

But, I am currently playing arround with DllCall's and stuff, I have a enumeration like this:

 

Return code/valueDescription

 

FILE_TYPE_CHAR 0x0002

The specified file is a character file, typically an LPT device or a console.

FILE_TYPE_DISK 0x0001

The specified file is a disk file.

FILE_TYPE_PIPE 0x0003

The specified file is a socket, a named pipe, or an anonymous pipe.

FILE_TYPE_REMOTE 0x8000

Unused.

FILE_TYPE_UNKNOWN 0x0000

Either the type of the specified file is unknown, or the function failed.

 
In C# I would enumerate it like this:
 

enum FileType : uint

    {
    FileTypeChar = 0x0002,
    FileTypeDisk = 0x0001,
    FileTypePipe = 0x0003,
    FileTypeRemote = 0x8000,
    FileTypeUnknown = 0x0000,
    }

 

But I am not sure how to do it with AutoIt.

How can I clear make a enumeration with all variables holding the differnent values?

Can someone point me to the right direction? :)

Scripts Icon

$
0
0
How can I recall the icon that I compiled with the script?

#AutoIt3Wrapper_Icon=icon.ico

I would like to make a GUI control with the icon.

Send window behind all the rest

$
0
0

Is there a way to send a newly created GUI window to the rear of all the rest?

 

Only thing I could think of is doing a WinList() and Activating each one till all are above the newly created GUI.

dont go _INetSmtpMail ??

$
0
0

hi  guy

 

i have  tryed   send  email, without  client , and i use   this   script  but  have some  questions 

 

 

#include <Inet.au3>

Local $s_SmtpServer = "mysmtpserver.com.au"
Local $s_FromName = "My Name"
Local $s_FromAddress = "From eMail Address"
Local $s_ToAddress = "To eMail Address"
Local $s_Subject = "My Test UDF"
Local $as_Body[2]
$as_Body[0] = "Testing the new email udf"
$as_Body[1] = "Second Line"
Local $Response = _INetSmtpMail($s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $s_Subject, $as_Body)
Local $err = @error
If $Response = 1 Then
    MsgBox(0, "Success!", "Mail sent")
Else
    MsgBox(0, "Error!", "Mail failed with error code " & $err)
EndIf

 

 

use mail.google.com  like  smtp

 

Q.1.  but i can set  user  password and  port  for  smtp server???

Q.2.  give me   error  4   Unable to create socket ,  why ????

 

thankzz

 

PostMessage to Drag files/text

$
0
0

Hi, this is my first post, I been reading a lot of post related with this subject, but I still cant find the appropiate way to solve the problem.
Im trying to Drag to select text on a minimized control (firefox flash).

But before trying that, Im setting a code to Drag a file within a window (like if using real mouse to click at x1,y1 move to x2,y2 release at x2,y2), if it work, I expect to see the file swap his position with other. I obtain the coordinates with "Autoit v3 Window Info" on the "Control" section.

At first, I thought PostMessage only worked with window's handles but tested a double click on the file position using the control handle and it works (maximized or minized). That helped me too to make sure the PostMessage-MouseInputNotifications work and the coordinates were correct.

My code is:

$winHan = WinGetHandle("[TITLE:ExampleFolder; Class:CabinetWClass]") $conHan = controlgethandle($winHan,"","[CLASS:SysListView32; INSTANCE:1]") $MK_LBUTTON = 0x0001 $WM_MOUSEMOVE   = 0x0200 $WM_LBUTTONDOWN = 0x0201 $WM_LBUTTONUP   = 0x0202 $dll = DllOpen("User32.dll") DllCall($dll, "bool", "PostMessage", "hwnd", $conHan, "int", $WM_LBUTTONDOWN,   "int", 0,       "long", _MakeLong(250,200))   ;Left Button Down at position 1 Sleep(100) DllCall($dll, "bool", "PostMessage", "hwnd", $conHan, "int", $WM_MOUSEMOVE, "int", $MK_LBUTTON, "long", _MakeLong(700,450))   ;Move to position 2 Sleep(20) DllCall($dll, "bool", "PostMessage", "hwnd", $conHan, "int", $WM_LBUTTONUP, "int", 0,       "long", _MakeLong(700,450))   ;Left Button Up at position 2 DllClose($dll) Func _MakeLong($iLo, $iHi)    Return BitOR(BitShift($iHi, -16), BitAND($iLo, 0xFFFF)) EndFunc

So i have the .au3 file on my desktop and the ExampleFolder is open.

 

I tried to do a WinSetState($winHan,"",@SW_MAXIMIZE) and/or a ControlFocus ($winHan,"",$conHan) before the DllCall.

I tried to have the .au3 file inside the ExampleFolder.

I tried to use $MK_LBUTTON as the Wparam  for the $WM_LBUTTONDOWN message (Im not sure if it should be Null or $MK_LBUTTON).

I tried to do a $WM_LBUTTONDOWN at x1,y,1 and $WM_LBUTTONUP at x1,y,1 before those 3 messages on my code.

 

Something weird is, it works "very few times", after minimizing/closing/maximizing/open the folder..

The folder is in a subpath of my desktop (Desktop\Autoit\Tools\ExampleFolder) and I open it with a serie of double clicks so I think is allways a CabinetWClass (Not sure).

 

You see any error on the code?

The ClickDown-Move-ClickUp is equivalent to a drag operation?

What should be the Wparam for the $WM_LBUTTONDOWN message?

You know whats the recomendable way to set the sleep() values?

It could be some issue with the operative system (Im using xp)?

 

If Im not clear with something, please tell me :)

Get remote SESSIONAME to StdoutRead, for logoff purpose

$
0
0

Hi,

 

I'm trying to get remote SESSIONNAME to StdoutRead, for logoff purpose using qwinsta | findstr and cut (from http://unxutils.sourceforge.net/). It works in command prompt but can't get it in script.

 

Help is needed, anyone have a clue?

(code below)

  1. #include <Constants.au3>
  2.  
  3. Local $server="server", $domain="domain", $user="user", $password="passwd"
  4.  
  5. $var = 'qwinsta.exe '&$user&' /server:'&$server&' | findstr rdp | cut -c2-11'
  6. ; result should be: rdp-tcp#0
  7.  
  8. MsgBox(0, "STDOUT read:", _getDOSOutput($var))
  9. ; but nothing appears in MsgBox
  10.  
  11. Runwait(@ComSpec & " /c " & 'logoff '&_getDOSOutput($var)&' /SERVER:'&$server&'', "", @SW_HIDE)
  12.  
  13. Func _getDOSOutput($command)
  14.     Local $text = '', $Pid = Run('"' & @ComSpec & '" /c ' & $command, '', @SW_HIDE, 2 + 4)
  15.     While 1
  16.             $text &= StdoutRead($Pid, False, False)
  17.             If @error Then ExitLoop
  18.             Sleep(10)
  19.     WEnd
  20.     Return StringStripWS($text, 7)
  21. EndFunc   ;==>_getDOSOutput

not send image (UDF _WinHttpSimpleFormFill)

$
0
0

server php source....is

 

save to upload.php

 

------------------------------------------------------------------------------------------

<html>
<head>
<title>File Upload</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" >
</head>
<body>
<form enctype="multipart/form-data" action="upload.php" method="POST">
<input type="hidden" name="MAX_FILE_SIZE" value="4000000">
<input name="upfile" type="file"><br>
<input type="submit" name="submit" value="Upload">
</form>
</body>

<?php
if (isset($_POST['submit']) && !empty($_FILES["upfile"]) && move_uploaded_file($_FILES['upfile']['tmp_name'], "up/".basename($_FILES['upfile']['name']))) {
   echo "move ok "."up/".basename($_FILES['upfile']['name']);
} else {
  echo "not move ".$_FILES['upfile']['error']." ->".$_FILES['upfile']['tmp_name']." ->".$_FILES['upfile']['type'];
}
?>

---------------------------------------------------------------------------------------------------

 

upload.au3 source.....

#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Res_Language=1042
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#include "WinHttp.au3"
Global Const $Adresas = "test_website.com"
$subdomain = "/upload.php"
$file = @scriptdir & "\tttt.txt"
Global $test = _WinHttpCreateUrl($Adresas)
Global $hOpen = _WinHttpOpen("Mozilla/5.0 (Windows NT 6.1; WOW64; rv:15.0) Gecko/20100101 Firefox/15.0.1")
Global $hConnect = _WinHttpConnect($hOpen, $Adresas)
$Token = _WinHttpSimpleRequest($hConnect, "POST")

Global $sHTM = _WinHttpSimpleFormFill($hConnect, $subdomain, "index:0", "name:upfile", $file ,"X-Atlassian-Token: nocheck")

_WinHttpCloseHandle($hConnect)
_WinHttpCloseHandle($hOpen)

ConsoleWrite($sHTM )

 

it's tttt.txt is upload......Successfully uploaded.

 

but

$file = @scriptdir & "\tttt.jpg"

   or

$file = @scriptdir & "\tttt.zip"

 

 

don't upload.......  

echo $_FILES['upfile']['error'] ==> value is 3...

 

 

 

 

 

how to can image or zip file upload????


AutoIt Original Version

$
0
0

Hi! This is my first time to install autoit and I got problem in installing it. I have successfully download autoit v.3.3.9.22 Beta but when I stated to download it. Installation failed. There was a message "I have to download the original version". Where can I find the original version?

Creating a panel control

$
0
0

Maybe my question is not accurate but what I'm trying to say is in this link taietel created a panel in the left side and used labels like tabs. But as I am a novice, the code is too complicated for me. Is there any easy way to do it?

 

P.S. Sorry, If I'm bothering you with my questions.

Want to create a file in size KB

$
0
0

Greetings

 

Hi I want to create a file of size 485 KB.

 

How can i do that

 

 

Thanks

proper url or ip

$
0
0

I am in situation where i wanted to know if value of variable is proper url or ip addres

 

if there is good way kindly share

Give me an example script for posting on my 3 different Facebook pages..

$
0
0

I already spend two days by reviewing AutoIt Documentation and I still don't know what to do..

 

Would you please give me a full example script how to do these steps:

  1. Start the AutoIt script.
  2. A customized GUI will now appear.
  3. I will input the 3 URLs of my Facebook pages on the GUI and save them!
  4. Now I will log in my Facebook account manually.
  5. Post a photo with message on the GUI.
  6. The content will now start posting on my 3 different FB pages.
  7. When it's finish, I will click "Close" on the GUI but the 3 URLs will be saved.
  8. And then the script will now be exited.
  9. But when I open it again the 3 URLs of my pages will still be there!

If you can't provide me this hard thing, just please refer me to the specific example scripts that matches those actions.

I'm really tired right now and I think, this is the right time to ask for a help.

Anyway, thanks for any help..

SetError returned error

$
0
0
Hello,

I have an infinity while...wend loop. Within the while loop i have a for...next loop.
In the for/next loop i am calling a function and checking if it returns an error or a value, something like this:
Local $hState = 1 While (True) If $hState Then For $i = 0 To 10 $sFunc = _myFanc() If @error Then ConsoleWrite("Error: " & @error & @CRLF) ExitLoop ;will exit for/next loop and restart the whole proccess Else ConsoleWrite($sFunc & @CRLF) EndIf Next EndIf Sleep(100) WEnd
However if the $sFunc returns an error once, everytime the loop is restarted it will return the same error.
In _myFunc() i have 3 SetErrors
SetError(1)
SetError(2)
SetError(3).

Any ideas? I haven't quitly used SetError function so i am not sure if my bug is that function.

Cheers

GUI hang (not responsive)

$
0
0

I never face something like this, so here it is:

 

Using taietel's GUI Panel (http://www.autoitscript.com/forum/topic/146952-gui-design-concepts/) and

modified Google Maps UDF by kescho (http://www.autoitscript.com/forum/topic/115437-google-maps-udf/?p=1132056)

 

I come up with this code:

AutoIt         
;http://www.autoitscript.com/forum/topic/146952-gui-design-concepts/ ;by taietel ;_Google Maps v2.au3 download at http://www.autoitscript.com/forum/topic/115437-google-maps-udf/?p=1132056 #include <GuiConstants.au3> #include <EditConstants.au3> #include <WindowsConstants.au3> #include <StaticConstants.au3> #include <_Google Maps v2.au3> #region GLOBAL VARIABLES Global $iW = 600, $iH = 400, $iT = 52, $iB = 52, $iLeftWidth = 150, $iGap = 10, $hMainGUI #endregion GLOBAL VARIABLES _MainGui() Func _MainGui()     Local $hFooter, $nMsg, $aPos     Local $iLinks = 5     Local $sMainGuiTitle = "Sample Title"     Local $sHeader = "Sample GUI"     Local $sFooter = "2012 © AutoIt"     Local $aLink[$iLinks], $aPanel[$iLinks]     $aLink[0] = $iLinks - 1     $aPanel[0] = $iLinks - 1     $hMainGUI = GUICreate($sMainGuiTitle, $iW, $iH, -1, -1, BitOR($GUI_SS_DEFAULT_GUI, $WS_MAXIMIZEBOX, $WS_TABSTOP))     GUISetIcon("shell32.dll", -58, $hMainGUI)     GUICtrlCreateLabel($sHeader, 48, 8, $iW - 56, 32, $SS_CENTERIMAGE)     GUICtrlSetFont(-1, 14, 800, 0, "Arial", 5)     GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKTOP + $GUI_DOCKWIDTH + $GUI_DOCKHEIGHT)     GUICtrlCreateIcon("shell32.dll", -131, 8, 8, 32, 32)     GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKTOP + $GUI_DOCKWIDTH + $GUI_DOCKHEIGHT)     GUICtrlCreateLabel("", 0, $iT, $iW, 2, $SS_SUNKEN);separator     GUICtrlSetResizing(-1, $GUI_DOCKTOP + $GUI_DOCKLEFT + $GUI_DOCKRIGHT + $GUI_DOCKHEIGHT)     GUICtrlCreateLabel("", $iLeftWidth, $iT + 2, 2, $iH - $iT - $iB - 2, $SS_SUNKEN);separator     GUICtrlSetResizing(-1, $GUI_DOCKTOP + $GUI_DOCKLEFT + $GUI_DOCKBOTTOM + $GUI_DOCKWIDTH)     GUICtrlCreateLabel("", 0, $iH - $iB, $iW, 2, $SS_SUNKEN);separator     GUICtrlSetResizing(-1, $GUI_DOCKBOTTOM + $GUI_DOCKLEFT + $GUI_DOCKRIGHT + $GUI_DOCKHEIGHT)     $hFooter = GUICtrlCreateLabel($sFooter, 10, $iH - 34, $iW - 20, 17, BitOR($SS_LEFT, $SS_CENTERIMAGE))     GUICtrlSetTip(-1, "AutoIt Forum", "Click to open...")     GUICtrlSetCursor(-1, 0)     GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKRIGHT + $GUI_DOCKBOTTOM + $GUI_DOCKHEIGHT)     ;add links to the left side     $aLink[1] = _AddNewLink("Link 1")     $aLink[2] = _AddNewLink("Link 2", -167)     $aLink[3] = _AddNewLink("Link 3", -222)     $aLink[4] = _AddNewLink("Link 4", -22)     ;and the corresponding GUI's     $aPanel[1] = _AddNewPanel("Title for the panel 1")     $aPanel[2] = _AddNewPanel("Title for the panel 2")     $aPanel[3] = _AddNewPanel("Title for the panel 3")     $aPanel[4] = _AddNewPanel("Title for the panel 4")     ;add some controls to the panels     _AddControlsToPanel($aPanel[1])     GUICtrlCreateEdit("", 10, 37, $iW - $iLeftWidth + 2 - 20 - 5, $iH - $iT - $iB - 40, BitOR($ES_AUTOVSCROLL, $ES_NOHIDESEL, $ES_WANTRETURN, $WS_VSCROLL), $WS_EX_STATICEDGE)     Local $sTestTxt = ""     For $i = 1 To 10         $sTestTxt &= @TAB & "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum felis lectus, pharetra vel laoreet nec, pulvinar nec justo. Donec malesuada, nunc eu faucibus sodales, diam sem tempor neque, id condimentum turpis nunc vel lacus. Nulla a nulla libero, eget eleifend dolor. Vivamus volutpat tincidunt ultricies. Vestibulum eu libero nisi, quis tincidunt nisi. Proin tincidunt, ipsum ullamcorper posuere venenatis, libero nulla venenatis enim, ultrices tincidunt ipsum arcu nec turpis. In at erat sed ipsum gravida mattis in at felis. Vivamus diam purus, dictum ut luctus vitae, sollicitudin ut velit. Maecenas velit mauris, fringilla ut condimentum bibendum, aliquam a neque. Nulla metus eros, commodo id dictum in, interdum sed ipsum. Vivamus feugiat, mi at auctor fringilla, libero lectus vulputate tortor, eu sollicitudin nulla lacus at neque." & @CRLF         $sTestTxt &= @TAB & "Sed vel ante magna. Curabitur porttitor ante in tellus bibendum non tristique diam volutpat. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. In tellus lectus, ultrices in tempus eget, sollicitudin quis eros. Curabitur at arcu bibendum massa feugiat euismod at a felis. Nunc molestie, enim non ornare tincidunt, ipsum nisi tempus sapien, quis elementum elit velit ut neque. Suspendisse eu adipiscing risus. Nam tempor odio ut elit auctor rhoncus. Etiam viverra elit id felis feugiat pellentesque pretium porttitor dui. Vivamus eu quam non ante suscipit vehicula a nec eros. Phasellus congue massa sed libero interdum ullamcorper. Quisque fringilla massa ut lorem fringilla pulvinar eget ullamcorper eros. Praesent faucibus, erat at consequat tempus, nulla erat sodales mi, eget sagittis nibh erat nec nunc. Phasellus risus nibh, porta viverra pretium nec, vehicula eget nisi." & @CRLF         $sTestTxt &= @TAB & "Sed vel neque vel urna elementum accumsan feugiat quis mauris. Sed mi nisl, consequat dapibus molestie ac, rutrum ut elit. Praesent sed risus sem. Mauris rutrum blandit magna nec tristique. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Suspendisse consequat iaculis odio nec cursus. Duis varius tincidunt ligula ac ultricies. Ut eget magna in nulla vulputate dapibus ut vel sem. Integer ac tempor risus." & @CRLF         $sTestTxt &= @TAB & "Maecenas molestie semper turpis, id tristique nibh pharetra eget. Aliquam erat volutpat. In egestas, lorem quis varius vestibulum, enim diam porta lorem, quis dictum arcu ante a diam. Nullam vel nisi mauris. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Aliquam ut leo purus, eget vulputate augue. Fusce et est sagittis felis accumsan sollicitudin eget a lectus. Cras sapien sapien, rutrum eu tempor non, tempor nec velit. Vivamus interdum adipiscing felis in malesuada. Fusce quis purus est, eget molestie turpis. In hac habitasse platea dictumst." & @CRLF         $sTestTxt &= @TAB & "Aenean eleifend risus vitae lorem laoreet facilisis. Suspendisse ac urna quam, vel rutrum sem. Sed bibendum porta tellus malesuada scelerisque. Vestibulum at ligula sed nulla sollicitudin tincidunt. Pellentesque mi magna, vulputate et aliquam a, auctor et nunc. Phasellus feugiat fringilla accumsan. Donec ultrices, elit id dapibus auctor, nunc odio viverra lorem, non commodo mi libero a libero. Cras vitae felis venenatis augue laoreet tincidunt scelerisque id odio. Proin lorem purus, molestie feugiat pretium nec, ornare aliquam turpis. "     Next     GUICtrlSetData(-1, $sTestTxt)     GUICtrlSetResizing(-1, $GUI_DOCKTOP + $GUI_DOCKLEFT + $GUI_DOCKRIGHT + $GUI_DOCKBOTTOM)     _AddControlsToPanel($aPanel[2])     GUICtrlCreateLabel("Label1", 8, 38, 36, 17)     GUICtrlSetResizing(-1, $GUI_DOCKTOP + $GUI_DOCKLEFT + $GUI_DOCKWIDTH + $GUI_DOCKHEIGHT)     Local $hInput1 = GUICtrlCreateInput("Input1", 56, 35, 121, 21)     GUICtrlSetResizing(-1, $GUI_DOCKTOP + $GUI_DOCKLEFT + $GUI_DOCKWIDTH + $GUI_DOCKHEIGHT)     Local $hButton1 = GUICtrlCreateButton("Button1", 200, 33, 75, 25)     GUICtrlSetResizing(-1, $GUI_DOCKTOP + $GUI_DOCKLEFT + $GUI_DOCKWIDTH + $GUI_DOCKHEIGHT)     _AddControlsToPanel($aPanel[3])     $gmap_ctrl = _GUICtrlGoogleMap_Create($gmap, 5, 5, 836, 426, "serbia", 10, 0, False, True, 0, 4, 3, 3, 1, "US", "C")     _AddControlsToPanel($aPanel[4])     GUICtrlCreateGroup("Group1", 8, 35, 129, 90)     GUICtrlSetResizing(-1, $GUI_DOCKTOP + $GUI_DOCKLEFT + $GUI_DOCKWIDTH + $GUI_DOCKHEIGHT)     Local $aChkBox[4]     For $i = 1 To 3         $aChkBox[$i] = GUICtrlCreateRadio("Some radio " & $i, 16, 56 + ($i - 1) * 20, 113, 17)         GUICtrlSetResizing(-1, $GUI_DOCKTOP + $GUI_DOCKLEFT + $GUI_DOCKWIDTH + $GUI_DOCKHEIGHT)     Next     GUICtrlSetState(-1, $GUI_CHECKED)     GUICtrlCreateGroup("", -99, -99, 1, 1)     ;set default to Panel1     GUISwitch($aPanel[1])     ;show the main GUI     GUISetState(@SW_SHOW, $hMainGUI)     While 1         Sleep(10)         $nMsg = GUIGetMsg(1)         Switch $nMsg[1]             Case $hMainGUI                 Switch $nMsg[0]                     Case $GUI_EVENT_CLOSE                         Exit                     Case $GUI_EVENT_MINIMIZE, $GUI_EVENT_MAXIMIZE, $GUI_EVENT_RESTORE                         $aPos = WinGetPos($hMainGUI)                         $iW = $aPos[2]                         $iH = $aPos[3]                         For $i = 0 To $aPanel[0]                             WinMove($aPanel[$i], "", $iLeftWidth + 2, $iT, $iW - $iLeftWidth + 2, $iH - $iT - $iB - 20)                         Next                     Case $aLink[1], $aLink[2], $aLink[3], $aLink[4]                         For $i = 1 To $aLink[0]                             If $nMsg[0] = $aLink[$i] Then                                 GUISetState(@SW_SHOW, $aPanel[$i])                             Else                                 GUISetState(@SW_HIDE, $aPanel[$i])                             EndIf                         Next                     Case $hFooter                         ;ShellExecute("<a href='http://www.autoitscript.com/forum/topic/146952-gui-design-concepts/' class='bbc_url' title=''>http://www.autoitscript.com/forum/topic/146952-gui-design-concepts/"</a>)                 EndSwitch             Case $aPanel[2]                 Switch $nMsg[0]                     Case $hButton1                         MsgBox(32, "Test", "You have " & GUICtrlRead($hInput1) & "?")                 EndSwitch             Case $aPanel[4]                 Switch $nMsg[0]                     Case $aChkBox[1], $aChkBox[2], $aChkBox[3]                         For $i = 1 To 3                             If GUICtrlRead($aChkBox[$i]) = $GUI_CHECKED Then MsgBox(64, "Test", "You checked nr. " & $i & "!")                         Next                 EndSwitch         EndSwitch     WEnd EndFunc   ;==>_MainGui Func _AddNewLink($sTxt, $iIcon = -44)     Local $hLink = GUICtrlCreateLabel($sTxt, 36, $iT + $iGap, $iLeftWidth - 46, 17)     GUICtrlSetCursor(-1, 0)     GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKTOP + $GUI_DOCKWIDTH + $GUI_DOCKHEIGHT)     GUICtrlCreateIcon("shell32.dll", $iIcon, 10, $iT + $iGap, 16, 16)     GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKTOP + $GUI_DOCKWIDTH + $GUI_DOCKHEIGHT)     $iGap += 22     Return $hLink EndFunc   ;==>_AddNewLink Func _AddNewPanel($sTxt)     Local $gui = GUICreate("", $iW - $iLeftWidth + 2, $iH - $iT - $iB, $iLeftWidth + 2, $iT, $WS_CHILD + $WS_VISIBLE, -1, $hMainGUI)     GUICtrlCreateLabel($sTxt, 10, 10, $iW - $iLeftWidth - 20, 17, $SS_CENTERIMAGE)     GUICtrlSetFont(-1, 9, 800, 4, "Arial", 5)     GUICtrlSetResizing(-1, $GUI_DOCKTOP + $GUI_DOCKLEFT + $GUI_DOCKWIDTH + $GUI_DOCKHEIGHT)     Return $gui EndFunc   ;==>_AddNewPanel Func _AddControlsToPanel($hPanel)     GUISwitch($hPanel) EndFunc   ;==>_AddControlsToPanel

The problem is when I click on "Link 3" to display Google Maps and then let the window loose focus for few secs,

and then back to the script/GUI, the GUI will be "hang" (not responding).

The only way is to terminate it.

 

To try it, download _Google Maps v2.au3 from http://www.autoitscript.com/forum/topic/115437-google-maps-udf/?p=1132056

 

What has happened?

 

Edit: it works great without google maps, but the problem is not with the google maps udf. Other google maps script (example) without this GUI panel is working great


Cancel an Exit Event

$
0
0

Hi Guys,

 

 

This is probably a simple question but im bumping my head against a wall currently.

 

 

I have a script/app that I do not want a use to close by mistake when a certain Task is in progress. As such I created an Exit function and posed a question within the function that asks a user if they are sure they want to exit as the Task is still running.

 

The problem I have is regardless on wether the user clicks on YES or NO the script still exits when it his the end of the function. Here is a sample of my code.

AutoIt         
$oMyError = ObjEvent("AutoIt.Error","MyErrFunc") OnAutoItExitRegister("ExitDaApp") $CaptureStatus = True #include <GUIConstantsEx.au3> #include <TabConstants.au3> #include <WindowsConstants.au3> Global $GuiMain = GUICreate("Test", 943, 523, 176, 129) GUISetState(@SW_SHOW) While 1     $nMsg = GUIGetMsg()     Switch $nMsg         Case $GUI_EVENT_CLOSE             Exit     EndSwitch     If $CaptureStatus = True Then         ReadLogs()     EndIf     Sleep(10) WEnd ;----------------------------------------------------------------------------- ;ExitDaApp - FUNCTION TO ;----------------------------------------------------------------------------- Func ExitDaApp()     SplashOff()     If $CaptureStatus = True Then         If Not IsDeclared("iMsgBoxAnswer") Then Local $iMsgBoxAnswer         $iMsgBoxAnswer = MsgBox(262420,"EXIT","Capture currently running, Are you sure you want to exit?")         If $iMsgBoxAnswer = "6" Then             Exit         Else             Return         EndIf     Else         Exit     EndIf EndFunc ;===> ExitDaApp ;----------------------------------------------------------------------------- ;ReadLogs - FUNCTION TO ;----------------------------------------------------------------------------- Func ReadLogs()     ;just read through soem log files. EndFunc ;===> ReadLogs

FTP problems

$
0
0

Hello again,

AutoIt         
Func _putFiles() Local $connection = _FTP_Open('MyFTP Control') If @error Then ConsoleWrite("FTP Open error : " & @error & @CRLF) Local $Conn = _FTP_Connect($connection, $server, $username, $pass) If @error Then ConsoleWrite("FTP Connect error : " & @error & @CRLF)       If $Conn = 0 Then              MsgBox(0, "Error", "No internet connection, please try again")              Exit          Else              _FTP_DirSetCurrent($connection, $hdir)             If @error Then ConsoleWrite("FTP Current dir set : " & @error & @CRLF)             local $Remote_List = _Ftp_ListToArray($connection, 2)             If @error Then ConsoleWrite("FTP List to array error : " & @error & @CRLF)             _ArrayDisplay($Remote_List, "something")             If @error Then ConsoleWrite("Array display error : " & @error & @CRLF)             _FTP_FilePut($connection, $aFile, $destfile)             If @error Then ConsoleWrite("FTP File put error : " & @error & @CRLF)             sleep(100)         EndIf Local $Ftpc = _FTP_Close($connection) If @error Then ConsoleWrite("FTP Close error : " & @error & @CRLF) EndFunc

Console gives me this

 

FTP Current dir set : -1
Array display error : 1
FTP File put error : -1
 
No array is displayed and no file is being uploaded. Tried looking around the forum, nothing actually useful for resolving this problem  was found (except the consolewrite with error lines, was using mine version)
 
Any ideas what might be wrong? I am sure i can get connection, because i was having another errorcheck that showed me the wellcome message from the FTP server. I am trying to upload single bin file with the name 1111.22.33.44.55.bin
 
Local $aFile = @TempDir & "\" & $date &".bin " Local $destfile = $date & ".bin"

The other functions in the program work fine (i.e. file being properly created and such, variables are OK )

 

 

Note : the FTP server seems to use TLS, but regular connections are OK too

 

Some output from winscp log

AutoIt         
 2013-11-26 11:04:17.008 220---------- Welcome to Pure-FTPd [privsep] [TLS] ---------- < 2013-11-26 11:04:17.008 220-You are user number 5 of 128 allowed. < 2013-11-26 11:04:17.008 220-Local time is now 12:04. Server port: 21. < 2013-11-26 11:04:17.008 220-This is a private system - No anonymous login < 2013-11-26 11:04:17.008 220-IPv6 connections are also welcome on this server. < 2013-11-26 11:04:17.008 220 You will be disconnected after 5 minutes of inactivity. > 2013-11-26 11:04:17.008 USER .. < 2013-11-26 11:04:17.008 331 User .. OK. Password required > 2013-11-26 11:04:17.008 PASS *********** < 2013-11-26 11:04:17.008 230 OK. Current restricted directory is / > 2013-11-26 11:04:17.008 SYST < 2013-11-26 11:04:17.008 215 UNIX Type: L8 > 2013-11-26 11:04:17.008 FEAT < 2013-11-26 11:04:17.008 211-Extensions supported: < 2013-11-26 11:04:17.008  EPRT < 2013-11-26 11:04:17.008  IDLE < 2013-11-26 11:04:17.008  MDTM < 2013-11-26 11:04:17.008  SIZE < 2013-11-26 11:04:17.008  MFMT < 2013-11-26 11:04:17.008  REST STREAM < 2013-11-26 11:04:17.008  MLST type*;size*;sizd*;modify*;UNIX.mode*;UNIX.uid*;UNIX.gid*;unique*; < 2013-11-26 11:04:17.008  MLSD < 2013-11-26 11:04:17.008  AUTH TLS < 2013-11-26 11:04:17.008  PBSZ < 2013-11-26 11:04:17.008  PROT < 2013-11-26 11:04:17.008  ESTA < 2013-11-26 11:04:17.008  PASV < 2013-11-26 11:04:17.008  EPSV < 2013-11-26 11:04:17.008  SPSV < 2013-11-26 11:04:17.008  ESTP < 2013-11-26 11:04:17.008 211 End. . 2013-11-26 11:04:17.059 Connected . 2013-11-26 11:04:17.059 Got reply 1 to the command 1 . 2013-11-26 11:04:17.059 -------------------------------------------------------------------------- . 2013-11-26 11:04:17.059 Using FTP protocol. . 2013-11-26 11:04:17.059 Doing startup conversation with host. > 2013-11-26 11:04:17.110 PWD < 2013-11-26 11:04:17.118 257 "/" is your current location . 2013-11-26 11:04:17.118 Got reply 1 to the command 16 . 2013-11-26 11:04:17.162 Changing directory to "/". > 2013-11-26 11:04:17.162 CWD / < 2013-11-26 11:04:17.170 250 OK. Current directory is / . 2013-11-26 11:04:17.170 Got reply 1 to the command 16 . 2013-11-26 11:04:17.170 Getting current directory name. > 2013-11-26 11:04:17.170 PWD < 2013-11-26 11:04:17.177 257 "/" is your current location . 2013-11-26 11:04:17.177 Got reply 1 to the command 16 . 2013-11-26 11:04:17.364 Retrieving directory listing... > 2013-11-26 11:04:17.364 TYPE A < 2013-11-26 11:04:17.364 200 TYPE is now ASCII > 2013-11-26 11:04:17.364 PASV < 2013-11-26 11:04:17.364 227 Entering Passive Mode (91,196,124,127,238,109) > 2013-11-26 11:04:17.364 MLSD

Get all items from GUICtrlCreateListView

$
0
0

I have a GUICtrlCreateListView inside a tab in a gui and I am trying to check to see if the selected folder is already in the list so it doesnt get added twice.

 

I imagine the best way would be to get all the items from the listview however I cant seem to figure out how to do it.

          Case $adddir              GUISetState(@SW_DISABLE)              $folder = FileSelectFolder("select a folder", "", 7)              If Not @error Then                   If FileExists($folder) Then                      GUICtrlCreateListViewItem($folder, $DirListView)                   Else                      MsgBox(262160, "Error!", "That location can't be backed up.")                   EndIf             EndIf                                                GUISetState(@SW_ENABLE )

If anyone can point me in the right direction, I tried the function from http://www.autoitscript.com/forum/topic/115521-how-i-read-all-data-in-list-control/ however it didnt return any items.

ListView - Add items in a loop

$
0
0

So since I'm playing with listview now I been trying this

Func Test()     Local $LF_Count = 1     Do         Eval("ïtem" & $LF_Count) = GUICtrlCreateListViewItem("item" & $LF_Count & "|Testing", $listview)         $LF_Count = $LF_Count + 1     Until $LF_Count > 9     $item5 =  GUICtrlCreateListViewItem("erhmz" & $LF_Count & "|testing", $listview)     ;$item1 = GUICtrlCreateListViewItem("item1|test", $listview) EndFunc

As you probably see it will error out on the Eval line, however I tried this as well

Func Test()     Local $LF_Count = 1     Do                 Local $LF_Input = Eval("ïtem" & $LF_Count)                 $LF_Input = GUICtrlCreateListViewItem("item" & $LF_Count & "|" & $LF_Input, $listview)         $LF_Count = $LF_Count + 1     Until $LF_Count > 9     $item5 =  GUICtrlCreateListViewItem("erhmz" & $LF_Count & "|testing", $listview)     ;$item1 = GUICtrlCreateListViewItem("item1|test", $listview) EndFunc

I added the line $item5 to see if it actually got named like that, however it seems it's not? is there any method to do this on a proper way?

I know I could just create item1 till item9 in a row, however I like it a little bit more clean :)

 

Anyone knows?

Exe with Personal icons

$
0
0

I have created script that uses $cmdline to call a determinate function.
Infact my scripts make different things from different $cmdLine.
Compiled script i create shortcut to EXE file inserting different suffix "%1"
in order to run determinate internal function.

For this reason I want also realize EXE compiled that has diferent internal icons
in order to have Shortcut icon for each function called.

Unfortunately program that compile permit me to add only one icon to EXE.
I have proved to edit EXE created using "ResHacker" and add new resource icon,
but when i save new EXE with new icons added, it is not executable, infact causes error.

I have readed on web how do and spoke of "wrapper" but i don't understand How i can do.
Can someone explain better how compile script to exe that have internal more icons
(not for systray icons) but the internal exe icons when i link to it.

Thanks

Viewing all 12506 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>