-
Posts
561 -
Joined
-
Last visited
About sshrum
- Birthday 03/24/1970
Profile Information
-
Location
Anaheim, CA
-
WWW
http://www.shrum.net
Recent Profile Visitors
354 profile views
sshrum's Achievements
-
sshrum reacted to a post in a topic: Trying to compile some old code... AutoItSetOption("MustDeclareVars", 0) acting like 1
-
_INetGetSource issue...might be server side.
sshrum replied to sshrum's topic in AutoIt General Help and Support
F me. s <> z hotrkeys <> hotrkeyz Newb move. -
_INetGetSource issue...might be server side.
sshrum replied to sshrum's topic in AutoIt General Help and Support
URL to folder is: http://shrum.net/sean/code/hotrkeys/ The two files are there. Chrome treats a .au3 file as a download (?), and the .au3.txt as a text file. They shouldn't report 404. EDIT: This has to be a server side issue...I'm getting the same flaky behavior just trying to access the files thru browsers. -
I setup my scripts to pull the string data from the script stored online to do version evals. For some reason, the following isn't working: #include <inet.au3> ConsoleWrite(_InetGetSource('http://www.shrum.net/sean/code/hotrkeyz/hotrkeyz.au3'), TRUE) ConsoleWrite(_InetGetSource('http://www.shrum.net/sean/code/hotrkeyz/hotrkeyz.au3.txt'), TRUE) I did a txt extension just in case the server was having issues sending out the au3 file. This used to work in the past. If I do the helpfile sample code to autoitscript.com, it works. TIA
-
#Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_icon=icons\key_bindings.ico #AutoIt3Wrapper_outfile=hotrkeyz.exe #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** ; ================================================================================================================ ; SCRIPT VERSION (looked for by UpdateCheck() to check for new versions) $sAppVersion = "1.03" ; ================================================================================================================ ; LANGUAGE OPTIONS Opt("TrayMenuMode",1) ;;;Opt("OnExitFunc", "_Exit") ;;;AutoItSetOption("MustDeclareVars", 0) ; ================================================================================================================ ; INCLUDES (update as needed) #include <Array.au3> ; _ArraySort() #Include <Constants.au3> ; #include <Debug.au3> ; _DebugSetup(), _DebugOut() #include <INet.au3> ; _InetGetSource() ; ================================================================================================================ ; DUPLICATE INSTANCE CHECK (may need to remove or move this around depending on where it is needed) If UBound(ProcessList(@ScriptName)) > 2 Then Exit ; ================================================================================================================ ; VARIABLE DECLARATIONS / DEFAULTS Global $bDebug = False, $bVerbose ; ================================================================================================================ ; SCRIPT IDENTITY (this is based on the filename of the script/executable) $sAppName = stringupper(stringleft(@scriptname,1)) & StringTrimLeft(stringtrimright(@scriptname,4),1) $sAppAuthor = "Sean Shrum" $sAppEmail = StringLower($sAppName)& "@shrum.net" $sAppHome = "http://www.shrum.net/sean/code/" & StringLower($sAppName) $sAppNews = "http://www.shrum.net/cats.php?search=" & StringLower($sAppName) & "&dir=/updates" ;;;$sAppDonate = "a href="/cats.php?dir=/sean/code&body=./donations.shtml" $sAppFileType ="." & StringLower($sAppName) $aAppBuild = FileGetTime(@ScriptFullPath) $sAppBuild = $aAppBuild[0] & "." & $aAppBuild[1] & "." & $aAppBuild[2] & " @ " & $aAppBuild[3] & ":" & $aAppBuild[4] & ":" & $aAppBuild[5] $sAppTitle = $sAppName & " v." & $sAppVersion $sAppRegSettings = "HKCU\software\shrum.net\" & $sAppName $sAppINISettings = @scriptdir & "\" & StringLower($sAppName) & ".ini" ; ================================================================================================================ ; TRAY ICON AND TOOLTIP SET (looks for <appname>.ico in same folder as <appname>.exe otherwise uses the build icon) TraySetToolTip($sAppTitle) TraySetIcon($sAppName & ".ico") ; ================================================================================================================ ; SPLASH SCREEN / TRAYTIP BUBBLE (*only* if no command line params are present: automated run/batch call) if $CmdLine[0] = 0 Then Traytip($sAppTitle,$sAppHome & @CRLF & "By " & $sAppAuthor & " :: " & $sAppEmail,5) ; ================================================================================================================ ; PROGRAM GROUP / SHORTCUTS CREATION (fires only when Executed reg value = "" from above) $iRunCount = RegRead($sAppRegSettings, "Executed") If $iRunCount = "" Then DirCreate(@ProgramsCommonDir & "\shrum.net\" & $sAppName) FileCreateShortcut(@ScriptFullPath, @ProgramsCommonDir & "\shrum.net\" & $sAppName & "\" & $sAppName & ".lnk") FileCreateShortcut($sAppHome, @ProgramsCommonDir & "\shrum.net\" & $sAppName & "\Homepage.lnk") FileCreateShortcut($sAppDonate, @ProgramsCommonDir & "\shrum.net\Donate.lnk") FileCreateShortcut(@ScriptFullPath, @UserProfileDir & "\application data\microsoft\Internet Explorer\Quick Launch\" & $sAppName & ".lnk") EndIf ; ================================================================================================================ ; REGISTRY UPDATES (location, version, runcount) RegWrite($sAppRegSettings, "Executed", "REG_SZ", $iRunCount + 1) RegWrite($sAppRegSettings, "", "REG_SZ", @Scriptdir) RegWrite($sAppRegSettings, "Version", "REG_SZ", $sAppVersion) ; ================================================================================================================ ; SYSTRAY MENU DEFINITIONS (if any) TrayCreateItem ("[ Settings ]") $mCombos = TrayCreateItem ("...Combos") TrayItemSetState (-1, $TRAY_DEFAULT) $mReload = TrayCreateItem ("...Reload") TrayCreateItem ("") TrayCreateItem ("[ Project ]") $mAbout = TrayCreateItem ("...About") $mUpdate = TrayCreateItem ("...Update") $mDebug = TrayCreateItem ("...Debug") $mHomepage = TrayCreateItem ("...Homepage") $mNews = TrayCreateItem ("...News") $mSupport = TrayCreateItem ("...Support") ;;;$mDonate = TrayCreateItem ("...Donate") $mExit = TrayCreateItem ("...Exit") TraySetState () TraySetClick (16) ; ================================================================================================================ ; LAST RUN SETTINGS LOAD ; N/A ; ================================================================================================================ ; COMMAND-LINE / <appname>.INI EVALUATION ; N/A ; ================================================================================================================ ; ARGUMENT CHECKS / PROMPTS ; N/A ; ================================================================================================================ ; DEBUG WINDOW (notepad; if requested) if $bDebug then _DebugSetup() ; ================================================================================================================ ; SETTINGS SAVE (all user passed params should be formatted to program-desired formats by this point) ; N/A ; ================================================================================================================ ; MAIN PROGRAM if _GetCombosDir() = "" then _SetCombosDir() _CombosDirReadSet() while 1 _MenuMonitor() WEnd ; ================================================================================================================ ; FUNCTIONS Func _AboutDialog() _ConsoleWrite("+ _AboutDialog()") msgbox(0,"About", $sAppTitle & " ( build " & $sAppBuild & " ) by " & $sAppAuthor & @crlf & $sAppHome & " :: " & StringLower($sAppName) & "@shrum.net") if msgbox(4,$sAppTitle, "Would you like information regarding a small donatation in support of " & $sAppname & "?") = 6 then _ConsoleWrite(": Opening website '" & $sAppDonate & "'") Run(@ComSpec & " /c start " & $sAppDonate) endif _ConsoleWrite("- _AboutDialog()") EndFunc func _CombosDirReadSet() _ConsoleWrite("+ _CombosDirReadSet()") $sCombosDir = _GetCombosDir() if not fileexists($sCombosDir & "\! = ALT") Then FileOpen($sCombosDir & "\! = ALT",1) FileOpen($sCombosDir & "\# = WIN",1) FileOpen($sCombosDir & "\^ = CTRL",1) FileOpen($sCombosDir & "\+ = SHIFT",1) EndIf _ConsoleWrite("> Collecting hotkey directories listed under '" & $sCombosDir & "'") $aResult = "" $aResult = _FileSearch($sCombosDir, ".", ".", 2, False) If $aResult[0] > 0 Then _ConsoleWrite("> Activating the following hotkeys:") For $i = 1 To $aResult[0] _ConsoleWrite(": " & stringtrimleft($aResult[$i], Stringlen($sCombosDir) + 1)) HotKeySet(stringtrimleft($aResult[$i], Stringlen($sCombosDir) + 1), "_HotKeyTrap") Next EndIf _ConsoleWrite("- _CombosDirReadSet()") EndFunc func _ConsoleWrite($sMsg) _DebugOut($sMsg) Consolewrite($sMsg & @CRLF) EndFunc Func _DefineSetting($sSetting="", $sValue="") _consolewrite('+ _DefineSetting("' & $sSetting & '", "' & $sValue & '")') Switch $sSetting case "Debug" if $sValue then $bDebug = $sValue Else if not $bDebug then $bDebug = True Else $bDebug = False EndIf endif if $bDebug Then _DebugSetup("Debug console :: " & $sAppTitle & " :: build " & $sAppBuild) opt("TrayIconDebug",1) TrayItemSetState($mDebug,1) _DebugOut("+ Application: " & @scriptname) _DebugOut("+ Version: " & $sAppVersion) _Debugout("+ Build: " & $sAppBuild) _DebugOut("+ Location: " & @Scriptdir) _DebugOut("+ OS: " & @OSVersion & " build " & @OSBuild & " " & @OSServicePack & " (" & @OSTYPE & ")") _DebugOut("+ Language: " & @OSLang) _DebugOut("+ Processor: " & @ProcessorArch) _DebugOut(" ") _DebugOut("[== Start: " & @year & "." & @mon & "." & @MDAY & " @ " & @hour & ":" & @min & ":" & @sec & " ======================]") Else opt("TrayIconDebug",0) TraySetToolTip($sAppTitle) TrayItemSetState($mDebug,4) _DebugOut("[== End: " & @year & "." & @mon & "." & @MDAY & " @ " & @hour & ":" & @min & ":" & @sec & " ========================]") EndIf EndSwitch _consolewrite("- _DefineSetting()") EndFunc Func _Exit() _ConsoleWrite("+ _Exit()") if $bDebug then _DefineSetting("Debug", False) _ConsoleWrite("- _Exit()") Exit EndFunc Func _FileSearch($FSstartDir, $FSFilepattern = ".", $FSFolderpattern = ".", $FSFlag = 0, $FSrecurse = True, $FSdepth = 0) _ConsoleWrite('+ _FileSearch("' & $FSstartDir & '", "' & $FSFilepattern & '", "' & $FSFolderpattern & '", ' & $FSFlag & ', ' & $FSrecurse & ', ' & $FSdepth & ')') If StringRight($FSstartDir, 1) <> "\" Then $FSstartDir &= "\" If $FSdepth = 0 Then $FSfilecount = DirGetSize($FSstartDir, 1) Global $FSarray[$FSfilecount[1] + $FSfilecount[2] + 1] EndIf $FSsearch = FileFindFirstFile($FSstartDir & "*.*") If @error Then Return While 1 $FSnext = FileFindNextFile($FSsearch) If @error Then ExitLoop If StringInStr(FileGetAttrib($FSstartDir & $FSnext), "D") Then If $FSrecurse And StringRegExp($FSnext, $FSFolderpattern, 0) Then _FileSearch($FSstartDir & $FSnext, $FSFilepattern, $FSFolderpattern, $FSFlag, $FSrecurse, $FSdepth + 1) EndIf If $FSFlag <> 1 Then $FSarray[$FSarray[0] + 1] = $FSstartDir & $FSnext $FSarray[0] += 1 EndIf ElseIf StringRegExp($FSnext, $FSFilepattern, 0) And $FSFlag <> 2 Then $FSarray[$FSarray[0] + 1] = $FSstartDir & $FSnext $FSarray[0] += 1 EndIf WEnd FileClose($FSsearch) If $FSdepth = 0 Then ReDim $FSarray[$FSarray[0] + 1] _ArraySort($FSarray) _ConsoleWrite("- _FileSearch()") Return $FSarray EndIf _ConsoleWrite("- _FileSearch()") EndFunc func _GetCombosDir() _ConsoleWrite("+ _GetCombosDir()") $sCombosDir = Regread($sAppRegSettings, "Combos") if $sCombosDir <> "" then _ConsoleWrite(": Registry value set, checking: " & $sCombosDir) while not FileExists($sCombosDir) Msgbox(0,$sAppTitle, "Unable to locate defind combos folder. You will now be prompted to define a new location.") _SetCombosDir() WEnd Else _ConsoleWrite(": Registry value not set, prompting.") _SetCombosDir() EndIf $sCombosDir = Regread($sAppRegSettings, "Combos") return $sCombosDir EndFunc Func _HotKeyTrap() _ConsoleWrite("+ _HotkeyTrap()") _Run(_GetCombosDir() & "\" & @HotKeyPressed) _ConsoleWrite("- _HotkeyTrap()") EndFunc ;==>_HotKeyTrap func _MenuMonitor() $msg = TrayGetMsg () Select Case $msg = $TRAY_EVENT_PRIMARYDOWN _AboutDialog() Case $msg = $mCombos _ShellExecute('"' & _GetCombosDir() & '"') Case $msg = $mReload _CombosDirReadSet() Case $msg = $mAbout _AboutDialog() Case $msg = $mDebug _DefineSetting("Debug", Not $bDebug) case $msg = $mUpdate _UpdateCheck() case $msg = $mHomepage _ShellExecute($sAppHome) case $msg = $mSupport _ShellExecute("mailto:" & $sAppEmail &"?subject=[%20Support%20]%20" & $sAppName & "%20v." & $sAppVersion) case $msg = $mNews _ShellExecute($sAppNews) case $msg = $mDonate _ShellExecute($sAppDonate) case $msg = $mExit Exit EndSelect EndFunc Func _Random($iMax) ; Cus AutoIT's Random(1,1,1) returns 0 every time _ConsoleWrite('+ _Random(' & $iMax & ')') If $iMax = 1 Then $iResult = 1 Else $iResult = Random(1, $iMax, 1) EndIf _ConsoleWrite('+ _Random(' & $iMax & ')') Return $iResult EndFunc ;==>_Random Func _Run($sRun, $sParameter = "") _ConsoleWrite('+ _Run("' & $sRun & '", "' & $sParameter & '")') $aFiles = _FileSearch($sRun, ".", ".", 1) if isarray($aFiles) Then For $i = 1 To $aFiles[0] _ShellExecute($aFiles[$i], $sParameter) Next Else _ConsoleWrite(": Location contains no files") EndIf _ConsoleWrite("- _Run()") EndFunc ;==>_Run func _SetCombosDir() $sResult = FileSelectFolder("Select the folder that will hold or currently holds your Hotrkeyz combo subfolders. Pressing Cancel or Esc will automatically create a \combos folder in the executable location.", "", 7) if @error then $sResult = @scriptdir & "\combos" dircreate($sResult) EndIf RegWrite($sAppRegSettings, "Combos", "REG_SZ", $sResult) EndFunc Func _ShellExecute($sCmd, $sParam = "") _ConsoleWrite('+ _ShellExecute("' & $sCmd & '", "' & $sParam & '")') If $sCmd = "" Then _ConsoleWrite(": No command passed") Else _ConsoleWrite(": Running '" & $sCmd & "'") ShellExecute('"' & $sCmd & '"', $sParam) EndIf _ConsoleWrite("- _ShellExecute()") EndFunc ;==>_ShellExecute func _UpdateCheck() _ConsoleWrite("+ _UpdateCheck()") traytip($sAppTitle, "Retrieving public version from source...",10) $sTemp = "" $aTemp = stringsplit(_InetGetSource($sAppHome & "/" & stringlower($sAppName) & ".au3"), @CRLF) For $i = 1 to $aTemp[0] if StringInStr($aTemp[$i], "$sAppVersion") then $sTemp = $aTemp[$i] ExitLoop endif Next if $sTemp <> "" then $aOnlineVersion = StringSplit($sTemp, "=") $sOnlineVersion = StringReplace(StringStripWS($aOnlineVersion[2], 8), '"', "") _ConsoleWrite(": Online = " & $sOnlineVersion) _ConsoleWrite(": User = " & $sAppVersion) if $sOnlineVersion <> "" and Not Stringinstr($sOnlineVersion, "<html>") Then If $sAppVersion < $sOnlineVersion Then _ConsoleWrite(": User is OLDER") TrayTip($sAppTitle, "Your version is out-of-date",5) $sMsg = "A newer version of this program is available for download." & @CRLF & @CRLF $sMsg &= "Do you want to visit the " & $sAppname & " site to download the newer version?" & @CRLF & @CRLF $sMsg &= "Selecting 'Yes' will close this app and take you to the website." If MsgBox(4, $sAppTitle, $sMsg) = 6 Then _ConsoleWrite(": Launching default web browser to " & $sAppHome) _ShellExecute($sAppHome) Exit EndIf ElseIf $sAppVersion = $sOnlineVersion Then _ConsoleWrite(": User is EQUAL") TrayTip($sAppTitle, "Your version is up-to-date.",5) ElseIf $sAppVersion > $sOnlineVersion Then _ConsoleWrite(": User is NEWER") TrayTip($sAppTitle, "Your version is newer; current public release = v." & $sOnlineVersion & @CRLF & "This may be due to you running a newer beta version",5) EndIf Else _ConsoleWrite(": Data received but no version info found") traytip($sAppTitle,"Unable to locate versioning info in data received." & @CRLF & "Please go to the homepage for further update details.",5) EndIf Else _ConsoleWrite(": Unable to obtain version content") traytip($sAppTitle,"Unable to obtain online version info." & @CRLF & "Check your connection and try again.",5) EndIf _ConsoleWrite("- _UpdateCheck()") EndFunc Line 16 And while we're there, what happened to OnExitFunc?
-
Pulled up some out code I had, just making a 1 line move to redefined a different tray default. Went to compile and was hit in the face with all the undeclared error msgs in the compile. Thought that was odd as I had MustDeclareVars off. First thing I tried was to rem out the MustDeclareVars line and recompile. All worked fine.
-
Why is AutoIT treating this: AutoItSetOption("MustDeclareVars", 0) ...as if it was... AutoItSetOption("MustDeclareVars", 1) ??? I know that "0" is the default and if I REM out the line everything works as if the 0 line was there. I just like making sure if defaults change my code continues to work the way I set it up.
-
COM port functionality...can I send/recieve data from?
sshrum replied to sshrum's topic in AutoIt General Help and Support
Perfect....via the kernel was what I needed. Thx. -
I'm back. Damn I've been gone awhile. Has anyone gotten around to making a set of functions that would allow AutoIT to send and receive via a COM port natively (sans any weird DLL installs)? I searched and found old refs to something called a COMMMG.AU3 include file but I can't find it. Perhaps it was dropped. TIA
-
bootlesnet reacted to a post in a topic: Check Wan IP with Email Notification
-
Started doing some work on my old music playback scripts and found that most of my _WM functions no longer are listed in the help. I can still call things like _WMStartPlayer() and a few others but volume and positioning seem to no longer work. Is my memory just foggy? EDIT: Foggy....looked it over and found the functions and OCX calls.
-
MTP protocol...anyone looking into this anymore?
sshrum replied to sshrum's topic in AutoIt General Help and Support
Did a quick lookover the docs. I'll admit this goes a bit outside my comfort zone. Not sure how to create func to access this. Was hoping for just a simple #include that would allow for simple file copy/delete functionality I can "see" the MTP device in the Select Folder dialog but that comes up as a weird "::{<bunchofnums>}" looking thing when selected. -
What replaced _StringAddThousandsSep()?
sshrum replied to sshrum's topic in AutoIt General Help and Support
I tried RegEx first but my RegEx skills just aren't up there yet. Thanx -
What replaced _StringAddThousandsSep()?
sshrum replied to sshrum's topic in AutoIt General Help and Support
Saw that code...I wrote my own Local $sNum, $aNum, $aInt, $sInt, $iCount $sNum = "34532452345234525.348934589" $aNum = StringSplit($sNum,".") If $aNum[1] <> "" then $aInt = StringSplit($aNum[1],"") For $i = $aInt[0] to 1 step -1 $sInt = $aInt[$i] & $sInt $iCount += 1 if mod($iCount, 3) = 0 and $i <> 1 then $sInt = "," & $sInt Next $sNum = $sInt & "." & $aNum[2] EndIf Msgbox(0,"",$sNum)