
vestanpance
Members-
Posts
8 -
Joined
-
Last visited
vestanpance's Achievements

Seeker (1/7)
0
Reputation
-
vestanpance reacted to a post in a topic: GUICtrlMenuEx UDF (Standard Menu With Icon)
-
Multiple IF statements.
vestanpance replied to vestanpance's topic in AutoIt General Help and Support
As they say on 'Who wants to be a Millionaire' ; It's only obvious if you know the answer... That said, this evening, i've understood what you meant by your previous comment and i've changed it to: If $iFileExists Then Local $LocalFile = FileGetVersion($sFilePath, "FileVersion") Local $RemoteFile = FileGetVersion("\\10.228.167.84\htdocs\downloads\software\AutoIT\Ultimatix.exe", "FileVersion") Local $UpdateAvailable = _VersionCompare($LocalFile, $RemoteFile) If $UpdateAvailable = -1 Then Local $hDownload = InetGet("http://10.228.167.84/downloads/software/AutoIT/Ultimatix.exe", $sFilePath, $INET_FORCERELOAD, $INET_DOWNLOADBACKGROUND) So i hope i have understood your comments and direction. Thanks to all for your input, patience and for pointing me in the right direction. -
Multiple IF statements.
vestanpance replied to vestanpance's topic in AutoIt General Help and Support
The Helpfile and i are well acquainted which in truth, is why i generally don't need to use the forums. I looked at _VersionCompare() before settling with FileGetVersion because i wasn't getting the results i wanted. I've modified the helpfile example to this. I think i have used it correctly? Local $LocalFile = @MyDocumentsDir & "\AutoIT_Toolbar\Toolbar Items\Apps\Ultimatix.exe" Local $RemoteFile = "\\10.228.167.84\htdocs\downloads\software\AutoIT\Ultimatix.exe" Consolewrite(_VersionCompare($LocalFile, $RemoteFile) & @CRLF) But i always get "1", which according to the helpfile means Version 1 is greater. Even if the remote file Version is greater. However, if i check both .exe files (local and remote) using FileGetVersion, i get the same result for both files? -
Multiple IF statements.
vestanpance replied to vestanpance's topic in AutoIt General Help and Support
Thank you so much MichaelHB, you cracked it... Works a treat... Now to read and understand how you completed the statement, vs how i wrote it. Also be looking at _VersionCompare() as advised by Jos to see how that works. Thanks very much to everyone who had input.. Much appreciated! Daz -
vestanpance reacted to a post in a topic: Multiple IF statements.
-
Multiple IF statements.
vestanpance replied to vestanpance's topic in AutoIt General Help and Support
Hi Jos, thanks for your input.. Always learning, but i don't understand how to use the _VersionCompare for the two files. If i use the code: Local $LocalFile = FileGetVersion ($sFilePath, "FileVersion") Local $RemoteFile = FileGetVersion("\\1x.2x.1x.8x\htdocs\downloads\software\AutoIT\Ultimatix.exe", "FileVersion") ConsoleWrite("The Local File Version is: " & $LocalFile & @CRLF & "The Remote File Version is: " & $RemoteFile & @CRLF) I end up with the following result in the console: The Local File Version is: 2.0.0.3 The Remote File Version is: 2.0.0.2 So for this instance, it doesn't download anything (because the remote file isn't newer) but what i mean is, FileGetVersion is serving it's purpose for me.... even if i am using it in the wrong way.. -
Multiple IF statements.
vestanpance replied to vestanpance's topic in AutoIt General Help and Support
I want to launch the local version of Ultimatix.exe. Basically i want to do the following. When the function is chosen from the menu: Check to see if Ultimatix.exe is on the local machine. If Ultimatix.exe is NOT on the local machine, download it from the network drive and then launch the local Ultimatix.exe. If Ultimatix.exe IS on the local machine, Is the remote version more up to date? If the remote version of Ultimatix.exe is more up to date - download the newer version overwriting the older version and then execute the local Ultimatix.exe. If the local version of Ultimatix.exe is the same as the remote version (so i haven't create a newer version of Ultimatix.exe and put it on a network drive) then just execute the version you have locally. I hope i'm making sense -
Hi all, It's rare i post anything as i usually find the answers i want by browsing the forum.. but i can't get this statement right, and i could well be doing it wrong anyway and i was hoping someone could either correct my code or tell me i'm doing things the hard way around.. The function below is launched via a system tray Menu/GUI (using code from "ModernMenu UDF by Holger Kotsch") So i choose Ultimatix from the Menu and it launches the function. To run though the code briefly: It checks to see if Ultimatix.exe is present on the local machine first and if it isn't download it and then open the local file Ultimatix.exe. - It does that just fine. It checks to see if Ultimatix.exe is present and if it is, check to see if the remote file (Ultimatix.exe) has a higher version revision. If it does, download the remote file overwriting the local file and then open the local file Ultimatix.exe. - It does that just fine too. However, if the local file exists AND it's the same revision as the remote file, it doesn't do anything and that's where i'm stuck.. Func Ultimatix() ;Launch Ultimatix Local Const $sFilePath = @MyDocumentsDir & "\AutoIT_Toolbar\Toolbar Items\Apps\Ultimatix.exe" Local $iFileExists = FileExists($sFilePath) If $iFileExists Then Local $LocalFile = FileGetVersion ($sFilePath, "FileVersion") Local $RemoteFile = FileGetVersion("\\1x.2x.1x.8x\htdocs\downloads\software\AutoIT\Ultimatix.exe", "FileVersion") Consolewrite("The file exists" & @CRLF) If $RemoteFile > $LocalFile Then Local $hDownload = InetGet("http://1x.2x.1x.8x/downloads/software/AutoIT/Ultimatix.exe", $sFilePath, $INET_FORCERELOAD, $INET_DOWNLOADBACKGROUND) Do ; Wait for the download to complete by monitoring when the 2nd index value of InetGetInfo returns True. Sleep(250) Until InetGetInfo($hDownload, $INET_DOWNLOADCOMPLETE) InetClose($hDownload) ; Close the handle returned by InetGet. Consolewrite("Remote file is greater than local file" & @CRLF) ShellExecute($sFilePath) Elseif $LocalFile > $RemoteFile Then Consolewrite("local file is greater than remote file" & @CRLF) ShellExecute($sFilePath) EndIf Else Local $hDownload = InetGet("http://1x.2x.1x.8x/downloads/software/AutoIT/Ultimatix.exe", $sFilePath, $INET_FORCERELOAD, $INET_DOWNLOADBACKGROUND) Do ; Wait for the download to complete by monitoring when the 2nd index value of InetGetInfo returns True. Sleep(250) Until InetGetInfo($hDownload, $INET_DOWNLOADCOMPLETE) InetClose($hDownload) ; Close the handle returned by InetGet. ShellExecute($sFilePath) Consolewrite("I downloaded the file" & @CRLF) EndIf EndFunc ;==>Ultimatix Have i tried to over complicate things or have i missed something a little bit obvious? Many thanks in advance.
-
Adding an Input Control to the taskbar.
vestanpance replied to vestanpance's topic in AutoIt GUI Help and Support
I'm still struggling to make this work..... Can anyone please assist....? -
Hi experts This is my very first post, so please be gentle I've been using AutoIt for about a year now, on and off creating useful scripts. I've never asked for help, preferring to use the forums for ideas on how to proceed, the help file when i know what I'm looking for and Google when all else fails. I recently created a gui with an input box. When you put in a mac address of a network device(for example:) A1-B2-C3-D4-E5-F6) into a textbox, with the click of a button it would automatically convert it into A1B2.C3D4.E5F6 and copy it to the clipboard. (this is the prefered style of mac-address) For convenience and (maybe people would find it useful in other ways) i have posted that script below. There are probably better ways of doing what i've concocted below but, it works... (The resolution part is because sometimes my laptop is docked, other times it isnt...) #NoTrayIcon #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <Misc.au3> #include <MsgBoxConstants.au3> #include <ColorConstants.au3> #Include <Restart.au3> Global $Input1 Global $resolution GUISetState(@SW_SHOW) _Desktop_Resolution() _MacFormat() Opt("TrayIconHide", 1) ;0=show, 1=hide tray icon Func _MacFormat() If $resolution = "1280 x 1024" Then $Form1 = GUICreate("MAC-Converter", 165, 35, 1110, 961, $WS_POPUP, BitOR($WS_EX_TOPMOST, $WS_EX_TOOLWINDOW)) If $resolution = "1440 x 900" Then $Form1 = GUICreate("MAC-Converter", 165, 35, 1277, 833, $WS_POPUP, BitOR($WS_EX_TOPMOST, $WS_EX_WINDOWEDGE, $WS_EX_TOOLWINDOW)) If $resolution = "1152 x 864" Then $Form1 = GUICreate("MAC-Converter", 200, 35, 946, 777, $WS_POPUP, BitOR($WS_EX_TOPMOST, $WS_EX_WINDOWEDGE, $WS_EX_TOOLWINDOW)) ;Make the window slightly transparent WinSetTrans($Form1, "", 230) GUISetState(@SW_SHOW) $Input1 = GUICtrlCreateInput("MAC to convert", 5, 8, 98, 21) $Button1 = GUICtrlCreateButton("Convert", 108, 8, 50, 21) GUICtrlSetState($Input1, $GUI_FOCUS) Sleep(500) Local $hWnd = WinGetHandle("[ACTIVE]") WinSetOnTop($hWnd, "", 1) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 _ModMyMac() EndSwitch WEnd EndFunc ;==>_MacFormat Func _ModMyMac() Global $datamac = GUICtrlRead($Input1) $datamac = StringLower($datamac) If StringInStr($datamac, ".") Then GUICtrlSetData($Input1, $datamac) EndIf If StringInStr($datamac, "-") Then Local $aDays = StringSplit($datamac, "-") ; Split the string of days using the delimeter "," and the default flag value. $datamac = $aDays[1] & $aDays[2] & "." & $aDays[3] & $aDays[4] & "." & $aDays[5] & $aDays[6] EndIf GUICtrlSetData($Input1, $datamac) GUICtrlSetState($Input1, $GUI_FOCUS) ClipPut($datamac) GUICtrlSetState($Input1, $GUI_NOFOCUS) _ScriptRestart() EndFunc ;==>_ModMyMac Func _IsChecked($iControlID) Return BitAND(GUICtrlRead($iControlID), $GUI_CHECKED) = $GUI_CHECKED EndFunc ;==>_IsChecked Func _Desktop_Resolution() Global $resolution Switch $resolution = "" Case @DesktopWidth = 1280 And @DesktopHeight = 1024; Super eXtended Graphics Array $resolution = "1280 x 1024" Case @DesktopWidth = 1440 And @DesktopHeight = 900; Wide Super eXtended Graphics Array $resolution = "1440 x 900" Case @DesktopWidth = 1152 And @DesktopHeight = 864; Wide Super eXtended Graphics Array $resolution = "1152 x 864" Case Else Return SetError(1, 0, $resolution) EndSwitch Return $resolution EndFunc ;==>_Desktop_Resolution What i am here to ask is...... I'd like to take this input box and place it into the taskbar itself, right next to the clock... I used to use an Application in the past that created an input box in the taskbar, which gave me the initial idea.. There doesn't appear to be a great deal on this topic, but i did find something called 'rebar' Going along those lines, so far i've come up with this. #include <GuiReBar.au3> #include <GuiToolbar.au3> #include <GuiComboBox.au3> #include <GuiDateTimePicker.au3> #include <GuiEdit.au3> #include <WindowsConstants.au3> #include <Constants.au3> #include <GUIConstantsEx.au3> Local $hTaskBar = _WinAPI_FindWindow("Shell_TrayWnd", "") Local $hRebar = ControlGetHandle($hTaskBar, "", "ReBarWindow321") $hReBar = ControlGetHandle("[CLASS:Shell_TrayWnd]", "", "ReBarWindow321") ;~ $hgui = GUICreate("", 100, 20, -1, -1, -1,0) ;~ DllCall("user32.dll", "hwnd", "SetParent", "hwnd", $hgui, "hwnd", WinGetHandle("Program Manager")) ;~ $hToolbar = _GUICtrlToolBar_Create($hReBar) ;~ $hInput = GUICtrlCreateInput("Input control", 10, 0, 120, 20) $hInput = _GUICtrlEdit_Create($hReBar, "Input control", 950, 2, 120, 20) While 1 sleep(10) WEnd It's not finished, but i have hit some complications. The input box isn't selectable, so i can't type anything in. It also seems the whole taskbar becomes 'locked' until the script is stopped. I'm probably going down the wrong path, but i've proven to myself it's at least a little bit possible by even managing to get a textbox into the taskbar. Can someone please point me in the right direction. Many thanks, Daz